swagger: '2.0'
info:
  description: Configuration for TACACS Server configuration resource.
  version: 'v2'
  title: tacacs_server
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: tacacs_server
    description: TACACS 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 TACACS 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/tacacs_server:
    get:
      tags:
        - tacacs_server
      summary: GET all tacacs_server
      operationId: getall_tacacs_server
      description: Use this operation to get TACACS 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 tacacs_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 tacacs_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 tacacs_server resources.
          enum:
            - yes
      responses:
        200:
          description:  for tacacs_server
          schema: 
              $ref: '#/definitions/gettacacs_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'

    post:
      tags:
        - tacacs_server
      summary: POST operation for tacacs_server
      operationId: post_tacacs_server
      description: POST operation for tacacs_server
      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: tacacs_server
          description: tacacs_server object
          schema:
              $ref: '#/definitions/addtacacs_serverRequest'
      responses:
        200:
          description: add for tacacs_server
          schema: 
              $ref: '#/definitions/addtacacs_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'

  /massvc/{customerid}/nitro/v2/config/tacacs_server/{id}:
    get:
      tags:
        - tacacs_server
      summary: GET by key for tacacs_server
      operationId: getbykey_tacacs_server
      description: Use this operation to get TACACS 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: add for tacacs_server
          schema: 
              $ref: '#/definitions/gettacacs_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:
        - tacacs_server
      summary: PUT for tacacs_server
      operationId: putbykey_tacacs_server
      description: Use this operation to modify TACACS server
      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: tacacs_server
          description: tacacs_server object
          schema:
              $ref: '#/definitions/modifytacacs_serverRequest'
      responses:
        200:
          description: add for tacacs_server
          schema: 
              $ref: '#/definitions/modifytacacs_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'

    delete:
      tags:
        - tacacs_server
      summary: Delete for tacacs_server
      operationId: deletebykey_tacacs_server
      description: Use this operation to delete TACACS server
      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 tacacs_server
        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:
  addtacacs_serverRequest:
    type: object
    required:
      - tacacs_server
    properties:
      tacacs_server:
        $ref: '#/definitions/tacacs_server_readwrite'
    title: addtacacs_serverRequest
    example:
      tacacs_server:
        tacacs_key: "string_value"
        auth_timeout: "3"
        name: "LDAP Server"
        group_attr_name: "memberOf"
        port: "49"
        ip_address: "1.1.1.1"
        accounting: "false"

  addtacacs_serverResponse:
    type: object
    required:
      - tacacs_server
    properties:
      tacacs_server:
        $ref: '#/definitions/tacacs_server'
    title: addtacacs_serverResponse
    example:
      tacacs_server:
        tacacs_key: "string_value"
        auth_timeout: "3"
        name: "LDAP Server"
        group_attr_name: "memberOf"
        port: "49"
        id: "4be3c482-9d44-4095-add7-c55acc6a8af8"
        ip_address: "1.1.1.1"
        accounting: "false"
        address_type: "0"

  gettacacs_serverResponse:
    type: object
    required:
      - tacacs_server
    properties:
      tacacs_server:
        $ref: '#/definitions/tacacs_server'
    title: gettacacs_serverResponse
    example:
      tacacs_server:
        tacacs_key: "string_value"
        auth_timeout: "3"
        name: "LDAP Server"
        group_attr_name: "memberOf"
        port: "49"
        id: "4be3c482-9d44-4095-add7-c55acc6a8af8"
        ip_address: "1.1.1.1"
        accounting: "false"
        address_type: "0"

  gettacacs_serversResponse:
    type: object
    required:
      - tacacs_server
    properties:
      tacacs_server:
        type: array
        items:
          $ref: '#/definitions/tacacs_server'
    title: gettacacs_serversResponse
    example:
      tacacs_server:
        tacacs_key: "string_value"
        auth_timeout: "3"
        name: "LDAP Server"
        group_attr_name: "memberOf"
        port: "49"
        id: "4be3c482-9d44-4095-add7-c55acc6a8af8"
        ip_address: "1.1.1.1"
        accounting: "false"
        address_type: "0"

  modifytacacs_serverRequest:
    type: object
    required:
      - tacacs_server
    properties:
      tacacs_server:
        $ref: '#/definitions/tacacs_server_readwrite'
    title: modifytacacs_serverRequest
    example:
      tacacs_server:
        tacacs_key: "string_value"
        auth_timeout: "3"
        name: "LDAP Server"
        group_attr_name: "memberOf"
        port: "49"
        ip_address: "1.1.1.1"
        accounting: "false"

  modifytacacs_serverResponse:
    type: object
    required:
      - tacacs_server
    properties:
      tacacs_server:
        $ref: '#/definitions/tacacs_server'
    title: modifytacacs_serverResponse
    example:
      tacacs_server:
        tacacs_key: "string_value"
        auth_timeout: "3"
        name: "LDAP Server"
        group_attr_name: "memberOf"
        port: "49"
        id: "4be3c482-9d44-4095-add7-c55acc6a8af8"
        ip_address: "1.1.1.1"
        accounting: "false"
        address_type: "0"

  tacacs_server_readwrite:
    type: object
    properties:
      tacacs_key:
        description: "Key shared between the TACACS+ server and clients"
        type: string
        format: password
        minLength: 1
        maxLength: 64
      auth_timeout:
        description: "The maximum number of seconds the system will wait for a response from the TACACS server"
        type: integer
        format: int32
      name:
        description: "Name of TACACS server"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      group_attr_name:
        description: "The Attribute name for group extraction from the ACS server. If not passed, then groups will not be extracted. No other harm"
        type: string
        format: string
        maxLength: 64
      port:
        description: "port number of TACACS server"
        type: integer
        format: int32
      ip_address:
        description: "IP Address of TACACS server"
        type: string
        format: IP Address
        minLength: 1
        maxLength: 64
      accounting:
        description: "Enable accounting in the tacacs server"
        type: boolean
        format: boolean

  tacacs_server:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the TACACS servers
            type: string
            format: string
          address_type:
             description: "Configuration Type. Values: 0: IPv4, 1: IPv6"
             type: integer
             format: int32
      - $ref: '#/definitions/tacacs_server_readwrite'

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