swagger: '2.0'
info:
  description: Configuration for AAA Server configuration resource.
  version: 'v2'
  title: aaa_server
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: aaa_server
    description: AAA Server configuration
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 servers
   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/aaa_server:
    get:
      tags:
        - aaa_server
      summary: GET all aaa_server
      operationId: getall_aaa_server
      description: Use this operation to get AAA server details
      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 aaa_server 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 aaa_server 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 aaa_server resources.
          enum:
            - yes
      responses:
        200:
          description:  for aaa_server
          schema: 
              $ref: '#/definitions/getaaa_serversResponse'
        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/aaa_server/{id}:
    get:
      tags:
        - aaa_server
      summary: GET by key for aaa_server
      operationId: getbykey_aaa_server
      description: Use this operation to get AAA server details
      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 aaa_server
          schema: 
              $ref: '#/definitions/getaaa_serverResponse'
        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:
        - aaa_server
      summary: PUT for aaa_server
      operationId: putbykey_aaa_server
      description: Use this operation to modify AAA server details
      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: aaa_server
          description: aaa_server object
          schema:
              $ref: '#/definitions/modifyaaa_serverRequest'
      responses:
        200:
          description:  for aaa_server
          schema: 
              $ref: '#/definitions/modifyaaa_serverResponse'
        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:
  getaaa_serverResponse:
    type: object
    required:
      - aaa_server
    properties:
      aaa_server:
        $ref: '#/definitions/aaa_server'
    title: getaaa_serverResponse
    example:
      aaa_server:
        external_servers: [{        priority: "integer_value"
,        parent_name: "string_value"
,        external_server_type: "string_value"
,        external_server_name: "string_value"
,        id: "string_value"
,        parent_id: "string_value"
}]
        secondary_server_name: "test_server_sec"
        fallback_local_authentication: "true"
        log_ext_group_info: "false"
        enable_secondary_server: "false"
        primary_server_name: "test_server_pri"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        secondary_server_type: "LOCAL"
        primary_server_type: "LOCAL"

  getaaa_serversResponse:
    type: object
    required:
      - aaa_server
    properties:
      aaa_server:
        type: array
        items:
          $ref: '#/definitions/aaa_server'
    title: getaaa_serversResponse
    example:
      aaa_server:
        external_servers: [{        priority: "integer_value"
,        parent_name: "string_value"
,        external_server_type: "string_value"
,        external_server_name: "string_value"
,        id: "string_value"
,        parent_id: "string_value"
}]
        secondary_server_name: "test_server_sec"
        fallback_local_authentication: "true"
        log_ext_group_info: "false"
        enable_secondary_server: "false"
        primary_server_name: "test_server_pri"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        secondary_server_type: "LOCAL"
        primary_server_type: "LOCAL"

  modifyaaa_serverRequest:
    type: object
    required:
      - aaa_server
    properties:
      aaa_server:
        $ref: '#/definitions/aaa_server_readwrite'
    title: modifyaaa_serverRequest
    example:
      aaa_server:
        external_servers: [{        priority: "integer_value"
,        external_server_type: "string_value"
,        external_server_name: "string_value"
,        id: "string_value"
}]
        fallback_local_authentication: "true"
        log_ext_group_info: "false"
        primary_server_name: "test_server_pri"
        primary_server_type: "LOCAL"

  modifyaaa_serverResponse:
    type: object
    required:
      - aaa_server
    properties:
      aaa_server:
        $ref: '#/definitions/aaa_server'
    title: modifyaaa_serverResponse
    example:
      aaa_server:
        external_servers: [{        priority: "integer_value"
,        parent_name: "string_value"
,        external_server_type: "string_value"
,        external_server_name: "string_value"
,        id: "string_value"
,        parent_id: "string_value"
}]
        secondary_server_name: "test_server_sec"
        fallback_local_authentication: "true"
        log_ext_group_info: "false"
        enable_secondary_server: "false"
        primary_server_name: "test_server_pri"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        secondary_server_type: "LOCAL"
        primary_server_type: "LOCAL"

  aaa_server_readwrite:
    type: object
    properties:
      external_servers:
        type: array
        items:
          $ref: '#/definitions/external_server_readwrite'
      fallback_local_authentication:
        description: "Enable local fallback authentication"
        type: boolean
        format: boolean
      log_ext_group_info:
        description: "Log external group info"
        type: boolean
        format: boolean
      primary_server_name:
        description: "Name of primary server name"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      primary_server_type:
        description: "Type of primary server. Supported types 1. LOCAL 2.RADIUS 3.LDAP 4.TACACS 5.KEYSTONE"
        type: string
        format: string
        minLength: 1
        maxLength: 32

  aaa_server:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the servers
            type: string
            format: uuid
      - $ref: '#/definitions/aaa_server_readwrite'

  external_server_readwrite:
    type: object
    properties:
      priority:
        description: "Priority of external server"
        type: integer
        format: int32
      external_server_type:
        description: "Type of external server. Supported types 1.RADIUS 2.LDAP 3.TACACS 4.KEYSTONE"
        type: string
        format: string
        minLength: 1
        maxLength: 32
      external_server_name:
        description: "Name of external server"
        type: string
        format: string
        minLength: 1
        maxLength: 128

  external_server:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the external servers
            type: string
            format: uuid
      - $ref: '#/definitions/external_server_readwrite'

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