swagger: '2.0'
info:
  description: Configuration for Mail profile resource.
  version: 'v2'
  title: mail_profile
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: mail_profile
    description: Mail profile
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 mail profile.
   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/mail_profile:
    get:
      tags:
        - mail_profile
      summary: GET all mail_profile
      operationId: getall_mail_profile
      description: Use this operation to get mail profile.
      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 mail_profile 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 mail_profile 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 mail_profile resources.
          enum:
            - yes
      responses:
        200:
          description:  for mail_profile
          schema: 
              $ref: '#/definitions/getmail_profilesResponse'
        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:
        - mail_profile
      summary: POST operation for mail_profile
      operationId: post_mail_profile
      description: POST operation for mail_profile
      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: mail_profile
          description: mail_profile object
          schema:
              $ref: '#/definitions/addmail_profileRequest'
      responses:
        200:
          description: add for mail_profile
          schema: 
              $ref: '#/definitions/addmail_profileResponse'
        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/mail_profile/{id}:
    get:
      tags:
        - mail_profile
      summary: GET by key for mail_profile
      operationId: getbykey_mail_profile
      description: Use this operation to get mail profile.
      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 mail_profile
          schema: 
              $ref: '#/definitions/getmail_profileResponse'
        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:
        - mail_profile
      summary: PUT for mail_profile
      operationId: putbykey_mail_profile
      description: Use this operation to modify mail profile.
      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: mail_profile
          description: mail_profile object
          schema:
              $ref: '#/definitions/modifymail_profileRequest'
      responses:
        200:
          description: add for mail_profile
          schema: 
              $ref: '#/definitions/modifymail_profileResponse'
        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:
        - mail_profile
      summary: Delete for mail_profile
      operationId: deletebykey_mail_profile
      description: Use this operation to delete mail profile.
      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 mail_profile
        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:
  addmail_profileRequest:
    type: object
    required:
      - mail_profile
    properties:
      mail_profile:
        $ref: '#/definitions/mail_profile_readwrite'
    title: addmail_profileRequest
    example:
      mail_profile:
        to_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        sender_mail_address: "userfirstname.lastname@company.com"
        bcc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        cc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        server_name: "1.1.1.1"
        profile_name: "test_profile"

  addmail_profileResponse:
    type: object
    required:
      - mail_profile
    properties:
      mail_profile:
        $ref: '#/definitions/mail_profile'
    title: addmail_profileResponse
    example:
      mail_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        to_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        sender_mail_address: "userfirstname.lastname@company.com"
        bcc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        server_name: "1.1.1.1"
        profile_name: "test_profile"

  getmail_profileResponse:
    type: object
    required:
      - mail_profile
    properties:
      mail_profile:
        $ref: '#/definitions/mail_profile'
    title: getmail_profileResponse
    example:
      mail_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        to_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        sender_mail_address: "userfirstname.lastname@company.com"
        bcc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        server_name: "1.1.1.1"
        profile_name: "test_profile"

  getmail_profilesResponse:
    type: object
    required:
      - mail_profile
    properties:
      mail_profile:
        type: array
        items:
          $ref: '#/definitions/mail_profile'
    title: getmail_profilesResponse
    example:
      mail_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        to_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        sender_mail_address: "userfirstname.lastname@company.com"
        bcc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        server_name: "1.1.1.1"
        profile_name: "test_profile"

  modifymail_profileRequest:
    type: object
    required:
      - mail_profile
    properties:
      mail_profile:
        $ref: '#/definitions/mail_profile_readwrite'
    title: modifymail_profileRequest
    example:
      mail_profile:
        to_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        sender_mail_address: "userfirstname.lastname@company.com"
        bcc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        cc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        server_name: "1.1.1.1"
        profile_name: "test_profile"

  modifymail_profileResponse:
    type: object
    required:
      - mail_profile
    properties:
      mail_profile:
        $ref: '#/definitions/mail_profile'
    title: modifymail_profileResponse
    example:
      mail_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        to_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        sender_mail_address: "userfirstname.lastname@company.com"
        bcc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        cc_list: "userfirstname.lastname@company.com,userfirstname2.lastname2@company.com"
        server_name: "1.1.1.1"
        profile_name: "test_profile"

  mail_profile_readwrite:
    type: object
    properties:
      to_list:
        description: "List of to whom send the mail. "
        type: string
        format: email
        minLength: 6
      sender_mail_address:
        description: "Email Address from where mail is send"
        type: string
        format: email
      bcc_list:
        description: "List to whom BCC the mail."
        type: string
        format: email
      cc_list:
        description: "List to whom CC the mail."
        type: string
        format: email
      server_name:
        description: "SMTP server name"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      profile_name:
        description: "Profile name for the mail setting."
        type: string
        format: string
        minLength: 1
        maxLength: 128

  mail_profile:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the mail profile.
            type: string
            format: uuid
      - $ref: '#/definitions/mail_profile_readwrite'

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