swagger: '2.0'
info:
  description: Configuration for SMTP server properties  resource.
  version: 'v2'
  title: smtp_server
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: smtp_server
    description: SMTP 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 smtp 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/smtp_server:
    get:
      tags:
        - smtp_server
      summary: GET all smtp_server
      operationId: getall_smtp_server
      description: Use this operation to get smtp 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 smtp_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 smtp_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 smtp_server resources.
          enum:
            - yes
      responses:
        200:
          description:  for smtp_server
          schema: 
              $ref: '#/definitions/getsmtp_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:
        - smtp_server
      summary: POST operation for smtp_server
      operationId: post_smtp_server
      description: POST operation for smtp_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: smtp_server
          description: smtp_server object
          schema:
              $ref: '#/definitions/addsmtp_serverRequest'
      responses:
        200:
          description: add for smtp_server
          schema: 
              $ref: '#/definitions/addsmtp_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/smtp_server/{id}:
    get:
      tags:
        - smtp_server
      summary: GET by key for smtp_server
      operationId: getbykey_smtp_server
      description: Use this operation to get smtp 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 smtp_server
          schema: 
              $ref: '#/definitions/getsmtp_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:
        - smtp_server
      summary: PUT for smtp_server
      operationId: putbykey_smtp_server
      description: Use this operation to modify smtp 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: smtp_server
          description: smtp_server object
          schema:
              $ref: '#/definitions/modifysmtp_serverRequest'
      responses:
        200:
          description: add for smtp_server
          schema: 
              $ref: '#/definitions/modifysmtp_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:
        - smtp_server
      summary: Delete for smtp_server
      operationId: deletebykey_smtp_server
      description: Use this operation to delete smtp 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 smtp_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:
  addsmtp_serverRequest:
    type: object
    required:
      - smtp_server
    properties:
      smtp_server:
        $ref: '#/definitions/smtp_server_readwrite'
    title: addsmtp_serverRequest
    example:
      smtp_server:
        sender_mail_id: "example@citrix.com"
        is_auth: "false"
        port: "25"
        username: "test"
        password: "password"
        is_ssl: "false"
        server_name: "1.1.1.1"

  addsmtp_serverResponse:
    type: object
    required:
      - smtp_server
    properties:
      smtp_server:
        $ref: '#/definitions/smtp_server'
    title: addsmtp_serverResponse
    example:
      smtp_server:
        sender_mail_id: "example@citrix.com"
        is_auth: "false"
        port: "25"
        username: "test"
        password: "password"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        id: "711e1918-f9f7-4b3c-97aa-01af796aa7c1"
        is_ssl: "false"
        server_name: "1.1.1.1"

  getsmtp_serverResponse:
    type: object
    required:
      - smtp_server
    properties:
      smtp_server:
        $ref: '#/definitions/smtp_server'
    title: getsmtp_serverResponse
    example:
      smtp_server:
        sender_mail_id: "example@citrix.com"
        is_auth: "false"
        port: "25"
        username: "test"
        password: "password"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        id: "711e1918-f9f7-4b3c-97aa-01af796aa7c1"
        is_ssl: "false"
        server_name: "1.1.1.1"

  getsmtp_serversResponse:
    type: object
    required:
      - smtp_server
    properties:
      smtp_server:
        type: array
        items:
          $ref: '#/definitions/smtp_server'
    title: getsmtp_serversResponse
    example:
      smtp_server:
        sender_mail_id: "example@citrix.com"
        is_auth: "false"
        port: "25"
        username: "test"
        password: "password"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        id: "711e1918-f9f7-4b3c-97aa-01af796aa7c1"
        is_ssl: "false"
        server_name: "1.1.1.1"

  modifysmtp_serverRequest:
    type: object
    required:
      - smtp_server
    properties:
      smtp_server:
        $ref: '#/definitions/smtp_server_readwrite'
    title: modifysmtp_serverRequest
    example:
      smtp_server:
        sender_mail_id: "example@citrix.com"
        is_auth: "false"
        port: "25"
        username: "test"
        password: "password"
        is_ssl: "false"
        server_name: "1.1.1.1"

  modifysmtp_serverResponse:
    type: object
    required:
      - smtp_server
    properties:
      smtp_server:
        $ref: '#/definitions/smtp_server'
    title: modifysmtp_serverResponse
    example:
      smtp_server:
        sender_mail_id: "example@citrix.com"
        is_auth: "false"
        port: "25"
        username: "test"
        password: "password"
        tenant_id: "c86b7da4-1f69-4218-aa01-a6960ffd8141"
        id: "711e1918-f9f7-4b3c-97aa-01af796aa7c1"
        is_ssl: "false"
        server_name: "1.1.1.1"

  smtp_server_readwrite:
    type: object
    properties:
      sender_mail_id:
        description: "Email Address from which email is to be sent"
        type: string
        format: string
      is_auth:
        description: "Is authentication enabled for this smtp server"
        type: boolean
        format: boolean
      port:
        description: "SMTP Server port address."
        type: integer
        format: int32
      username:
        description: "Username for the smtp server"
        type: string
        format: string
        maxLength: 128
      password:
        description: "Password for the smtp server"
        type: string
        format: password
        maxLength: 128
      is_ssl:
        description: "Is this smtp server is SSL support configured."
        type: boolean
        format: boolean
      server_name:
        description: "SMTP server name"
        type: string
        format: string
        minLength: 1
        maxLength: 128

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

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