swagger: '2.0'
info:
  description: Configuration for Auto-Scale Group provision details for each availability zone resource.
  version: 'v2'
  title: autoscalegroup_profile_map
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: autoscalegroup_profile_map
    description: Auto-Scale Group provision details for each availability zone
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 profiles
   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/autoscalegroup_profile_map:
    get:
      tags:
        - autoscalegroup_profile_map
      summary: GET all autoscalegroup_profile_map
      operationId: getall_autoscalegroup_profile_map
      description: Use this operation to get autoscale cluster/availability_zones
      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 autoscalegroup_profile_map 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 autoscalegroup_profile_map 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 autoscalegroup_profile_map resources.
          enum:
            - yes
      responses:
        200:
          description:  for autoscalegroup_profile_map
          schema: 
              $ref: '#/definitions/getautoscalegroup_profile_mapsResponse'
        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:
        - autoscalegroup_profile_map
      summary: POST operation for autoscalegroup_profile_map
      operationId: post_autoscalegroup_profile_map
      description: POST operation for autoscalegroup_profile_map
      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: autoscalegroup_profile_map
          description: autoscalegroup_profile_map object
          schema:
              $ref: '#/definitions/addautoscalegroup_profile_mapRequest'
      responses:
        200:
          description: add for autoscalegroup_profile_map
          schema: 
              $ref: '#/definitions/addautoscalegroup_profile_mapResponse'
        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/autoscalegroup_profile_map/{id}:
    get:
      tags:
        - autoscalegroup_profile_map
      summary: GET by key for autoscalegroup_profile_map
      operationId: getbykey_autoscalegroup_profile_map
      description: Use this operation to get autoscale cluster/availability_zones
      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 autoscalegroup_profile_map
          schema: 
              $ref: '#/definitions/getautoscalegroup_profile_mapResponse'
        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:
        - autoscalegroup_profile_map
      summary: PUT for autoscalegroup_profile_map
      operationId: putbykey_autoscalegroup_profile_map
      description: Use this operation to modify the properties of availability_zone
      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: autoscalegroup_profile_map
          description: autoscalegroup_profile_map object
          schema:
              $ref: '#/definitions/modifyautoscalegroup_profile_mapRequest'
      responses:
        200:
          description: add for autoscalegroup_profile_map
          schema: 
              $ref: '#/definitions/modifyautoscalegroup_profile_mapResponse'
        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:
        - autoscalegroup_profile_map
      summary: Delete for autoscalegroup_profile_map
      operationId: deletebykey_autoscalegroup_profile_map
      description: Use this operation to delete the availability_zone
      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 autoscalegroup_profile_map
        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:
  addautoscalegroup_profile_mapRequest:
    type: object
    required:
      - autoscalegroup_profile_map
    properties:
      autoscalegroup_profile_map:
        $ref: '#/definitions/autoscalegroup_profile_map_readwrite'
    title: addautoscalegroup_profile_mapRequest
    example:
      autoscalegroup_profile_map:
        azure_resource_group_name: "res-1"
        az_type: "1"
        cluster_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        node_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_profile_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_active_node_prov: "f"
        provision_request_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_name: "asg_test"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_job_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        retry_count: "1"
        availability_zone: "us-east-1"
        is_availability_set: "f"
        az_version: "1"
        retry_err_type: "RETRYABLE_ERROR"
        bandwidth_limit: "10"
        node_count: "2"
        error_message: "Agent Down"
        autoscalegroup_name: "asg_test"
        delay: "10"
        error_type: "10"

  addautoscalegroup_profile_mapResponse:
    type: object
    required:
      - autoscalegroup_profile_map
    properties:
      autoscalegroup_profile_map:
        $ref: '#/definitions/autoscalegroup_profile_map'
    title: addautoscalegroup_profile_mapResponse
    example:
      autoscalegroup_profile_map:
        azure_resource_group_name: "res-1"
        az_type: "1"
        cluster_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_state: "ASG_CLUSTER_PROV_SUCCESS"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        last_updated_time: "1580940000"
        node_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_profile_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_active_node_prov: "f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cluster_ip_address: "1.1.1.1"
        is_drain_connection_timeout_period: "f"
        provision_request_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_name: "asg_test"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_job_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        retry_count: "1"
        availability_zone: "us-east-1"
        provision_failure_timeout: "10"
        is_availability_set: "f"
        az_version: "1"
        retry_err_type: "RETRYABLE_ERROR"
        bandwidth_limit: "10"
        node_count: "2"
        error_message: "Agent Down"
        is_cool_down_period: "f"
        is_graceful_delete: "f"
        recreate_cluster: "f"
        autoscalegroup_name: "asg_test"
        delay: "10"
        force_delete: "false"
        az_activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_auto_upgrade: "false"
        error_type: "10"

  getautoscalegroup_profile_mapResponse:
    type: object
    required:
      - autoscalegroup_profile_map
    properties:
      autoscalegroup_profile_map:
        $ref: '#/definitions/autoscalegroup_profile_map'
    title: getautoscalegroup_profile_mapResponse
    example:
      autoscalegroup_profile_map:
        azure_resource_group_name: "res-1"
        az_type: "1"
        cluster_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_state: "ASG_CLUSTER_PROV_SUCCESS"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        last_updated_time: "1580940000"
        node_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_profile_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_active_node_prov: "f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cluster_ip_address: "1.1.1.1"
        is_drain_connection_timeout_period: "f"
        provision_request_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_name: "asg_test"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_job_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        retry_count: "1"
        availability_zone: "us-east-1"
        provision_failure_timeout: "10"
        is_availability_set: "f"
        az_version: "1"
        retry_err_type: "RETRYABLE_ERROR"
        bandwidth_limit: "10"
        node_count: "2"
        error_message: "Agent Down"
        is_cool_down_period: "f"
        is_graceful_delete: "f"
        recreate_cluster: "f"
        autoscalegroup_name: "asg_test"
        delay: "10"
        force_delete: "false"
        az_activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_auto_upgrade: "false"
        error_type: "10"

  getautoscalegroup_profile_mapsResponse:
    type: object
    required:
      - autoscalegroup_profile_map
    properties:
      autoscalegroup_profile_map:
        type: array
        items:
          $ref: '#/definitions/autoscalegroup_profile_map'
    title: getautoscalegroup_profile_mapsResponse
    example:
      autoscalegroup_profile_map:
        azure_resource_group_name: "res-1"
        az_type: "1"
        cluster_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_state: "ASG_CLUSTER_PROV_SUCCESS"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        last_updated_time: "1580940000"
        node_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_profile_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_active_node_prov: "f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cluster_ip_address: "1.1.1.1"
        is_drain_connection_timeout_period: "f"
        provision_request_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_name: "asg_test"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_job_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        retry_count: "1"
        availability_zone: "us-east-1"
        provision_failure_timeout: "10"
        is_availability_set: "f"
        az_version: "1"
        retry_err_type: "RETRYABLE_ERROR"
        bandwidth_limit: "10"
        node_count: "2"
        error_message: "Agent Down"
        is_cool_down_period: "f"
        is_graceful_delete: "f"
        recreate_cluster: "f"
        autoscalegroup_name: "asg_test"
        delay: "10"
        force_delete: "false"
        az_activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_auto_upgrade: "false"
        error_type: "10"

  modifyautoscalegroup_profile_mapRequest:
    type: object
    required:
      - autoscalegroup_profile_map
    properties:
      autoscalegroup_profile_map:
        $ref: '#/definitions/autoscalegroup_profile_map_readwrite'
    title: modifyautoscalegroup_profile_mapRequest
    example:
      autoscalegroup_profile_map:
        azure_resource_group_name: "res-1"
        az_type: "1"
        cluster_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        node_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_profile_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_active_node_prov: "f"
        provision_request_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_name: "asg_test"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_job_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        retry_count: "1"
        availability_zone: "us-east-1"
        is_availability_set: "f"
        az_version: "1"
        retry_err_type: "RETRYABLE_ERROR"
        bandwidth_limit: "10"
        node_count: "2"
        error_message: "Agent Down"
        autoscalegroup_name: "asg_test"
        delay: "10"
        error_type: "10"

  modifyautoscalegroup_profile_mapResponse:
    type: object
    required:
      - autoscalegroup_profile_map
    properties:
      autoscalegroup_profile_map:
        $ref: '#/definitions/autoscalegroup_profile_map'
    title: modifyautoscalegroup_profile_mapResponse
    example:
      autoscalegroup_profile_map:
        azure_resource_group_name: "res-1"
        az_type: "1"
        cluster_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_state: "ASG_CLUSTER_PROV_SUCCESS"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        last_updated_time: "1580940000"
        node_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_profile_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_active_node_prov: "f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cluster_ip_address: "1.1.1.1"
        is_drain_connection_timeout_period: "f"
        provision_request_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        parent_name: "asg_test"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        provision_job_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        retry_count: "1"
        availability_zone: "us-east-1"
        provision_failure_timeout: "10"
        is_availability_set: "f"
        az_version: "1"
        retry_err_type: "RETRYABLE_ERROR"
        bandwidth_limit: "10"
        node_count: "2"
        error_message: "Agent Down"
        is_cool_down_period: "f"
        is_graceful_delete: "f"
        recreate_cluster: "f"
        autoscalegroup_name: "asg_test"
        delay: "10"
        force_delete: "false"
        az_activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_auto_upgrade: "false"
        error_type: "10"

  autoscalegroup_profile_map_readwrite:
    type: object
    properties:
      azure_resource_group_name:
        description: "Resource group name for Azure"
        type: string
        format: string
        maxLength: 128
      az_type:
        description: "Type of availabilty_zone/cluster (1.ORIGINAL, 2.BACKUP)"
        type: integer
        format: int32
      cluster_id:
        description: "NetScaler Cluster ID for the availability zone"
        type: string
        format: uuid
        maxLength: 128
      parent_id:
        description: "Parent Id of autoscalegroup"
        type: string
        format: uuid
      node_id:
        description: "The managed_device id which has reference to the node provisioned or to be deprovisioned"
        type: string
        format: uuid
        maxLength: 128
      provision_profile_id:
        description: "ID of provision profile"
        type: string
        format: uuid
        minLength: 1
      is_active_node_prov:
        description: "This is to refer if the provisioning inprogress/failed/success is on active/passive node"
        type: boolean
        format: boolean
      provision_request_id:
        description: "The request id generated for provisoning of cluster from provisioning service"
        type: string
        format: uuid
        maxLength: 128
      parent_name:
        description: "Parent name of autoscale group"
        type: string
        format: string
      activity_id:
        description: "Most recent activity_id of this availability_zone/cluster"
        type: string
        format: uuid
      provision_job_id:
        description: "The job id generated for provisoning of failed node from provisioning service"
        type: string
        format: uuid
        maxLength: 128
      retry_count:
        description: "current auto retry count for a retryable error in a cluster."
        type: integer
        format: int32
      availability_zone:
        description: "availability_zone of autoscalegroup"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      is_availability_set:
        description: "Azure: If this profile belongs to availability set"
        type: boolean
        format: boolean
      az_version:
        description: "Version of availabilty_zone/cluster. Auto generated."
        type: string
        format: string
      retry_err_type:
        description: "Enable/Disable provisioning retry"
        type: string
        format: string
        maxLength: 50
      bandwidth_limit:
        description: "Bandwidth limit per ADC"
        type: integer
        format: int32
      node_count:
        description: "Number of nodes to be provisioned in the cluster"
        type: integer
        format: int32
      error_message:
        description: "Provision error message"
        type: string
        format: string
        maxLength: 255
      autoscalegroup_name:
        description: "Auto-Scale Group Name"
        type: string
        format: string
      delay:
        description: "For mock test: Delay in seconds introduced to get the response."
        type: integer
        format: int32
      error_type:
        description: "For mock test: simulates response type. 0-success,1-failed,2-validation failed with no delay"
        type: integer
        format: int32

  autoscalegroup_profile_map:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the profiles
            type: string
            format: uuid
          cluster_ip_address:
             description: "NetScaler Cluster IP Address"
             type: string
             format: ipaddress
             minLength: 1
             maxLength: 64
      - $ref: '#/definitions/autoscalegroup_profile_map_readwrite'

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