swagger: '2.0'
info:
  description: Configuration for Servicenow details. resource.
  version: 'v2'
  title: servicenow_profile
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: servicenow_profile
    description: Servicenow 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 servicenow 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/servicenow_profile:
    get:
      tags:
        - servicenow_profile
      summary: GET all servicenow_profile
      operationId: getall_servicenow_profile
      description: Use this operation to get servicenow 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 servicenow_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 servicenow_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 servicenow_profile resources.
          enum:
            - yes
      responses:
        200:
          description:  for servicenow_profile
          schema: 
              $ref: '#/definitions/getservicenow_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:
        - servicenow_profile
      summary: POST operation for servicenow_profile
      operationId: post_servicenow_profile
      description: POST operation for servicenow_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: servicenow_profile
          description: servicenow_profile object
          schema:
              $ref: '#/definitions/addservicenow_profileRequest'
      responses:
        200:
          description: add for servicenow_profile
          schema: 
              $ref: '#/definitions/addservicenow_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/servicenow_profile/{id}:
    get:
      tags:
        - servicenow_profile
      summary: GET by key for servicenow_profile
      operationId: getbykey_servicenow_profile
      description: Use this operation to get servicenow 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 servicenow_profile
          schema: 
              $ref: '#/definitions/getservicenow_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:
        - servicenow_profile
      summary: Delete for servicenow_profile
      operationId: deletebykey_servicenow_profile
      description: Use this operation to delete servicenow 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 servicenow_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:
  addservicenow_profileRequest:
    type: object
    required:
      - servicenow_profile
    properties:
      servicenow_profile:
        $ref: '#/definitions/servicenow_profile_readwrite'
    title: addservicenow_profileRequest
    example:
      servicenow_profile:
        is_enabled: "false"
        tenant_id: "04536ee8-47d1-4dba-a179-cf0f6e644585"
        domain: "aaa.bbb.net"
        is_validated: "false"
        url: "/api/CreateIncident"
        profile_name: "profile_name"

  addservicenow_profileResponse:
    type: object
    required:
      - servicenow_profile
    properties:
      servicenow_profile:
        $ref: '#/definitions/servicenow_profile'
    title: addservicenow_profileResponse
    example:
      servicenow_profile:
        is_enabled: "false"
        tenant_id: "04536ee8-47d1-4dba-a179-cf0f6e644585"
        domain: "aaa.bbb.net"
        is_validated: "false"
        url: "/api/CreateIncident"
        id: "f8b4e4dc-d056-43f1-baf0-68c97ebdf771"
        profile_name: "profile_name"
        filename: "sample"
        subject: "sample"
        message: "sample"

  getservicenow_profileResponse:
    type: object
    required:
      - servicenow_profile
    properties:
      servicenow_profile:
        $ref: '#/definitions/servicenow_profile'
    title: getservicenow_profileResponse
    example:
      servicenow_profile:
        is_enabled: "false"
        tenant_id: "04536ee8-47d1-4dba-a179-cf0f6e644585"
        domain: "aaa.bbb.net"
        is_validated: "false"
        url: "/api/CreateIncident"
        id: "f8b4e4dc-d056-43f1-baf0-68c97ebdf771"
        profile_name: "profile_name"
        filename: "sample"
        subject: "sample"
        message: "sample"

  getservicenow_profilesResponse:
    type: object
    required:
      - servicenow_profile
    properties:
      servicenow_profile:
        type: array
        items:
          $ref: '#/definitions/servicenow_profile'
    title: getservicenow_profilesResponse
    example:
      servicenow_profile:
        is_enabled: "false"
        tenant_id: "04536ee8-47d1-4dba-a179-cf0f6e644585"
        domain: "aaa.bbb.net"
        is_validated: "false"
        url: "/api/CreateIncident"
        id: "f8b4e4dc-d056-43f1-baf0-68c97ebdf771"
        profile_name: "profile_name"
        filename: "sample"
        subject: "sample"
        message: "sample"

  servicenow_profile_readwrite:
    type: object
    properties:
      is_enabled:
        description: "true if this profile has been enabled"
        type: boolean
        format: boolean
      tenant_id:
        description: "Tenant Id of the servicenow profile"
        type: string
        format: uuid
      domain:
        description: "Domain for ServiceNow Endpoint"
        type: string
        format: string
      is_validated:
        description: "true if this profile has been validated and can be used to raise the ticket"
        type: boolean
        format: boolean
      url:
        description: "URL for ServiceNow Endpoint"
        type: string
        format: string
      profile_name:
        description: "Profile name through which servicenow messages will be sent."
        type: string
        format: string
        minLength: 1
        maxLength: 128

  servicenow_profile:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the sent servicenow messages.
            type: string
            format: uuid
      - $ref: '#/definitions/servicenow_profile_readwrite'

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