swagger: '2.0'
info:
  description: Configuration for NetScaler SSL key File resource.
  version: 'v2'
  title: ns_ssl_key
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_ssl_key
    description: NetScaler SSL key File
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: file_name
   in: path
   type: string
   description: Key File Name
   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_key:
    get:
      tags:
        - ns_ssl_key
      summary: GET all ns_ssl_key
      operationId: getall_ns_ssl_key
      description: Use this operation to get ns ssl key 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_key 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_key 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_key resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_ssl_key
          schema: 
              $ref: '#/definitions/getns_ssl_keysResponse'
        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_key/{file_name}:
    get:
      tags:
        - ns_ssl_key
      summary: GET by key for ns_ssl_key
      operationId: getbykey_ns_ssl_key
      description: Use this operation to get ns ssl key 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:  for ns_ssl_key
          schema: 
              $ref: '#/definitions/getns_ssl_keyResponse'
        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_key
      summary: POST operation with actions for ns_ssl_key
      operationId: post_ns_ssl_key_actions
      description: POST operation with actions for ns_ssl_key
      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]
          description: >
            actions:
              * `create` - Use this operation to create ns ssl key file

        - in: body
          name: ns_ssl_key
          description: ns_ssl_key object
          schema:
              $ref: '#/definitions/addns_ssl_keyRequest'
      responses:
        200:
          description: create for ns_ssl_key
          schema: 
              $ref: '#/definitions/addns_ssl_keyResponse'
        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_key
      summary: Delete for ns_ssl_key
      operationId: deletebykey_ns_ssl_key
      description: Use this operation to delete ns ssl key 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: create for ns_ssl_key
        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_key:
    post:
      tags:
        - ns_ssl_key
      summary: Upload operation for ns_ssl_key
      operationId: upload_ns_ssl_key
      description: Use this operation to upload ns ssl key 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_key
          description: ns_ssl_key file
          type: file
          required: true
      responses:
        200:
          description: Successful upload for ns_ssl_key
          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_key/{file_name}:
    get:
      tags:
        - ns_ssl_key
      summary: Download operation for ns_ssl_key
      operationId: download_ns_ssl_key
      description: Use this operation to download ns ssl key 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: Key File Name
      responses:
        200:
          description: Successful download for ns_ssl_key
          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_keyRequest:
    type: object
    required:
      - ns_ssl_key
    properties:
      ns_ssl_key:
        $ref: '#/definitions/ns_ssl_key_readwrite'
    title: addns_ssl_keyRequest
    example:
      ns_ssl_key:
        keysize: "512"
        keyform: "PEM"
        des_type: "DES"
        file_location_path: "C:\\myfiles"
        password: "password"
        algo: "DSA"
        exponent: "string_value"
        ec_curve: "P256"

  addns_ssl_keyResponse:
    type: object
    required:
      - ns_ssl_key
    properties:
      ns_ssl_key:
        $ref: '#/definitions/ns_ssl_key'
    title: addns_ssl_keyResponse
    example:
      ns_ssl_key:
        tenant_name: "citrix123"
        keysize: "512"
        file_size: "1751"
        file_last_modified: "2019-09-19 20:51:16"
        keyform: "PEM"
        is_dir: "false"
        des_type: "DES"
        file_location_path: "C:\\myfiles"
        password: "password"
        algo: "DSA"
        file_name: "IDPCert.key"
        exponent: "string_value"
        ec_curve: "P256"
        file_last_modified_epoch: "1568926276"

  getns_ssl_keyResponse:
    type: object
    required:
      - ns_ssl_key
    properties:
      ns_ssl_key:
        $ref: '#/definitions/ns_ssl_key'
    title: getns_ssl_keyResponse
    example:
      ns_ssl_key:
        tenant_name: "citrix123"
        keysize: "512"
        file_size: "1751"
        file_last_modified: "2019-09-19 20:51:16"
        keyform: "PEM"
        is_dir: "false"
        des_type: "DES"
        file_location_path: "C:\\myfiles"
        password: "password"
        algo: "DSA"
        file_name: "IDPCert.key"
        exponent: "string_value"
        ec_curve: "P256"
        file_last_modified_epoch: "1568926276"

  getns_ssl_keysResponse:
    type: object
    required:
      - ns_ssl_key
    properties:
      ns_ssl_key:
        type: array
        items:
          $ref: '#/definitions/ns_ssl_key'
    title: getns_ssl_keysResponse
    example:
      ns_ssl_key:
        tenant_name: "citrix123"
        keysize: "512"
        file_size: "1751"
        file_last_modified: "2019-09-19 20:51:16"
        keyform: "PEM"
        is_dir: "false"
        des_type: "DES"
        file_location_path: "C:\\myfiles"
        password: "password"
        algo: "DSA"
        file_name: "IDPCert.key"
        exponent: "string_value"
        ec_curve: "P256"
        file_last_modified_epoch: "1568926276"

  ns_ssl_key_readwrite:
    type: object
    properties:
      keysize:
        description: "Key Size in bits"
        type: integer
        format: int32
      keyform:
        description: "Key Form"
        type: string
        format: string
      des_type:
        description: "DES Encryption type possible values des|des3."
        type: string
        format: string
      file_location_path:
        description: "File Location on Client for upload/download"
        type: string
        format: string
        minLength: 1
      password:
        description: "Password"
        type: string
        format: password
      algo:
        description: "Encryption Algorithm supported RSA and DSA."
        type: string
        format: string
      exponent:
        description: "Exponent"
        type: string
        format: string
      ec_curve:
        description: "Elliptic curve"
        type: string
        format: string

  ns_ssl_key:
    allOf:
      -
        properties:
          file_name:
            description: Key File Name
            type: string
            format: string
          tenant_name:
             description: "Tenant Name"
             type: string
             format: string
          file_size:
             description: "file_size"
             type: integer
             format: int32
          file_last_modified:
             description: "Last Modified"
             type: string
             format: string
             minLength: 1
             maxLength: 128
          file_last_modified_epoch:
             description: "Last Modified (Epoch)"
             type: number
             format: int64
      - $ref: '#/definitions/ns_ssl_key_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"
