swagger: '2.0'
info:
  description: Configuration for Config Advice resource.
  version: 'v2'
  title: config_advice
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: config_advice
    description: Config Advice
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: id
   in: path
   type: string
   description: System generated key
   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:
  /masvc/{customerid}/nitro/v2/config/config_advice/{id}:
    post:
      tags:
        - config_advice
      summary: POST operation with actions for config_advice
      operationId: post_config_advice_actions
      description: POST operation with actions for config_advice
      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: query
          name: action
          type: string
          required: true
          enum: [custom]
          description: >
            actions:
              * `custom` - Use this operation to apply selected commands on the device

        - in: body
          name: config_advice
          description: config_advice object
          schema:
              $ref: '#/definitions/addconfig_adviceRequest'
      responses:
        200:
          description: custom for config_advice
          schema: 
              $ref: '#/definitions/addconfig_adviceResponse'
        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:
  addconfig_adviceRequest:
    type: object
    required:
      - config_advice
    properties:
      config_advice:
        $ref: '#/definitions/config_advice_readwrite'
    title: addconfig_adviceRequest
    example:
      config_advice:
        is_xendesktop: "false"
        output_file: "corrective_command.conf"
        is_pci: "false"
        config_advice_results: [{        modification_status_message: "string_value"
,        issue: "string_value"
,        modification_status: "boolean_value"
,        corrective_command: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        advice: "string_value"
}]
        ip_address: "1.1.1.1"
        command: "add dns nameserver"

  addconfig_adviceResponse:
    type: object
    required:
      - config_advice
    properties:
      config_advice:
        $ref: '#/definitions/config_advice'
    title: addconfig_adviceResponse
    example:
      config_advice:
        is_xendesktop: "false"
        output_file: "corrective_command.conf"
        is_pci: "false"
        config_advice_results: [{        parent_name: "string_value"
,        modification_status_message: "string_value"
,        issue: "string_value"
,        parent_id: "string_value"
,        modification_status: "boolean_value"
,        corrective_command: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        advice: "string_value"
}]
        ip_address: "1.1.1.1"
        id: "38f867d1-3d10-4bfa-8498-604a57e67bc4"
        command: "add dns nameserver"

  config_advice_readwrite:
    type: object
    properties:
      is_xendesktop:
        description: "Enables search for Xen Desktop properties "
        type: boolean
        format: boolean
      output_file:
        description: "File Path"
        type: string
        format: string
      is_pci:
        description: "Enables search for PCI properties"
        type: boolean
        format: boolean
      config_advice_results:
        type: array
        items:
          $ref: '#/definitions/config_advice_result_readwrite'
      ip_address:
        description: "IP Address"
        type: string
        format: ipaddress
      command:
        description: "Commands"
        type: string
        format: string

  config_advice:
    allOf:
      -
        properties:
          id:
            description: System generated key
            type: string
            format: uuid
      - $ref: '#/definitions/config_advice_readwrite'

  config_advice_result_readwrite:
    type: object
    properties:
      modification_status_message:
        description: "Command Deployment message"
        type: string
        format: string
      issue:
        description: "Issue"
        type: string
        format: string
      modification_status:
        description: "Command Deployment Status"
        type: boolean
        format: boolean
      corrective_command:
        description: "Command"
        type: string
        format: string
        maxLength: 256
      category:
        description: "Category"
        type: string
        format: string
      severity:
        description: "Severity"
        type: string
        format: string
      advice:
        description: "Advice"
        type: string
        format: string

  config_advice_result:
    allOf:
      -
        properties:
          id:
            description: System generated key
            type: string
            format: uuid
      - $ref: '#/definitions/config_advice_result_readwrite'

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