swagger: '2.0'
info:
  description: Configuration for NetScaler SSL Files resource.
  version: 'v2'
  title: ns_ssl_files
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_ssl_files
    description: NetScaler SSL Files
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: id
   in: path
   type: string
   description: Id is system generated key for all the ns ssl files
   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_files:
    get:
      tags:
        - ns_ssl_files
      summary: GET all ns_ssl_files
      operationId: getall_ns_ssl_files
      description: Use this operation to get ns ssl files
      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_files 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_files 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_files resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_ssl_files
          schema: 
              $ref: '#/definitions/getns_ssl_filessResponse'
        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_files/{id}:
    get:
      tags:
        - ns_ssl_files
      summary: GET by key for ns_ssl_files
      operationId: getbykey_ns_ssl_files
      description: Use this operation to get ns ssl files
      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_files
          schema: 
              $ref: '#/definitions/getns_ssl_filesResponse'
        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_files
      summary: POST operation with actions for ns_ssl_files
      operationId: post_ns_ssl_files_actions
      description: POST operation with actions for ns_ssl_files
      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: [do_poll]
          description: >
            actions:
              * `do_poll` - Use this operation to poll all SSL certificates from all NetScaler and update the database

        - in: body
          name: ns_ssl_files
          description: ns_ssl_files object
          schema:
              $ref: '#/definitions/addns_ssl_filesRequest'
      responses:
        200:
          description: do_poll for ns_ssl_files
          schema: 
              $ref: '#/definitions/addns_ssl_filesResponse'
        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_files
      summary: Delete for ns_ssl_files
      operationId: deletebykey_ns_ssl_files
      description: Use this operation to delete ns ssl files
      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: do_poll for ns_ssl_files
        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_files/{id}:
    get:
      tags:
        - ns_ssl_files
      summary: Download operation for ns_ssl_files
      operationId: download_ns_ssl_files
      description: Use this operation to download ns ssl files
      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: id
          type: string
          required: true
          description: Id is system generated key for all the ns ssl files
      responses:
        200:
          description: Successful download for ns_ssl_files
          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_filesRequest:
    type: object
    required:
      - ns_ssl_files
    properties:
      ns_ssl_files:
        $ref: '#/definitions/ns_ssl_files_readwrite'
    title: addns_ssl_filesRequest
    example:
      ns_ssl_files:
        file_location_path: "C:\\myfiles"
        file_name: "ns.conf.0"
        display_name: "1.1.1.1-1.1.1.2"
        ns_ip_address: "1.1.1.1"
        act_id: "00000000-0000-375c-0000-300411114"

  addns_ssl_filesResponse:
    type: object
    required:
      - ns_ssl_files
    properties:
      ns_ssl_files:
        $ref: '#/definitions/ns_ssl_files'
    title: addns_ssl_filesResponse
    example:
      ns_ssl_files:
        file_location_path: "C:\\myfiles"
        file_size: "1751"
        file_name: "ns.conf.0"
        file_last_modified: "2019-09-19 20:51:16"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        display_name: "1.1.1.1-1.1.1.2"
        ns_ip_address: "1.1.1.1"
        act_id: "00000000-0000-375c-0000-300411114"

  getns_ssl_filesResponse:
    type: object
    required:
      - ns_ssl_files
    properties:
      ns_ssl_files:
        $ref: '#/definitions/ns_ssl_files'
    title: getns_ssl_filesResponse
    example:
      ns_ssl_files:
        file_location_path: "C:\\myfiles"
        file_size: "1751"
        file_name: "ns.conf.0"
        file_last_modified: "2019-09-19 20:51:16"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        display_name: "1.1.1.1-1.1.1.2"
        ns_ip_address: "1.1.1.1"
        act_id: "00000000-0000-375c-0000-300411114"

  getns_ssl_filessResponse:
    type: object
    required:
      - ns_ssl_files
    properties:
      ns_ssl_files:
        type: array
        items:
          $ref: '#/definitions/ns_ssl_files'
    title: getns_ssl_filessResponse
    example:
      ns_ssl_files:
        file_location_path: "C:\\myfiles"
        file_size: "1751"
        file_name: "ns.conf.0"
        file_last_modified: "2019-09-19 20:51:16"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        display_name: "1.1.1.1-1.1.1.2"
        ns_ip_address: "1.1.1.1"
        act_id: "00000000-0000-375c-0000-300411114"

  ns_ssl_files_readwrite:
    type: object
    properties:
      file_location_path:
        description: "File Location of ssl file on ADC"
        type: string
        format: string
        minLength: 1
      file_name:
        description: "File Name"
        type: string
        format: string
        minLength: 1
        maxLength: 256
      display_name:
        description: "display name of device on which ssl file is present"
        type: string
        format: string
      ns_ip_address:
        description: "device ip on on which ssl file is present"
        type: string
        format: string
      act_id:
        description: "Activity ID that is used by GUI to track the polling status."
        type: string
        format: string

  ns_ssl_files:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the ns ssl files
            type: string
            format: string
          file_size:
             description: "file_size"
             type: string
             format: string
          file_last_modified:
             description: "Last Modified"
             type: string
             format: string
             minLength: 1
             maxLength: 128
      - $ref: '#/definitions/ns_ssl_files_readwrite'

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