swagger: '2.0'
info:
  description: Configuration for Applications Managed by Management System resource.
  version: 'v2'
  title: ns_application
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_application
    description: Applications Managed by Management System
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.
   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_application:
    get:
      tags:
        - ns_application
      summary: GET all ns_application
      operationId: getall_ns_application
      description: Use this operation to get application
      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_application 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_application 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_application resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_application
          schema: 
              $ref: '#/definitions/getns_applicationsResponse'
        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_application
      summary: POST operation for ns_application
      operationId: post_ns_application
      description: POST operation for ns_application
      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_application
          description: ns_application object
          schema:
              $ref: '#/definitions/addns_applicationRequest'
      responses:
        200:
          description: add for ns_application
          schema: 
              $ref: '#/definitions/addns_applicationResponse'
        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_application/{id}:
    get:
      tags:
        - ns_application
      summary: GET by key for ns_application
      operationId: getbykey_ns_application
      description: Use this operation to get application
      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_application
          schema: 
              $ref: '#/definitions/getns_applicationResponse'
        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'

    put:
      tags:
        - ns_application
      summary: PUT for ns_application
      operationId: putbykey_ns_application
      description: Use this operation to modify application
      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: body
          name: ns_application
          description: ns_application object
          schema:
              $ref: '#/definitions/modifyns_applicationRequest'
      responses:
        200:
          description: add for ns_application
          schema: 
              $ref: '#/definitions/modifyns_applicationResponse'
        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_application
      summary: Delete for ns_application
      operationId: deletebykey_ns_application
      description: Use this operation to delete application
      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: add for ns_application
        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_applicationRequest:
    type: object
    required:
      - ns_application
    properties:
      ns_application:
        $ref: '#/definitions/ns_application_readwrite'
    title: addns_applicationRequest
    example:
      ns_application:
        curclntconnections: "1.0"
        ns_ip_address: "1.1.1.1"
        vsvr_name_criteria: "Criteria"
        name: "test_app"
        vsvr_ip_address_criteria: "Criteria"
        svc_port_criteria: "Criteria"
        svr_name_criteria: "Criteria"
        svr_ip_address_criteria: "Criteria"
        vsvc_port_criteria: "Criteria"
        cursrvrconnections: "1.0"
        configpack_id: "NetScaler_123"
        application_managed: "True"
        family: "LB_FAMILY"
        app_type: "0"
        app_category: "Others"
        throughput_avg: "1.0"
        is_migration: "True"
        app_info_required: "True"
        no_of_auth: "1"
        no_of_gslb: "1"
        no_of_cr: "1"
        no_of_gslbsvc: "1"
        no_of_cs: "1"
        no_of_svc: "1"
        no_of_svcgrp: "1"
        vsvr_app_components: "{app_component_object}"
        app_name_references_array: "ARRAY(0x2c3f0f4)"
        force_delete: "True"
        stylebook_params: "NetScaler_123"
        no_of_svr: "1"
        no_of_vpn: "1"
        no_of_lb: "1"
        application_ids: "NetScaler_123"

  addns_applicationResponse:
    type: object
    required:
      - ns_application
    properties:
      ns_application:
        $ref: '#/definitions/ns_application'
    title: addns_applicationResponse
    example:
      ns_application:
        curclntconnections: "1.0"
        ns_ip_address: "1.1.1.1"
        vsvr_name_criteria: "Criteria"
        name: "test_app"
        application_class: "Others"
        vsvr_ip_address_criteria: "Criteria"
        app_name_references: "ARRAY(0x2ca4af4)"
        svc_port_criteria: "Criteria"
        svr_name_criteria: "Criteria"
        id: "00000000-0000-375c-0000-000400000004"
        svr_ip_address_criteria: "Criteria"
        tenant_name: "AppSecDelta"
        vsvc_port_criteria: "Criteria"
        cursrvrconnections: "1.0"
        configpack_id: "NetScaler_123"
        application_managed: "True"
        family: "LB_FAMILY"
        tenant_id: "zom5yia0qrwg"
        app_type: "0"
        app_category: "Others"
        throughput_avg: "1.0"
        user_name: "NetScaler123"
        customer_name: "admTenant"
        parent_filters: "ARRAY(0x2cac674)"
        is_migration: "True"
        app_info_required: "True"
        no_of_auth: "1"
        no_of_gslb: "1"
        no_of_cr: "1"
        no_of_gslbsvc: "1"
        act_id: "{stylebook_params}"
        no_of_cs: "1"
        no_of_svc: "1"
        no_of_svcgrp: "1"
        vsvr_app_components: "{app_component_object}"
        app_name_references_array: "ARRAY(0x2c3f0f4)"
        force_delete: "True"
        stylebook_params: "NetScaler_123"
        no_of_svr: "1"
        no_of_vpn: "1"
        no_of_lb: "1"
        application_ids: "NetScaler_123"

  getns_applicationResponse:
    type: object
    required:
      - ns_application
    properties:
      ns_application:
        $ref: '#/definitions/ns_application'
    title: getns_applicationResponse
    example:
      ns_application:
        curclntconnections: "1.0"
        ns_ip_address: "1.1.1.1"
        vsvr_name_criteria: "Criteria"
        name: "test_app"
        application_class: "Others"
        vsvr_ip_address_criteria: "Criteria"
        app_name_references: "ARRAY(0x2ca4af4)"
        svc_port_criteria: "Criteria"
        svr_name_criteria: "Criteria"
        id: "00000000-0000-375c-0000-000400000004"
        svr_ip_address_criteria: "Criteria"
        tenant_name: "AppSecDelta"
        vsvc_port_criteria: "Criteria"
        cursrvrconnections: "1.0"
        configpack_id: "NetScaler_123"
        application_managed: "True"
        family: "LB_FAMILY"
        tenant_id: "zom5yia0qrwg"
        app_type: "0"
        app_category: "Others"
        throughput_avg: "1.0"
        user_name: "NetScaler123"
        customer_name: "admTenant"
        parent_filters: "ARRAY(0x2cac674)"
        is_migration: "True"
        app_info_required: "True"
        no_of_auth: "1"
        no_of_gslb: "1"
        no_of_cr: "1"
        no_of_gslbsvc: "1"
        act_id: "{stylebook_params}"
        no_of_cs: "1"
        no_of_svc: "1"
        no_of_svcgrp: "1"
        vsvr_app_components: "{app_component_object}"
        app_name_references_array: "ARRAY(0x2c3f0f4)"
        force_delete: "True"
        stylebook_params: "NetScaler_123"
        no_of_svr: "1"
        no_of_vpn: "1"
        no_of_lb: "1"
        application_ids: "NetScaler_123"

  getns_applicationsResponse:
    type: object
    required:
      - ns_application
    properties:
      ns_application:
        type: array
        items:
          $ref: '#/definitions/ns_application'
    title: getns_applicationsResponse
    example:
      ns_application:
        curclntconnections: "1.0"
        ns_ip_address: "1.1.1.1"
        vsvr_name_criteria: "Criteria"
        name: "test_app"
        application_class: "Others"
        vsvr_ip_address_criteria: "Criteria"
        app_name_references: "ARRAY(0x2ca4af4)"
        svc_port_criteria: "Criteria"
        svr_name_criteria: "Criteria"
        id: "00000000-0000-375c-0000-000400000004"
        svr_ip_address_criteria: "Criteria"
        tenant_name: "AppSecDelta"
        vsvc_port_criteria: "Criteria"
        cursrvrconnections: "1.0"
        configpack_id: "NetScaler_123"
        application_managed: "True"
        family: "LB_FAMILY"
        tenant_id: "zom5yia0qrwg"
        app_type: "0"
        app_category: "Others"
        throughput_avg: "1.0"
        user_name: "NetScaler123"
        customer_name: "admTenant"
        parent_filters: "ARRAY(0x2cac674)"
        is_migration: "True"
        app_info_required: "True"
        no_of_auth: "1"
        no_of_gslb: "1"
        no_of_cr: "1"
        no_of_gslbsvc: "1"
        act_id: "{stylebook_params}"
        no_of_cs: "1"
        no_of_svc: "1"
        no_of_svcgrp: "1"
        vsvr_app_components: "{app_component_object}"
        app_name_references_array: "ARRAY(0x2c3f0f4)"
        force_delete: "True"
        stylebook_params: "NetScaler_123"
        no_of_svr: "1"
        no_of_vpn: "1"
        no_of_lb: "1"
        application_ids: "NetScaler_123"

  modifyns_applicationRequest:
    type: object
    required:
      - ns_application
    properties:
      ns_application:
        $ref: '#/definitions/ns_application_readwrite'
    title: modifyns_applicationRequest
    example:
      ns_application:
        curclntconnections: "1.0"
        ns_ip_address: "1.1.1.1"
        vsvr_name_criteria: "Criteria"
        name: "test_app"
        vsvr_ip_address_criteria: "Criteria"
        svc_port_criteria: "Criteria"
        svr_name_criteria: "Criteria"
        svr_ip_address_criteria: "Criteria"
        vsvc_port_criteria: "Criteria"
        cursrvrconnections: "1.0"
        configpack_id: "NetScaler_123"
        application_managed: "True"
        family: "LB_FAMILY"
        app_type: "0"
        app_category: "Others"
        throughput_avg: "1.0"
        is_migration: "True"
        app_info_required: "True"
        no_of_auth: "1"
        no_of_gslb: "1"
        no_of_cr: "1"
        no_of_gslbsvc: "1"
        no_of_cs: "1"
        no_of_svc: "1"
        no_of_svcgrp: "1"
        vsvr_app_components: "{app_component_object}"
        app_name_references_array: "ARRAY(0x2c3f0f4)"
        force_delete: "True"
        stylebook_params: "NetScaler_123"
        no_of_svr: "1"
        no_of_vpn: "1"
        no_of_lb: "1"
        application_ids: "NetScaler_123"

  modifyns_applicationResponse:
    type: object
    required:
      - ns_application
    properties:
      ns_application:
        $ref: '#/definitions/ns_application'
    title: modifyns_applicationResponse
    example:
      ns_application:
        curclntconnections: "1.0"
        ns_ip_address: "1.1.1.1"
        vsvr_name_criteria: "Criteria"
        name: "test_app"
        application_class: "Others"
        vsvr_ip_address_criteria: "Criteria"
        app_name_references: "ARRAY(0x2ca4af4)"
        svc_port_criteria: "Criteria"
        svr_name_criteria: "Criteria"
        id: "00000000-0000-375c-0000-000400000004"
        svr_ip_address_criteria: "Criteria"
        tenant_name: "AppSecDelta"
        vsvc_port_criteria: "Criteria"
        cursrvrconnections: "1.0"
        configpack_id: "NetScaler_123"
        application_managed: "True"
        family: "LB_FAMILY"
        tenant_id: "zom5yia0qrwg"
        app_type: "0"
        app_category: "Others"
        throughput_avg: "1.0"
        user_name: "NetScaler123"
        customer_name: "admTenant"
        parent_filters: "ARRAY(0x2cac674)"
        is_migration: "True"
        app_info_required: "True"
        no_of_auth: "1"
        no_of_gslb: "1"
        no_of_cr: "1"
        no_of_gslbsvc: "1"
        act_id: "{stylebook_params}"
        no_of_cs: "1"
        no_of_svc: "1"
        no_of_svcgrp: "1"
        vsvr_app_components: "{app_component_object}"
        app_name_references_array: "ARRAY(0x2c3f0f4)"
        force_delete: "True"
        stylebook_params: "NetScaler_123"
        no_of_svr: "1"
        no_of_vpn: "1"
        no_of_lb: "1"
        application_ids: "NetScaler_123"

  ns_application_readwrite:
    type: object
    properties:
      curclntconnections:
        description: "curclntconnections Value across all vips of the app"
        type: number
        format: double
      ns_ip_address:
        description: "ns_ip_address"
        type: string
        format: ipaddress
      vsvr_name_criteria:
        description: "vsvr_name_criteria"
        type: string
        format: string
        maxLength: 4096
      name:
        description: "Application Name"
        type: string
        format: string
        minLength: 1
        maxLength: 1024
      vsvr_ip_address_criteria:
        description: "vsvr_ip_address_criteria"
        type: string
        format: string
        maxLength: 4096
      svc_port_criteria:
        description: "svc_port_criteria"
        type: string
        format: string
        maxLength: 4096
      svr_name_criteria:
        description: "svr_name_criteria"
        type: string
        format: string
        maxLength: 4096
      svr_ip_address_criteria:
        description: "svr_ip_address_criteria"
        type: string
        format: string
        maxLength: 4096
      vsvc_port_criteria:
        description: "vsvc_port_criteria"
        type: string
        format: string
        maxLength: 4096
      cursrvrconnections:
        description: "cursrvrconnections Value across all vips of the app"
        type: number
        format: double
      configpack_id:
        description: "Config pack Id."
        type: string
        format: string
      application_managed:
        description: "Managed field"
        type: boolean
        format: boolean
      family:
        description: "Application Family"
        type: string
        format: string
        minLength: 1
        maxLength: 255
      app_type:
        description: "Application Type - 0: HMCUserDefined, 1: HMCAutoGenerated, 2: CNN App"
        type: integer
        format: int32
      app_category:
        description: "Application Category"
        type: string
        format: string
        minLength: 1
        maxLength: 255
      throughput_avg:
        description: "Sum of throughput across all vips of the app"
        type: number
        format: double
      is_migration:
        description: "is_migration"
        type: boolean
        format: boolean
      app_info_required:
        description: "app_info_required"
        type: boolean
        format: boolean
      no_of_auth:
        description: "Number of AUTH VIPs"
        type: string
        format: string
      no_of_gslb:
        description: "Number of GSLB VIPs"
        type: string
        format: string
      no_of_cr:
        description: "Number of CR VIPs"
        type: string
        format: string
      no_of_gslbsvc:
        description: "Number of LB VIPs"
        type: string
        format: string
      no_of_cs:
        description: "Number of CS VIPs"
        type: string
        format: string
      no_of_svc:
        description: "Number of Services"
        type: string
        format: string
      no_of_svcgrp:
        description: "Number of Service Groups"
        type: string
        format: string
      vsvr_app_components:
        type: array
        items:
          $ref: '#/definitions/app_component_readwrite'
      app_name_references_array:
        description: "All application names separated by comma that are referenced by this custom application"
        type: array
        items:
          type: string
          format: string
      force_delete:
        description: "force delete"
        type: boolean
        format: boolean
      stylebook_params:
        description: "Stylebook Parameter"
        type: string
        format: string
      no_of_svr:
        description: "Number of Servers"
        type: string
        format: string
      no_of_vpn:
        description: "Number of VPN VIPs"
        type: string
        format: string
      no_of_lb:
        description: "Number of LB VIPs"
        type: string
        format: string
      application_ids:
        description: "Application IDs that are part of this application"
        type: array
        items:
          type: string
          format: string

  ns_application:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key.
            type: string
            format: uuid
          application_class:
             description: "Application class"
             type: string
             format: string
             maxLength: 255
          tenant_name:
             description: "Tenant Name"
             type: string
             format: string
             maxLength: 255
          tenant_id:
             description: "Tenant Id"
             type: string
             format: string
             maxLength: 255
          user_name:
             description: "User Name"
             type: string
             format: string
             maxLength: 255
          act_id:
             description: "Activity Id"
             type: string
             format: string
      - $ref: '#/definitions/ns_application_readwrite'

  app_component_readwrite:
    type: object
    properties:
      export_option:
        description: "Export Options - webinsight, securityinsight."
        type: string
        format: string
      name:
        description: "name"
        type: string
        format: string
        minLength: 1
        maxLength: 1024
      hostname:
        description: "Hostname of NetScaler on which vserver created."
        type: string
        format: string
      state:
        description: "state"
        type: string
        format: string
      ns_ip_address:
        description: "Device IP Address"
        type: string
        format: string
        minLength: 1
        maxLength: 64
      vsvr_type:
        description: "Vserver type Eg. HTTP"
        type: string
        format: string
        minLength: 1
        maxLength: 1024
      vsvr_ip_address:
        description: "Vserver IP Address"
        type: string
        format: IP Address
        minLength: 1
        maxLength: 64
      id:
        description: "ID"
        type: string
        format: string
      type:
        description: "Application type ( CS/LB/GSLB etc.)"
        type: string
        format: string
        minLength: 1
        maxLength: 1024

  app_component:
    allOf:
      -
        properties:
          display_name:
             description: "Display Name"
             type: string
             format: string
          configuration_path:
             description: "Config Path of HA Proxies on this HAPRoxy Host."
             type: string
             format: string
      - $ref: '#/definitions/app_component_readwrite'

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