swagger: '2.0'
info:
  description: Configuration for Cluster information resource.
  version: 'v2'
  title: ns_cluster
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_cluster
    description: Cluster information
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  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_cluster:
    get:
      tags:
        - ns_cluster
      summary: GET all ns_cluster
      operationId: getall_ns_cluster
      description: Use this operation to get ns cluster 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_cluster 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_cluster 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_cluster resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_cluster
          schema: 
              $ref: '#/definitions/getns_clustersResponse'
        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_clusterRequest:
    type: object
    required:
      - ns_cluster
    properties:
      ns_cluster:
        $ref: '#/definitions/ns_cluster_readwrite'
    title: addns_clusterRequest
    example:
      ns_cluster:
        add_nodegroup: "false"
        backplane: "10/2"
        clusterid: "2"
        nodeid: "2"
        state: "ACTIVE"
        hostRouteEnabled: "false"
        password: "password"
        process_local: "false"
        inc_mode: "false"
        snip: "1.1.1.1"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        clnodes: "string_value"
        preemption: "false"
        iscco: "true"
        clip: "1.1.1.1"
        node_group: "string_value"
        nodegroup_list: ["string_value1","string_value2"]
        ipaddress: "1.1.1.1"
        profile_name: "string_value"

  addns_clusterResponse:
    type: object
    required:
      - ns_cluster
    properties:
      ns_cluster:
        $ref: '#/definitions/ns_cluster'
    title: addns_clusterResponse
    example:
      ns_cluster:
        add_nodegroup: "false"
        mgmt_cpu_usage: "0"
        backplane: "10/2"
        clusterid: "2"
        nodeid: "2"
        state: "ACTIVE"
        hostRouteEnabled: "false"
        password: "password"
        process_local: "false"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        clviewleader: "1.1.1.1"
        inc_mode: "false"
        snip: "1.1.1.1"
        clnumnodes: "0"
        http_req: "0"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        sync_operation: "true"
        cpu_usage: "0"
        clnodes: "string_value"
        preemption: "false"
        iscco: "true"
        clip: "1.1.1.1"
        operationalstate: "string_value"
        tx: "0"
        clcurstatus: "string_value"
        rx: "0"
        memory_usage: "0"
        node_group: "string_value"
        health: "string_value"
        nodegroup_list: ["string_value1","string_value2"]
        ipaddress: "1.1.1.1"
        profile_name: "string_value"

  getns_clusterResponse:
    type: object
    required:
      - ns_cluster
    properties:
      ns_cluster:
        $ref: '#/definitions/ns_cluster'
    title: getns_clusterResponse
    example:
      ns_cluster:
        add_nodegroup: "false"
        mgmt_cpu_usage: "0"
        backplane: "10/2"
        clusterid: "2"
        nodeid: "2"
        state: "ACTIVE"
        hostRouteEnabled: "false"
        password: "password"
        process_local: "false"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        clviewleader: "1.1.1.1"
        inc_mode: "false"
        snip: "1.1.1.1"
        clnumnodes: "0"
        http_req: "0"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        sync_operation: "true"
        cpu_usage: "0"
        clnodes: "string_value"
        preemption: "false"
        iscco: "true"
        clip: "1.1.1.1"
        operationalstate: "string_value"
        tx: "0"
        clcurstatus: "string_value"
        rx: "0"
        memory_usage: "0"
        node_group: "string_value"
        health: "string_value"
        nodegroup_list: ["string_value1","string_value2"]
        ipaddress: "1.1.1.1"
        profile_name: "string_value"

  getns_clustersResponse:
    type: object
    required:
      - ns_cluster
    properties:
      ns_cluster:
        type: array
        items:
          $ref: '#/definitions/ns_cluster'
    title: getns_clustersResponse
    example:
      ns_cluster:
        add_nodegroup: "false"
        mgmt_cpu_usage: "0"
        backplane: "10/2"
        clusterid: "2"
        nodeid: "2"
        state: "ACTIVE"
        hostRouteEnabled: "false"
        password: "password"
        process_local: "false"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        clviewleader: "1.1.1.1"
        inc_mode: "false"
        snip: "1.1.1.1"
        clnumnodes: "0"
        http_req: "0"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        sync_operation: "true"
        cpu_usage: "0"
        clnodes: "string_value"
        preemption: "false"
        iscco: "true"
        clip: "1.1.1.1"
        operationalstate: "string_value"
        tx: "0"
        clcurstatus: "string_value"
        rx: "0"
        memory_usage: "0"
        node_group: "string_value"
        health: "string_value"
        nodegroup_list: ["string_value1","string_value2"]
        ipaddress: "1.1.1.1"
        profile_name: "string_value"

  ns_cluster_readwrite:
    type: object
    properties:
      add_nodegroup:
        description: "Add Node group in cluster instance if this property is true"
        type: boolean
        format: boolean
      backplane:
        description: "Backplane Interface"
        type: string
        format: string
      clusterid:
        description: "Cluster Id in range of 1 and 16"
        type: integer
        format: int32
      nodeid:
        description: "Node Id in range of 0 and 31"
        type: integer
        format: int32
      state:
        description: "Node State. Can be ACTIVE, SPARE, PASSIVE"
        type: string
        format: string
        minLength: 1
        maxLength: 32
      hostRouteEnabled:
        description: "Is hostRoute property Enabled true/false"
        type: boolean
        format: boolean
      password:
        description: "Password of the Configuration Coordinator node(Cluster IP)"
        type: string
        format: password
        minLength: 1
        maxLength: 128
      process_local:
        description: "Process Local"
        type: boolean
        format: boolean
      inc_mode:
        description: "Inc Mode"
        type: boolean
        format: boolean
      snip:
        description: "Snip"
        type: string
        format: ipaddress
        minLength: 1
        maxLength: 64
      scheduleId:
        description: "scheduleId is used to refer maintenaince schedule task"
        type: string
        format: string
      clnodes:
        description: "List of Nodes part of Cluster"
        type: string
        format: string
      preemption:
        description: "Preemption"
        type: boolean
        format: boolean
      iscco:
        description: "Is Cluster coordinator"
        type: boolean
        format: boolean
      clip:
        description: "Cluster IPAddress"
        type: string
        format: ipaddress
        minLength: 1
        maxLength: 64
      node_group:
        description: "Node group"
        type: string
        format: string
      nodegroup_list:
        description: "Available Node group list on this cluster"
        type: array
        items:
          type: string
          format: string
      ipaddress:
        description: "NetScaler ipaddress which is going to participate in cluster"
        type: string
        format: ipaddress
        minLength: 1
        maxLength: 64
      profile_name:
        description: "Profile Name"
        type: string
        format: string
        maxLength: 128

  ns_cluster:
    allOf:
      -
        properties:
          mgmt_cpu_usage:
             description: "Management CPU Usage (%) of Cluster Instance"
             type: number
             format: double
          act_id:
             description: "Activity Id"
             type: string
             format: uuid
          clviewleader:
             description: "Cluster CCO NSIP"
             type: string
             format: ipaddress
             minLength: 1
             maxLength: 64
          clnumnodes:
             description: "Number of nodes in cluster"
             type: integer
             format: int32
          http_req:
             description: "HTTP Requests/second on Cluster Instance"
             type: number
             format: double
          cpu_usage:
             description: "CPU Usage (%) of Cluster Instance"
             type: number
             format: double
          operationalstate:
             description: "Cluster Operational State"
             type: string
             format: string
          tx:
             description: "Out Throughput of Cluster Instance in Mbps"
             type: number
             format: double
          clcurstatus:
             description: "Current State of the cluster"
             type: string
             format: string
          rx:
             description: "In Throughput of Cluster Instance in Mbps"
             type: number
             format: double
          memory_usage:
             description: "Memory Usage (%) of Cluster Instance"
             type: number
             format: double
          health:
             description: "Node Health State"
             type: string
             format: string
             minLength: 1
             maxLength: 32
      - $ref: '#/definitions/ns_cluster_readwrite'

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