swagger: '2.0'
info:
  description: Configuration for SMS server properties  resource.
  version: 'v2'
  title: sms_server
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: sms_server
    description: SMS server properties 
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 sms server
   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/sms_server:
    get:
      tags:
        - sms_server
      summary: GET all sms_server
      operationId: getall_sms_server
      description: Use this operation to get sms 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 sms_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 sms_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 sms_server resources.
          enum:
            - yes
      responses:
        200:
          description:  for sms_server
          schema: 
              $ref: '#/definitions/getsms_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:
        - sms_server
      summary: POST operation for sms_server
      operationId: post_sms_server
      description: POST operation for sms_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: sms_server
          description: sms_server object
          schema:
              $ref: '#/definitions/addsms_serverRequest'
      responses:
        200:
          description: add for sms_server
          schema: 
              $ref: '#/definitions/addsms_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/sms_server/{id}:
    get:
      tags:
        - sms_server
      summary: GET by key for sms_server
      operationId: getbykey_sms_server
      description: Use this operation to get sms 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 sms_server
          schema: 
              $ref: '#/definitions/getsms_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:
        - sms_server
      summary: PUT for sms_server
      operationId: putbykey_sms_server
      description: Use this operation to modify sms 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: sms_server
          description: sms_server object
          schema:
              $ref: '#/definitions/modifysms_serverRequest'
      responses:
        200:
          description: add for sms_server
          schema: 
              $ref: '#/definitions/modifysms_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:
        - sms_server
      summary: Delete for sms_server
      operationId: deletebykey_sms_server
      description: Use this operation to delete sms 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 sms_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:
  addsms_serverRequest:
    type: object
    required:
      - sms_server
    properties:
      sms_server:
        $ref: '#/definitions/sms_server_readwrite'
    title: addsms_serverRequest
    example:
      sms_server:
        optional1_val: "sms"
        to_seperater: ";"
        username_val: "test"
        to_key: "test"
        is_ssl: "true"
        base_url: "http://www.smsserver.com"
        username_key: "sms"
        optional1_key: "test"
        message_key: "sms_test"
        message_word_sperater: ";"
        type: "GET"
        password_val: "test"
        password_key: "sms"
        server_name: "test_sms"

  addsms_serverResponse:
    type: object
    required:
      - sms_server
    properties:
      sms_server:
        $ref: '#/definitions/sms_server'
    title: addsms_serverResponse
    example:
      sms_server:
        optional2_val1: "string_value"
        optional1_val: "sms"
        to_seperater: ";"
        username_val: "test"
        to_key: "test"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        optional3_key: "string_value"
        id: "cc9f23d0-c764-46b4-b6eb-7b645dab8944"
        is_ssl: "true"
        optional3_val: "string_value"
        base_url: "http://www.smsserver.com"
        username_key: "sms"
        optional2_key: "string_value"
        optional1_key: "test"
        message_key: "sms_test"
        message_word_sperater: ";"
        type: "GET"
        password_val: "test"
        password_key: "sms"
        server_name: "test_sms"

  getsms_serverResponse:
    type: object
    required:
      - sms_server
    properties:
      sms_server:
        $ref: '#/definitions/sms_server'
    title: getsms_serverResponse
    example:
      sms_server:
        optional2_val1: "string_value"
        optional1_val: "sms"
        to_seperater: ";"
        username_val: "test"
        to_key: "test"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        optional3_key: "string_value"
        id: "cc9f23d0-c764-46b4-b6eb-7b645dab8944"
        is_ssl: "true"
        optional3_val: "string_value"
        base_url: "http://www.smsserver.com"
        username_key: "sms"
        optional2_key: "string_value"
        optional1_key: "test"
        message_key: "sms_test"
        message_word_sperater: ";"
        type: "GET"
        password_val: "test"
        password_key: "sms"
        server_name: "test_sms"

  getsms_serversResponse:
    type: object
    required:
      - sms_server
    properties:
      sms_server:
        type: array
        items:
          $ref: '#/definitions/sms_server'
    title: getsms_serversResponse
    example:
      sms_server:
        optional2_val1: "string_value"
        optional1_val: "sms"
        to_seperater: ";"
        username_val: "test"
        to_key: "test"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        optional3_key: "string_value"
        id: "cc9f23d0-c764-46b4-b6eb-7b645dab8944"
        is_ssl: "true"
        optional3_val: "string_value"
        base_url: "http://www.smsserver.com"
        username_key: "sms"
        optional2_key: "string_value"
        optional1_key: "test"
        message_key: "sms_test"
        message_word_sperater: ";"
        type: "GET"
        password_val: "test"
        password_key: "sms"
        server_name: "test_sms"

  modifysms_serverRequest:
    type: object
    required:
      - sms_server
    properties:
      sms_server:
        $ref: '#/definitions/sms_server_readwrite'
    title: modifysms_serverRequest
    example:
      sms_server:
        optional1_val: "sms"
        to_seperater: ";"
        username_val: "test"
        to_key: "test"
        is_ssl: "true"
        base_url: "http://www.smsserver.com"
        username_key: "sms"
        optional1_key: "test"
        message_key: "sms_test"
        message_word_sperater: ";"
        type: "GET"
        password_val: "test"
        password_key: "sms"
        server_name: "test_sms"

  modifysms_serverResponse:
    type: object
    required:
      - sms_server
    properties:
      sms_server:
        $ref: '#/definitions/sms_server'
    title: modifysms_serverResponse
    example:
      sms_server:
        optional2_val1: "string_value"
        optional1_val: "sms"
        to_seperater: ";"
        username_val: "test"
        to_key: "test"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        optional3_key: "string_value"
        id: "cc9f23d0-c764-46b4-b6eb-7b645dab8944"
        is_ssl: "true"
        optional3_val: "string_value"
        base_url: "http://www.smsserver.com"
        username_key: "sms"
        optional2_key: "string_value"
        optional1_key: "test"
        message_key: "sms_test"
        message_word_sperater: ";"
        type: "GET"
        password_val: "test"
        password_key: "sms"
        server_name: "test_sms"

  sms_server_readwrite:
    type: object
    properties:
      optional1_val:
        description: "Optional1 Val for the sms server"
        type: string
        format: string
        maxLength: 128
      to_seperater:
        description: "To list seperater for the sms server"
        type: string
        format: string
        maxLength: 128
      username_val:
        description: "Username val for the sms server"
        type: string
        format: string
        maxLength: 128
      to_key:
        description: "To key for the sms server"
        type: string
        format: string
        maxLength: 128
      is_ssl:
        description: "Is SSL support configured."
        type: boolean
        format: boolean
      base_url:
        description: "Base URL for the sms server, without payload"
        type: string
        format: string
        maxLength: 2000
      username_key:
        description: "Username key for the sms server"
        type: string
        format: string
        maxLength: 128
      optional1_key:
        description: "Optional1 key for the sms server"
        type: string
        format: string
        maxLength: 128
      message_key:
        description: "Message key for the sms server"
        type: string
        format: string
        maxLength: 128
      message_word_sperater:
        description: "Message Word Seperater for the sms server"
        type: string
        format: string
        maxLength: 128
      type:
        description: "HTTP type supported for the sms server"
        type: string
        format: string
        maxLength: 128
      password_val:
        description: "Password Val for the sms server"
        type: string
        format: password
        maxLength: 128
      password_key:
        description: "Password key for the sms server"
        type: string
        format: string
        maxLength: 128
      server_name:
        description: "SMS server name"
        type: string
        format: string
        minLength: 1
        maxLength: 128

  sms_server:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the sms server
            type: string
            format: uuid
          tenant_id:
             description: "Tenant Id of the Config Jobs"
             type: string
             format: uuid
      - $ref: '#/definitions/sms_server_readwrite'

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