swagger: '2.0'
info:
  description: Configuration for Command Execution Profile for Event Rule resource.
  version: 'v2'
  title: command_execution_profile
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: command_execution_profile
    description: Command Execution Profile for Event Rule
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 run command 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/command_execution_profile:
    get:
      tags:
        - command_execution_profile
      summary: GET all command_execution_profile
      operationId: getall_command_execution_profile
      description: Use this operation to get command execution 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 command_execution_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 command_execution_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 command_execution_profile resources.
          enum:
            - yes
      responses:
        200:
          description:  for command_execution_profile
          schema: 
              $ref: '#/definitions/getcommand_execution_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:
        - command_execution_profile
      summary: POST operation for command_execution_profile
      operationId: post_command_execution_profile
      description: POST operation for command_execution_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: command_execution_profile
          description: command_execution_profile object
          schema:
              $ref: '#/definitions/addcommand_execution_profileRequest'
      responses:
        200:
          description: add for command_execution_profile
          schema: 
              $ref: '#/definitions/addcommand_execution_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/command_execution_profile/{id}:
    get:
      tags:
        - command_execution_profile
      summary: GET by key for command_execution_profile
      operationId: getbykey_command_execution_profile
      description: Use this operation to get command execution 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 command_execution_profile
          schema: 
              $ref: '#/definitions/getcommand_execution_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:
        - command_execution_profile
      summary: PUT for command_execution_profile
      operationId: putbykey_command_execution_profile
      description: Use this operation to modify command execution 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: command_execution_profile
          description: command_execution_profile object
          schema:
              $ref: '#/definitions/modifycommand_execution_profileRequest'
      responses:
        200:
          description: add for command_execution_profile
          schema: 
              $ref: '#/definitions/modifycommand_execution_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:
        - command_execution_profile
      summary: Delete for command_execution_profile
      operationId: deletebykey_command_execution_profile
      description: Use this operation to delete command execution 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 command_execution_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:
  addcommand_execution_profileRequest:
    type: object
    required:
      - command_execution_profile
    properties:
      command_execution_profile:
        $ref: '#/definitions/command_execution_profile_readwrite'
    title: addcommand_execution_profileRequest
    example:
      command_execution_profile:
        append_errors: "Failed"
        append_output: "Done"
        command_text: "sh script.sh"
        profile_name: "test_profile"

  addcommand_execution_profileResponse:
    type: object
    required:
      - command_execution_profile
    properties:
      command_execution_profile:
        $ref: '#/definitions/command_execution_profile'
    title: addcommand_execution_profileResponse
    example:
      command_execution_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_errors: "Failed"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_output: "Done"
        command_text: "sh script.sh"
        profile_name: "test_profile"

  getcommand_execution_profileResponse:
    type: object
    required:
      - command_execution_profile
    properties:
      command_execution_profile:
        $ref: '#/definitions/command_execution_profile'
    title: getcommand_execution_profileResponse
    example:
      command_execution_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_errors: "Failed"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_output: "Done"
        command_text: "sh script.sh"
        profile_name: "test_profile"

  getcommand_execution_profilesResponse:
    type: object
    required:
      - command_execution_profile
    properties:
      command_execution_profile:
        type: array
        items:
          $ref: '#/definitions/command_execution_profile'
    title: getcommand_execution_profilesResponse
    example:
      command_execution_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_errors: "Failed"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_output: "Done"
        command_text: "sh script.sh"
        profile_name: "test_profile"

  modifycommand_execution_profileRequest:
    type: object
    required:
      - command_execution_profile
    properties:
      command_execution_profile:
        $ref: '#/definitions/command_execution_profile_readwrite'
    title: modifycommand_execution_profileRequest
    example:
      command_execution_profile:
        append_errors: "Failed"
        append_output: "Done"
        command_text: "sh script.sh"
        profile_name: "test_profile"

  modifycommand_execution_profileResponse:
    type: object
    required:
      - command_execution_profile
    properties:
      command_execution_profile:
        $ref: '#/definitions/command_execution_profile'
    title: modifycommand_execution_profileResponse
    example:
      command_execution_profile:
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_errors: "Failed"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        append_output: "Done"
        command_text: "sh script.sh"
        profile_name: "test_profile"

  command_execution_profile_readwrite:
    type: object
    properties:
      append_errors:
        description: "Errors to be appended"
        type: boolean
        format: boolean
      append_output:
        description: "Output to be appended"
        type: boolean
        format: boolean
      command_text:
        description: "Run Command Text"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      profile_name:
        description: "Profile name for the run command setting."
        type: string
        format: string
        minLength: 1
        maxLength: 128

  command_execution_profile:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the run command profile.
            type: string
            format: uuid
      - $ref: '#/definitions/command_execution_profile_readwrite'

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