swagger: '2.0'
info:
  description: Configuration for Test mail. resource.
  version: 'v2'
  title: test_mail
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: test_mail
    description: Test mail.
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 test id
   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/test_mail:
    post:
      tags:
        - test_mail
      summary: POST operation for test_mail
      operationId: post_test_mail
      description: POST operation for test_mail
      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: test_mail
          description: test_mail object
          schema:
              $ref: '#/definitions/addtest_mailRequest'
      responses:
        200:
          description: add for test_mail
          schema: 
              $ref: '#/definitions/addtest_mailResponse'
        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:
  addtest_mailRequest:
    type: object
    required:
      - test_mail
    properties:
      test_mail:
        $ref: '#/definitions/test_mail_readwrite'
    title: addtest_mailRequest
    example:
      test_mail:
        failed_message: "Failed to connect to mail server: Timeout"
        profile_name: "profilename"

  addtest_mailResponse:
    type: object
    required:
      - test_mail
    properties:
      test_mail:
        $ref: '#/definitions/test_mail'
    title: addtest_mailResponse
    example:
      test_mail:
        failed_message: "Failed to connect to mail server: Timeout"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        profile_name: "profilename"

  test_mail_readwrite:
    type: object
    properties:
      failed_message:
        description: "Subject of the mail sent."
        type: string
        format: string
        minLength: 1
        maxLength: 2000
      profile_name:
        description: "Profile name through which mail sent."
        type: string
        format: string
        minLength: 1
        maxLength: 128

  test_mail:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for test id
            type: string
            format: string
      - $ref: '#/definitions/test_mail_readwrite'

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