swagger: '2.0'
info:
  description: Configuration for Additional Server node information resource.
  version: 'v2'
  title: server_nodes
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: server_nodes
    description: Additional Server node information
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: name
   in: path
   type: string
   description: Server node IP Address
   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/server_nodes:
    get:
      tags:
        - server_nodes
      summary: GET all server_nodes
      operationId: getall_server_nodes
      description: Use this operation to get server nodes
      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 server_nodes 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 server_nodes 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 server_nodes resources.
          enum:
            - yes
      responses:
        200:
          description:  for server_nodes
          schema: 
              $ref: '#/definitions/getserver_nodessResponse'
        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:
        - server_nodes
      summary: POST operation for server_nodes
      operationId: post_server_nodes
      description: POST operation for server_nodes
      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: server_nodes
          description: server_nodes object
          schema:
              $ref: '#/definitions/addserver_nodesRequest'
      responses:
        200:
          description: add for server_nodes
          schema: 
              $ref: '#/definitions/addserver_nodesResponse'
        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/server_nodes/{name}:
    get:
      tags:
        - server_nodes
      summary: GET by key for server_nodes
      operationId: getbykey_server_nodes
      description: Use this operation to get server nodes
      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 server_nodes
          schema: 
              $ref: '#/definitions/getserver_nodesResponse'
        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:
        - server_nodes
      summary: PUT for server_nodes
      operationId: putbykey_server_nodes
      description: Use this operation to modify server nodes
      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: server_nodes
          description: server_nodes object
          schema:
              $ref: '#/definitions/modifyserver_nodesRequest'
      responses:
        200:
          description: add for server_nodes
          schema: 
              $ref: '#/definitions/modifyserver_nodesResponse'
        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:
        - server_nodes
      summary: Delete for server_nodes
      operationId: deletebykey_server_nodes
      description: Use this operation to delete server nodes
      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 server_nodes
        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:
  addserver_nodesRequest:
    type: object
    required:
      - server_nodes
    properties:
      server_nodes:
        $ref: '#/definitions/server_nodes_readwrite'
    title: addserver_nodesRequest
    example:
      server_nodes:
        priority: "0"
        deployment_status: "false"
        app_id: "string_value"
        db_health: "UP"
        state: "OUT OF SERVICE"
        username: "nsroot"
        password: "password"
        sync_progress: "Database is in Sync"
        is_pooled_license: "false"
        is_primary: "false"
        is_star_node: "false"
        build_name: "PKEY"
        vip: "string_value"
        public_key: "PKEY"
        device_count: "0"

  addserver_nodesResponse:
    type: object
    required:
      - server_nodes
    properties:
      server_nodes:
        $ref: '#/definitions/server_nodes'
    title: addserver_nodesResponse
    example:
      server_nodes:
        priority: "0"
        deployment_status: "false"
        app_id: "string_value"
        name: "test_ipblock1"
        db_health: "UP"
        state: "OUT OF SERVICE"
        username: "nsroot"
        password: "password"
        sync_progress: "Database is in Sync"
        is_pooled_license: "false"
        is_primary: "false"
        is_star_node: "false"
        build_name: "PKEY"
        vip: "string_value"
        public_key: "PKEY"
        device_count: "0"

  getserver_nodesResponse:
    type: object
    required:
      - server_nodes
    properties:
      server_nodes:
        $ref: '#/definitions/server_nodes'
    title: getserver_nodesResponse
    example:
      server_nodes:
        priority: "0"
        deployment_status: "false"
        app_id: "string_value"
        name: "test_ipblock1"
        db_health: "UP"
        state: "OUT OF SERVICE"
        username: "nsroot"
        password: "password"
        sync_progress: "Database is in Sync"
        is_pooled_license: "false"
        is_primary: "false"
        is_star_node: "false"
        build_name: "PKEY"
        vip: "string_value"
        public_key: "PKEY"
        device_count: "0"

  getserver_nodessResponse:
    type: object
    required:
      - server_nodes
    properties:
      server_nodes:
        type: array
        items:
          $ref: '#/definitions/server_nodes'
    title: getserver_nodessResponse
    example:
      server_nodes:
        priority: "0"
        deployment_status: "false"
        app_id: "string_value"
        name: "test_ipblock1"
        db_health: "UP"
        state: "OUT OF SERVICE"
        username: "nsroot"
        password: "password"
        sync_progress: "Database is in Sync"
        is_pooled_license: "false"
        is_primary: "false"
        is_star_node: "false"
        build_name: "PKEY"
        vip: "string_value"
        public_key: "PKEY"
        device_count: "0"

  modifyserver_nodesRequest:
    type: object
    required:
      - server_nodes
    properties:
      server_nodes:
        $ref: '#/definitions/server_nodes_readwrite'
    title: modifyserver_nodesRequest
    example:
      server_nodes:
        priority: "0"
        deployment_status: "false"
        app_id: "string_value"
        db_health: "UP"
        state: "OUT OF SERVICE"
        username: "nsroot"
        password: "password"
        sync_progress: "Database is in Sync"
        is_pooled_license: "false"
        is_primary: "false"
        is_star_node: "false"
        build_name: "PKEY"
        vip: "string_value"
        public_key: "PKEY"
        device_count: "0"

  modifyserver_nodesResponse:
    type: object
    required:
      - server_nodes
    properties:
      server_nodes:
        $ref: '#/definitions/server_nodes'
    title: modifyserver_nodesResponse
    example:
      server_nodes:
        priority: "0"
        deployment_status: "false"
        app_id: "string_value"
        name: "test_ipblock1"
        db_health: "UP"
        state: "OUT OF SERVICE"
        username: "nsroot"
        password: "password"
        sync_progress: "Database is in Sync"
        is_pooled_license: "false"
        is_primary: "false"
        is_star_node: "false"
        build_name: "PKEY"
        vip: "string_value"
        public_key: "PKEY"
        device_count: "0"

  server_nodes_readwrite:
    type: object
    properties:
      priority:
        description: "priority of the app node"
        type: integer
        format: int32
      deployment_status:
        description: "Deployment status of this node."
        type: boolean
        format: boolean
      app_id:
        description: "Node ID of the server node"
        type: string
        format: string
      db_health:
        description: "Database health of the node"
        type: string
        format: string
      state:
        description: "State of the App node"
        type: string
        format: string
      username:
        description: "username configured on Server node."
        type: string
        format: string
        minLength: 1
        maxLength: 128
      password:
        description: "Password"
        type: string
        format: password
        minLength: 1
        maxLength: 128
      sync_progress:
        description: "Database synchronization status with the primary node"
        type: string
        format: string
      is_pooled_license:
        description: "is_pooled_license present on node"
        type: boolean
        format: boolean
      is_primary:
        description: "true if this node is primary"
        type: boolean
        format: boolean
      is_star_node:
        description: "This node is star node or not"
        type: boolean
        format: boolean
      build_name:
        description: "Build name of the server node"
        type: string
        format: string
      vip:
        description: "Floating IP for ADM HA."
        type: string
        format: string
      public_key:
        description: "Useful for sending the public key while registration"
        type: string
        format: string
      device_count:
        description: "No of managed devices owned by the node"
        type: integer
        format: int32

  server_nodes:
    allOf:
      -
        properties:
          name:
            description: Server node IP Address
            type: string
            format: string
      - $ref: '#/definitions/server_nodes_readwrite'

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