swagger: '2.0'
info:
  description: Configuration for Slack details. resource.
  version: 'v2'
  title: slack_profile
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: slack_profile
    description: Slack details.
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 sent slack messages.
   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/slack_profile:
    get:
      tags:
        - slack_profile
      summary: GET all slack_profile
      operationId: getall_slack_profile
      description: Use this operation to get slack 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 slack_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 slack_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 slack_profile resources.
          enum:
            - yes
      responses:
        200:
          description:  for slack_profile
          schema: 
              $ref: '#/definitions/getslack_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:
        - slack_profile
      summary: POST operation for slack_profile
      operationId: post_slack_profile
      description: POST operation for slack_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: slack_profile
          description: slack_profile object
          schema:
              $ref: '#/definitions/addslack_profileRequest'
      responses:
        200:
          description: add for slack_profile
          schema: 
              $ref: '#/definitions/addslack_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/slack_profile/{id}:
    get:
      tags:
        - slack_profile
      summary: GET by key for slack_profile
      operationId: getbykey_slack_profile
      description: Use this operation to get slack 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 slack_profile
          schema: 
              $ref: '#/definitions/getslack_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:
        - slack_profile
      summary: PUT for slack_profile
      operationId: putbykey_slack_profile
      description: Use this operation to modify slack 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
        - in: body
          name: slack_profile
          description: slack_profile object
          schema:
              $ref: '#/definitions/modifyslack_profileRequest'
      responses:
        200:
          description: add for slack_profile
          schema: 
              $ref: '#/definitions/modifyslack_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:
        - slack_profile
      summary: Delete for slack_profile
      operationId: deletebykey_slack_profile
      description: Use this operation to delete slack 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:
        204:
          description: add for slack_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:
  addslack_profileRequest:
    type: object
    required:
      - slack_profile
    properties:
      slack_profile:
        $ref: '#/definitions/slack_profile_readwrite'
    title: addslack_profileRequest
    example:
      slack_profile:
        channel_name: "#channel_name"
        webhook_url: "https://hooks.slack.com/services/ABCDEFGHI/ABCDEFGHI/ABCDEFGHI"
        token: "abcd-1111111111-1111111111-1111111111-1111111111"
        profile_name: "test"

  addslack_profileResponse:
    type: object
    required:
      - slack_profile
    properties:
      slack_profile:
        $ref: '#/definitions/slack_profile'
    title: addslack_profileResponse
    example:
      slack_profile:
        notification_type: "With attachment"
        channel_name: "#channel_name"
        webhook_url: "https://hooks.slack.com/services/ABCDEFGHI/ABCDEFGHI/ABCDEFGHI"
        is_configured: "Success"
        tenant_id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        is_only_notify: "false"
        token: "abcd-1111111111-1111111111-1111111111-1111111111"
        profile_name: "test"
        filename: "sample"
        subject: "sample"
        message: "sample"

  getslack_profileResponse:
    type: object
    required:
      - slack_profile
    properties:
      slack_profile:
        $ref: '#/definitions/slack_profile'
    title: getslack_profileResponse
    example:
      slack_profile:
        notification_type: "With attachment"
        channel_name: "#channel_name"
        webhook_url: "https://hooks.slack.com/services/ABCDEFGHI/ABCDEFGHI/ABCDEFGHI"
        is_configured: "Success"
        tenant_id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        is_only_notify: "false"
        token: "abcd-1111111111-1111111111-1111111111-1111111111"
        profile_name: "test"
        filename: "sample"
        subject: "sample"
        message: "sample"

  getslack_profilesResponse:
    type: object
    required:
      - slack_profile
    properties:
      slack_profile:
        type: array
        items:
          $ref: '#/definitions/slack_profile'
    title: getslack_profilesResponse
    example:
      slack_profile:
        notification_type: "With attachment"
        channel_name: "#channel_name"
        webhook_url: "https://hooks.slack.com/services/ABCDEFGHI/ABCDEFGHI/ABCDEFGHI"
        is_configured: "Success"
        tenant_id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        is_only_notify: "false"
        token: "abcd-1111111111-1111111111-1111111111-1111111111"
        profile_name: "test"
        filename: "sample"
        subject: "sample"
        message: "sample"

  modifyslack_profileRequest:
    type: object
    required:
      - slack_profile
    properties:
      slack_profile:
        $ref: '#/definitions/slack_profile_readwrite'
    title: modifyslack_profileRequest
    example:
      slack_profile:
        channel_name: "#channel_name"
        webhook_url: "https://hooks.slack.com/services/ABCDEFGHI/ABCDEFGHI/ABCDEFGHI"
        token: "abcd-1111111111-1111111111-1111111111-1111111111"
        profile_name: "test"

  modifyslack_profileResponse:
    type: object
    required:
      - slack_profile
    properties:
      slack_profile:
        $ref: '#/definitions/slack_profile'
    title: modifyslack_profileResponse
    example:
      slack_profile:
        notification_type: "With attachment"
        channel_name: "#channel_name"
        webhook_url: "https://hooks.slack.com/services/ABCDEFGHI/ABCDEFGHI/ABCDEFGHI"
        is_configured: "Success"
        tenant_id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        id: "33688939-bf69-488e-a5f4-cb650dbccde9"
        is_only_notify: "false"
        token: "abcd-1111111111-1111111111-1111111111-1111111111"
        profile_name: "test"
        filename: "sample"
        subject: "sample"
        message: "sample"

  slack_profile_readwrite:
    type: object
    properties:
      channel_name:
        description: "Slack channel name"
        type: string
        format: string
      webhook_url:
        description: "URL used for sending the slack messages. "
        type: string
        format: url
      token:
        description: "Slack token used for sending the slack messages/file upload."
        type: string
        format: string
      profile_name:
        description: "Profile name through which slack messages will be sent."
        type: string
        format: string
        minLength: 1
        maxLength: 128

  slack_profile:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the sent slack messages.
            type: string
            format: uuid
          notification_type:
             description: "Notification type"
             type: string
             format: string
          is_configured:
             description: "True, if this profile is created/updated with proper details"
             type: string
             format: string
          tenant_id:
             description: "Tenant Id of the Slack profile"
             type: string
             format: uuid
          is_only_notify:
             description: "True, if attachment is required along with notification"
             type: boolean
             format: boolean
      - $ref: '#/definitions/slack_profile_readwrite'

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