swagger: '2.0'
info:
  description: Configuration for Configuration diff resource for NetScaler resource.
  version: 'v2'
  title: ns_conf
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_conf
    description: Configuration diff resource for NetScaler
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 ns.conf 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_conf:
    get:
      tags:
        - ns_conf
      summary: GET all ns_conf
      operationId: getall_ns_conf
      description: Get ns.conf information from NetScaler Instance
      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_conf 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_conf 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_conf resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_conf
          schema: 
              $ref: '#/definitions/getns_confsResponse'
        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_conf/{id}:
    get:
      tags:
        - ns_conf
      summary: GET by key for ns_conf
      operationId: getbykey_ns_conf
      description: Get ns.conf information from NetScaler Instance
      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_conf
          schema: 
              $ref: '#/definitions/getns_confResponse'
        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_conf
      summary: POST operation with actions for ns_conf
      operationId: post_ns_conf_actions
      description: POST operation with actions for ns_conf
      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: [inventory]
          description: >
            actions:
              * `inventory` - Use this operation to poll now

        - in: body
          name: ns_conf
          description: ns_conf object
          schema:
              $ref: '#/definitions/addns_confRequest'
      responses:
        200:
          description: inventory for ns_conf
          schema: 
              $ref: '#/definitions/addns_confResponse'
        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_confRequest:
    type: object
    required:
      - ns_conf
    properties:
      ns_conf:
        $ref: '#/definitions/ns_conf_readwrite'
    title: addns_confRequest
    example:
      ns_conf:
        ns_ip_address: "1.1.1.1"

  addns_confResponse:
    type: object
    required:
      - ns_conf
    properties:
      ns_conf:
        $ref: '#/definitions/ns_conf'
    title: addns_confResponse
    example:
      ns_conf:
        diff_reportname: "DIFF_1.1.1.1_181057b1-67f0-4ff1-84d5-80b01567c5ee.xml"
        hostname: "BLRADC12-lab3"
        diff_status: "No Diff"
        display_name: "1.1.1.1-1.1.1.2"
        ns_ip_address: "1.1.1.1"
        last_updated_time: "1580364711"
        templatediff_reportname: "gslbtemplate_1.1.1.1_1580378051.xml"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        templatediff_status: "Diff Exists"
        last_updated_times: ["string_value1","string_value2"]

  getns_confResponse:
    type: object
    required:
      - ns_conf
    properties:
      ns_conf:
        $ref: '#/definitions/ns_conf'
    title: getns_confResponse
    example:
      ns_conf:
        diff_reportname: "DIFF_1.1.1.1_181057b1-67f0-4ff1-84d5-80b01567c5ee.xml"
        hostname: "BLRADC12-lab3"
        diff_status: "No Diff"
        display_name: "1.1.1.1-1.1.1.2"
        ns_ip_address: "1.1.1.1"
        last_updated_time: "1580364711"
        templatediff_reportname: "gslbtemplate_1.1.1.1_1580378051.xml"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        templatediff_status: "Diff Exists"
        last_updated_times: ["string_value1","string_value2"]

  getns_confsResponse:
    type: object
    required:
      - ns_conf
    properties:
      ns_conf:
        type: array
        items:
          $ref: '#/definitions/ns_conf'
    title: getns_confsResponse
    example:
      ns_conf:
        diff_reportname: "DIFF_1.1.1.1_181057b1-67f0-4ff1-84d5-80b01567c5ee.xml"
        hostname: "BLRADC12-lab3"
        diff_status: "No Diff"
        display_name: "1.1.1.1-1.1.1.2"
        ns_ip_address: "1.1.1.1"
        last_updated_time: "1580364711"
        templatediff_reportname: "gslbtemplate_1.1.1.1_1580378051.xml"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        templatediff_status: "Diff Exists"
        last_updated_times: ["string_value1","string_value2"]

  ns_conf_readwrite:
    type: object
    properties:
      ns_ip_address:
        description: "List of NetScaler IP Address"
        type: string
        format: ipaddress
        minLength: 1
        maxLength: 64

  ns_conf:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all ns.conf files
            type: string
            format: uuid
          diff_reportname:
             description: "Name of the SavedVsRunning diff reportname"
             type: string
             format: string
             minLength: 1
             maxLength: 128
          hostname:
             description: "Host Name of the device"
             type: string
             format: string
             minLength: 1
             maxLength: 128
          diff_status:
             description: "Tells whether a diff exists between running and saved configuration on NS"
             type: string
             format: string
          display_name:
             description: "Display Name of the device"
             type: string
             format: string
             minLength: 1
             maxLength: 128
          last_updated_time:
             description: "Last Updated Time"
             type: integer
             format: int32
          templatediff_reportname:
             description: "Name of the Template diff reports"
             type: string
             format: string
          templatediff_status:
             description: "Tells whether a diff exists between templates associated to NetScaler and the running configuration"
             type: string
             format: string
      - $ref: '#/definitions/ns_conf_readwrite'

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