swagger: '2.0'
info:
  description: Configuration for CSR File resource.
  version: 'v2'
  title: ns_ssl_csr
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_ssl_csr
    description: CSR File
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: file_name
   in: path
   type: string
   description: Name for and, optionally, path to the certificate signing request (CSR)
   required: true
  authParam:
      in: header
      name: Authorization
      type: string
      required: true
      description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
  cloudParam:
      in: header
      name: isCloud
      type: string
      required: true
      description: set the value to true in case of Cloud services, false for on-prem deployment
paths:
  /massvc/{customerid}/nitro/v2/config/ns_ssl_csr:
    get:
      tags:
        - ns_ssl_csr
      summary: GET all ns_ssl_csr
      operationId: getall_ns_ssl_csr
      description: Use this operation to get csr file.
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
        - in: query
          name: filter
          type: string
          required: false
          description: "Use this query-parameter to get the filtered set of vm_device resources configured on the system. You can set a filter on any property of the resource.Example:  property-name1:property-value1 "
        - in: query
          name: pagesize
          type: integer
          required: false
          description: Use this query-parameter to get the ns_ssl_csr resources in chunks.To be used along with pageno query parameter.
        - in: query
          name: pageno
          type: integer
          required: false
          description: Use this query-parameter to get the ns_ssl_csr resources in chunks.To be used along with pagesize query parameter.
        - in: query
          name: count
          type: string
          required: false
          description: Use this query-parameter to get the count of ns_ssl_csr resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_ssl_csr
          schema: 
              $ref: '#/definitions/getns_ssl_csrsResponse'
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

    post:
      tags:
        - ns_ssl_csr
      summary: POST operation for ns_ssl_csr
      operationId: post_ns_ssl_csr
      description: POST operation for ns_ssl_csr
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
        - in: query
          name: onerror
          description: Use this parameter to set the onerror status for nitro request. Applicable only for bulk requests.
          required: false
          type: string
          default: CONTINUE
          enum:
            - EXIT
            - CONTINUE
        - in: body
          name: ns_ssl_csr
          description: ns_ssl_csr object
          schema:
              $ref: '#/definitions/addns_ssl_csrRequest'
      responses:
        200:
          description: add for ns_ssl_csr
          schema: 
              $ref: '#/definitions/addns_ssl_csrResponse'
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

  /massvc/{customerid}/nitro/v2/config/ns_ssl_csr/{file_name}:
    get:
      tags:
        - ns_ssl_csr
      summary: GET by key for ns_ssl_csr
      operationId: getbykey_ns_ssl_csr
      description: Use this operation to get csr file.
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - $ref: '#/parameters/idParam'
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
      responses:
        200:
          description: add for ns_ssl_csr
          schema: 
              $ref: '#/definitions/getns_ssl_csrResponse'
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

    post:
      tags:
        - ns_ssl_csr
      summary: POST operation with actions for ns_ssl_csr
      operationId: post_ns_ssl_csr_actions
      description: POST operation with actions for ns_ssl_csr
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - $ref: '#/parameters/idParam'
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
        - in: query
          name: action
          type: string
          required: true
          enum: [create_certificate,renew_certificate]
          description: >
            actions:
              * `create_certificate` - Use this operation to create a certificate.
              * `renew_certificate` - Use this operation to renew certificate.

        - in: body
          name: ns_ssl_csr
          description: ns_ssl_csr object
          schema:
              $ref: '#/definitions/addns_ssl_csrRequest'
      responses:
        200:
          description: renew_certificate for ns_ssl_csr
          schema: 
              $ref: '#/definitions/addns_ssl_csrResponse'
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

    delete:
      tags:
        - ns_ssl_csr
      summary: Delete for ns_ssl_csr
      operationId: deletebykey_ns_ssl_csr
      description: Use this operation to delete csr file
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - $ref: '#/parameters/idParam'
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
      responses:
        204:
          description: renew_certificate for ns_ssl_csr
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

  /massvc/{customerid}/nitro/v2/upload/ns_ssl_csr:
    post:
      tags:
        - ns_ssl_csr
      summary: Upload operation for ns_ssl_csr
      operationId: upload_ns_ssl_csr
      description: Use this operation to upload csr file
      consumes:
        - multipart/form-data
      produces:
        - application/json
      parameters:
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
        - in: formData
          name: ns_ssl_csr
          description: ns_ssl_csr file
          type: file
          required: true
      responses:
        200:
          description: Successful upload for ns_ssl_csr
          schema: 
              $ref: '#/definitions/Done'
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

  /massvc/{customerid}/nitro/v2/download/ns_ssl_csr/{file_name}:
    get:
      tags:
        - ns_ssl_csr
      summary: Download operation for ns_ssl_csr
      operationId: download_ns_ssl_csr
      description: Use this operation to download csr file
      consumes:
        - application/json
      produces:
        - attachment
      parameters:
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
        - in: path
          name: file_name
          type: string
          required: true
          description: Name for and, optionally, path to the certificate signing request (CSR)
      responses:
        200:
          description: Successful download for ns_ssl_csr
          schema: 
              type: file
              format: binary
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

definitions:
  addns_ssl_csrRequest:
    type: object
    required:
      - ns_ssl_csr
    properties:
      ns_ssl_csr:
        $ref: '#/definitions/ns_ssl_csr_readwrite'
    title: addns_ssl_csrRequest
    example:
      ns_ssl_csr:
        statename: "California"
        issuer: "Venafi lab"
        keyform: "PEM"
        keyalgorithm: "RSA"
        app_name: "sharepoint_app"
        certificate_dn: "\\VED\\Policy\\TLS\\Citrix\\testcert"
        keystrength: "2048"
        city: "Bangalore"
        countryname: "US"
        policy: "\\VED\\Policy\\TLS\\Citrix"
        passphrase: "password"
        is_deploy: "false"
        commonname: "default GPNZIS"
        organizationname: "Company ANG"
        organizationunit: "BizDev"
        file_location_path: "C:\\myfiles"
        subjaltname: "DNS:testapp.mycompany.com"
        keyfile: "newkeyfile"
        certificate_name: "VenafiTestCert"

  addns_ssl_csrResponse:
    type: object
    required:
      - ns_ssl_csr
    properties:
      ns_ssl_csr:
        $ref: '#/definitions/ns_ssl_csr'
    title: addns_ssl_csrResponse
    example:
      ns_ssl_csr:
        serial_number: "01"
        statename: "California"
        file_size: "1751"
        issuer: "Venafi lab"
        keyform: "PEM"
        is_dir: "false"
        keyalgorithm: "RSA"
        app_name: "sharepoint_app"
        certificate_dn: "\\VED\\Policy\\TLS\\Citrix\\testcert"
        keystrength: "2048"
        city: "Bangalore"
        file_name: "1.1.1.1_IDPCert"
        countryname: "US"
        policy: "\\VED\\Policy\\TLS\\Citrix"
        passphrase: "password"
        file_last_modified_epoch: "1568926276"
        is_deploy: "false"
        commonname: "default GPNZIS"
        tenant_name: "citrix123"
        activity_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        organizationname: "Company ANG"
        organizationunit: "BizDev"
        file_last_modified: "2019-09-19 20:51:16"
        certificate_policy_object: {        wildcards_allowed: "boolean_value"
,        state: "string_value"
,        management_type: "string_value"
,        is_ca_locked: "boolean_value"
,        is_city_locked: "boolean_value"
,        policy: "string_value"
,        keypair_algorithm: "string_value"
,        key_generation: "string_value"
,        subjaltname_ip_allowed: "boolean_value"
,        org: "string_value"
,        name: "string_value"
,        is_key_value_locked: "boolean_value"
,        subjaltname_upn_allowed: "boolean_value"
,        org_unit: ["string_value1","string_value2"]
,        subjaltname_uri_allowed: "boolean_value"
,        key_value: "string_value"
,        is_key_generation_locked: "boolean_value"
,        tp_renewal_locked: "boolean_value"
,        is_org_locked: "boolean_value"
,        is_org_unit_locked: "boolean_value"
,        subjaltname_email_allowed: "boolean_value"
,        tp_renewal: "boolean_value"
,        is_keypair_algorithm_locked: "boolean_value"
,        city: "string_value"
,        is_state_locked: "boolean_value"
,        is_csr_generation_locked: "boolean_value"
,        country: "string_value"
,        subjaltname_dns_allowed: "boolean_value"
,        is_management_type_locked: "boolean_value"
,        ca: "string_value"
,        csr_generation: "string_value"
,        is_country_locked: "boolean_value"
}
        file_location_path: "C:\\myfiles"
        subjaltname: "DNS:testapp.mycompany.com"
        keyfile: "newkeyfile"
        csr: "string_value"
        certificate_name: "VenafiTestCert"

  getns_ssl_csrResponse:
    type: object
    required:
      - ns_ssl_csr
    properties:
      ns_ssl_csr:
        $ref: '#/definitions/ns_ssl_csr'
    title: getns_ssl_csrResponse
    example:
      ns_ssl_csr:
        serial_number: "01"
        statename: "California"
        file_size: "1751"
        issuer: "Venafi lab"
        keyform: "PEM"
        is_dir: "false"
        keyalgorithm: "RSA"
        app_name: "sharepoint_app"
        certificate_dn: "\\VED\\Policy\\TLS\\Citrix\\testcert"
        keystrength: "2048"
        city: "Bangalore"
        file_name: "1.1.1.1_IDPCert"
        countryname: "US"
        policy: "\\VED\\Policy\\TLS\\Citrix"
        passphrase: "password"
        file_last_modified_epoch: "1568926276"
        is_deploy: "false"
        commonname: "default GPNZIS"
        tenant_name: "citrix123"
        activity_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        organizationname: "Company ANG"
        organizationunit: "BizDev"
        file_last_modified: "2019-09-19 20:51:16"
        certificate_policy_object: {        wildcards_allowed: "boolean_value"
,        state: "string_value"
,        management_type: "string_value"
,        is_ca_locked: "boolean_value"
,        is_city_locked: "boolean_value"
,        policy: "string_value"
,        keypair_algorithm: "string_value"
,        key_generation: "string_value"
,        subjaltname_ip_allowed: "boolean_value"
,        org: "string_value"
,        name: "string_value"
,        is_key_value_locked: "boolean_value"
,        subjaltname_upn_allowed: "boolean_value"
,        org_unit: ["string_value1","string_value2"]
,        subjaltname_uri_allowed: "boolean_value"
,        key_value: "string_value"
,        is_key_generation_locked: "boolean_value"
,        tp_renewal_locked: "boolean_value"
,        is_org_locked: "boolean_value"
,        is_org_unit_locked: "boolean_value"
,        subjaltname_email_allowed: "boolean_value"
,        tp_renewal: "boolean_value"
,        is_keypair_algorithm_locked: "boolean_value"
,        city: "string_value"
,        is_state_locked: "boolean_value"
,        is_csr_generation_locked: "boolean_value"
,        country: "string_value"
,        subjaltname_dns_allowed: "boolean_value"
,        is_management_type_locked: "boolean_value"
,        ca: "string_value"
,        csr_generation: "string_value"
,        is_country_locked: "boolean_value"
}
        file_location_path: "C:\\myfiles"
        subjaltname: "DNS:testapp.mycompany.com"
        keyfile: "newkeyfile"
        csr: "string_value"
        certificate_name: "VenafiTestCert"

  getns_ssl_csrsResponse:
    type: object
    required:
      - ns_ssl_csr
    properties:
      ns_ssl_csr:
        type: array
        items:
          $ref: '#/definitions/ns_ssl_csr'
    title: getns_ssl_csrsResponse
    example:
      ns_ssl_csr:
        serial_number: "01"
        statename: "California"
        file_size: "1751"
        issuer: "Venafi lab"
        keyform: "PEM"
        is_dir: "false"
        keyalgorithm: "RSA"
        app_name: "sharepoint_app"
        certificate_dn: "\\VED\\Policy\\TLS\\Citrix\\testcert"
        keystrength: "2048"
        city: "Bangalore"
        file_name: "1.1.1.1_IDPCert"
        countryname: "US"
        policy: "\\VED\\Policy\\TLS\\Citrix"
        passphrase: "password"
        file_last_modified_epoch: "1568926276"
        is_deploy: "false"
        commonname: "default GPNZIS"
        tenant_name: "citrix123"
        activity_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        organizationname: "Company ANG"
        organizationunit: "BizDev"
        file_last_modified: "2019-09-19 20:51:16"
        certificate_policy_object: {        wildcards_allowed: "boolean_value"
,        state: "string_value"
,        management_type: "string_value"
,        is_ca_locked: "boolean_value"
,        is_city_locked: "boolean_value"
,        policy: "string_value"
,        keypair_algorithm: "string_value"
,        key_generation: "string_value"
,        subjaltname_ip_allowed: "boolean_value"
,        org: "string_value"
,        name: "string_value"
,        is_key_value_locked: "boolean_value"
,        subjaltname_upn_allowed: "boolean_value"
,        org_unit: ["string_value1","string_value2"]
,        subjaltname_uri_allowed: "boolean_value"
,        key_value: "string_value"
,        is_key_generation_locked: "boolean_value"
,        tp_renewal_locked: "boolean_value"
,        is_org_locked: "boolean_value"
,        is_org_unit_locked: "boolean_value"
,        subjaltname_email_allowed: "boolean_value"
,        tp_renewal: "boolean_value"
,        is_keypair_algorithm_locked: "boolean_value"
,        city: "string_value"
,        is_state_locked: "boolean_value"
,        is_csr_generation_locked: "boolean_value"
,        country: "string_value"
,        subjaltname_dns_allowed: "boolean_value"
,        is_management_type_locked: "boolean_value"
,        ca: "string_value"
,        csr_generation: "string_value"
,        is_country_locked: "boolean_value"
}
        file_location_path: "C:\\myfiles"
        subjaltname: "DNS:testapp.mycompany.com"
        keyfile: "newkeyfile"
        csr: "string_value"
        certificate_name: "VenafiTestCert"

  ns_ssl_csr_readwrite:
    type: object
    properties:
      statename:
        description: "State Name"
        type: string
        format: string
        minLength: 2
        maxLength: 128
      issuer:
        description: "Third party Certificate Authority provider"
        type: string
        format: string
      keyform:
        description: "Key Form"
        type: string
        format: string
      keyalgorithm:
        description: "Key Algorithm.Possible values: RSA, ECC"
        type: string
        format: string
      app_name:
        description: "Application name.Used for tracking task logs created for a specific application"
        type: string
        format: string
      certificate_dn:
        description: "Applicable only if the issuer is Venafi. Certificate path is populated in this field."
        type: string
        format: string
      keystrength:
        description: "Key bits in size, if algorithm is RSA.EllipticCurve, if algorithm is ECC"
        type: string
        format: string
      city:
        description: "City"
        type: string
        format: string
      countryname:
        description: "Country Name"
        type: string
        format: string
        minLength: 2
        maxLength: 128
      policy:
        description: "Applicable only if the issuer is Venafi.Policy folder path which determines the certificate attributes."
        type: string
        format: string
      passphrase:
        description: "Pass Phrase used to encrypt the private-key"
        type: string
        format: password
      is_deploy:
        description: "Whether Auto deployment of certificates managed by third party CA should be done by NetScaler Console."
        type: boolean
        format: boolean
      commonname:
        description: "Common Name"
        type: string
        format: string
        minLength: 1
      organizationname:
        description: "Organization Name"
        type: string
        format: string
        minLength: 1
      organizationunit:
        description: "Organization Unit"
        type: string
        format: string
      file_location_path:
        description: "File Location on Client for download"
        type: string
        format: string
        minLength: 1
      subjaltname:
        description: "Subject alternative name"
        type: string
        format: string
      keyfile:
        description: "Key File"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      certificate_name:
        description: "Name of the certificate"
        type: string
        format: string

  ns_ssl_csr:
    allOf:
      -
        properties:
          file_name:
            description: Name for and, optionally, path to the certificate signing request (CSR)
            type: string
            format: string
          serial_number:
             description: "Serial Number"
             type: string
             format: string
          file_size:
             description: "file_size"
             type: integer
             format: int32
          file_last_modified_epoch:
             description: "Last Modified (Epoch)"
             type: number
             format: int64
          tenant_name:
             description: "Tenant Name"
             type: string
             format: string
          activity_id:
             description: "Activity Id used to track the progress of create certificate"
             type: string
             format: uuid
          file_last_modified:
             description: "Last Modified"
             type: string
             format: string
             minLength: 1
             maxLength: 128
          csr:
             description: "Generated CSR"
             type: string
             format: string
      - $ref: '#/definitions/ns_ssl_csr_readwrite'

  Done:
    properties:
      errorcode:
        type: number
        format: int32
        example: 0
      errormessage:
        type: string
        format: string
        example: "Done"
  Error:
    properties:
      errorcode:
        type: number
        format: int32
        example: 1001
      errormessage:
        type: string
        format: string
        example: "id cannot be found"
