swagger: '2.0'
info:
  description: Configuration for Syslog Server resource.
  version: 'v2'
  title: syslog_server
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: syslog_server
    description: Syslog Server
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: name
   in: path
   type: string
   description: Syslog server name
   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/syslog_server:
    get:
      tags:
        - syslog_server
      summary: GET all syslog_server
      operationId: getall_syslog_server
      description: Use this operation to get all the syslog servers
      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 syslog_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 syslog_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 syslog_server resources.
          enum:
            - yes
      responses:
        200:
          description:  for syslog_server
          schema: 
              $ref: '#/definitions/getsyslog_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:
        - syslog_server
      summary: POST operation for syslog_server
      operationId: post_syslog_server
      description: POST operation for syslog_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: syslog_server
          description: syslog_server object
          schema:
              $ref: '#/definitions/addsyslog_serverRequest'
      responses:
        200:
          description: add for syslog_server
          schema: 
              $ref: '#/definitions/addsyslog_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/syslog_server/{name}:
    get:
      tags:
        - syslog_server
      summary: GET by key for syslog_server
      operationId: getbykey_syslog_server
      description: Use this operation to get all the syslog servers
      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 syslog_server
          schema: 
              $ref: '#/definitions/getsyslog_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:
        - syslog_server
      summary: PUT for syslog_server
      operationId: putbykey_syslog_server
      description: Use this operation to modify a syslog 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: syslog_server
          description: syslog_server object
          schema:
              $ref: '#/definitions/modifysyslog_serverRequest'
      responses:
        200:
          description: add for syslog_server
          schema: 
              $ref: '#/definitions/modifysyslog_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:
        - syslog_server
      summary: Delete for syslog_server
      operationId: deletebykey_syslog_server
      description: Use this operation to delete a syslog 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 syslog_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:
  addsyslog_serverRequest:
    type: object
    required:
      - syslog_server
    properties:
      syslog_server:
        $ref: '#/definitions/syslog_server_readwrite'
    title: addsyslog_serverRequest
    example:
      syslog_server:
        log_level_all: "boolean_value"
        log_level_warning: "boolean_value"
        log_level_error: "boolean_value"
        port: "514"
        log_level_info: "boolean_value"
        log_level_critical: "boolean_value"
        ip_address: "1.1.1.1"
        log_level_none: "boolean_value"

  addsyslog_serverResponse:
    type: object
    required:
      - syslog_server
    properties:
      syslog_server:
        $ref: '#/definitions/syslog_server'
    title: addsyslog_serverResponse
    example:
      syslog_server:
        log_level_all: "boolean_value"
        log_level_alert: "boolean_value"
        name: "string_value"
        log_level_debug: "boolean_value"
        log_level_warning: "boolean_value"
        log_level_error: "boolean_value"
        port: "514"
        log_levels: "string_value"
        log_level_info: "boolean_value"
        log_level_notice: "boolean_value"
        log_level_critical: "boolean_value"
        ip_address: "1.1.1.1"
        log_level_none: "boolean_value"
        address_type: "0"
        log_level_emergency: "boolean_value"

  getsyslog_serverResponse:
    type: object
    required:
      - syslog_server
    properties:
      syslog_server:
        $ref: '#/definitions/syslog_server'
    title: getsyslog_serverResponse
    example:
      syslog_server:
        log_level_all: "boolean_value"
        log_level_alert: "boolean_value"
        name: "string_value"
        log_level_debug: "boolean_value"
        log_level_warning: "boolean_value"
        log_level_error: "boolean_value"
        port: "514"
        log_levels: "string_value"
        log_level_info: "boolean_value"
        log_level_notice: "boolean_value"
        log_level_critical: "boolean_value"
        ip_address: "1.1.1.1"
        log_level_none: "boolean_value"
        address_type: "0"
        log_level_emergency: "boolean_value"

  getsyslog_serversResponse:
    type: object
    required:
      - syslog_server
    properties:
      syslog_server:
        type: array
        items:
          $ref: '#/definitions/syslog_server'
    title: getsyslog_serversResponse
    example:
      syslog_server:
        log_level_all: "boolean_value"
        log_level_alert: "boolean_value"
        name: "string_value"
        log_level_debug: "boolean_value"
        log_level_warning: "boolean_value"
        log_level_error: "boolean_value"
        port: "514"
        log_levels: "string_value"
        log_level_info: "boolean_value"
        log_level_notice: "boolean_value"
        log_level_critical: "boolean_value"
        ip_address: "1.1.1.1"
        log_level_none: "boolean_value"
        address_type: "0"
        log_level_emergency: "boolean_value"

  modifysyslog_serverRequest:
    type: object
    required:
      - syslog_server
    properties:
      syslog_server:
        $ref: '#/definitions/syslog_server_readwrite'
    title: modifysyslog_serverRequest
    example:
      syslog_server:
        log_level_all: "boolean_value"
        log_level_warning: "boolean_value"
        log_level_error: "boolean_value"
        port: "514"
        log_level_info: "boolean_value"
        log_level_critical: "boolean_value"
        ip_address: "1.1.1.1"
        log_level_none: "boolean_value"

  modifysyslog_serverResponse:
    type: object
    required:
      - syslog_server
    properties:
      syslog_server:
        $ref: '#/definitions/syslog_server'
    title: modifysyslog_serverResponse
    example:
      syslog_server:
        log_level_all: "boolean_value"
        log_level_alert: "boolean_value"
        name: "string_value"
        log_level_debug: "boolean_value"
        log_level_warning: "boolean_value"
        log_level_error: "boolean_value"
        port: "514"
        log_levels: "string_value"
        log_level_info: "boolean_value"
        log_level_notice: "boolean_value"
        log_level_critical: "boolean_value"
        ip_address: "1.1.1.1"
        log_level_none: "boolean_value"
        address_type: "0"
        log_level_emergency: "boolean_value"

  syslog_server_readwrite:
    type: object
    properties:
      log_level_all:
        description: "Send logs of all levels to this syslog server"
        type: boolean
        format: boolean
      log_level_warning:
        description: "Send logs of level warning to this syslog server"
        type: boolean
        format: boolean
      log_level_error:
        description: "Send logs of level error to this syslog server"
        type: boolean
        format: boolean
      port:
        description: "Syslog server port"
        type: integer
        format: int32
      log_level_info:
        description: "Send logs of level info to this syslog server"
        type: boolean
        format: boolean
      log_level_critical:
        description: "Send logs of level critical to this syslog server"
        type: boolean
        format: boolean
      ip_address:
        description: "Syslog server IP address"
        type: string
        format: IP Address
        minLength: 1
        maxLength: 64
      log_level_none:
        description: "Send no logs to this syslog server"
        type: boolean
        format: boolean

  syslog_server:
    allOf:
      -
        properties:
          name:
            description: Syslog server name
            type: string
            format: string
          log_levels:
             description: "Set of all log levels at which messages are sent to this syslog server"
             type: string
             format: string
          address_type:
             description: "Configuration Type. Values: 0: IPv4, 1: IPv6"
             type: integer
             format: int32
      - $ref: '#/definitions/syslog_server_readwrite'

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