swagger: '2.0'
info:
  description: Configuration for Export report resource.
  version: 'v2'
  title: export_report
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: export_report
    description: Export report
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: file_name
   in: path
   type: string
   description: Report File name.
   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/export_report:
    post:
      tags:
        - export_report
      summary: POST operation for export_report
      operationId: post_export_report
      description: POST operation for export_report
      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: export_report
          description: export_report object
          schema:
              $ref: '#/definitions/addexport_reportRequest'
      responses:
        200:
          description: add for export_report
          schema: 
              $ref: '#/definitions/addexport_reportResponse'
        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/download/export_report/{file_name}:
    get:
      tags:
        - export_report
      summary: Download operation for export_report
      operationId: download_export_report
      description: Use this operation to download exported report
      consumes:
        - application/json
      produces:
        - attachment
      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: path
          name: file_name
          type: string
          required: true
          description: Report File name.
      responses:
        200:
          description: Successful download for export_report
          schema: 
              type: file
              format: binary
        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:
  addexport_reportRequest:
    type: object
    required:
      - export_report
    properties:
      export_report:
        $ref: '#/definitions/export_report_readwrite'
    title: addexport_reportRequest
    example:
      export_report:
        slack_profile_name: "john-slack-profile"
        page_name: "My Test Export"
        recurrence_option: "mon,tue"
        subject: "All VIPs List"
        export_format: "PDF"
        description: "Report of all virtual servers"
        report_title: "All VIPs List"
        mail_profile_name: "john-email"
        recurrence: "Daily"
        tabular_report: "true"
        export_time: "1580927400"
        export_now: "false"
        records_limit: "50000"

  addexport_reportResponse:
    type: object
    required:
      - export_report
    properties:
      export_report:
        $ref: '#/definitions/export_report'
    title: addexport_reportResponse
    example:
      export_report:
        slack_profile_name: "john-slack-profile"
        page_name: "My Test Export"
        recurrence_option: "mon,tue"
        subject: "All VIPs List"
        report_context: "string_value"
        export_format: "PDF"
        description: "Report of all virtual servers"
        report_title: "All VIPs List"
        mail_profile_name: "john-email"
        recurrence: "Daily"
        tz_offset: "0"
        tabular_report: "true"
        file_name: "NetScaler Console Report.pdf"
        csv_export_arr: [{        report_end_time: "number_value"
,        order_by: "string_value"
,        args: "string_value"
,        pageno: "integer_value"
,        report_start_time: "number_value"
,        resource_id: "string_value"
,        asc: "string_value"
,        duration_summary: "string_value"
,        graphql_variable: "string_value"
,        id: "string_value"
,        section_title: "string_value"
,        attrs: "string_value"
,        is_count: "string_value"
,        report_type: "string_value"
,        filter: "string_value"
,        detailview: "string_value"
,        duration: "string_value"
,        graphql_query: "string_value"
,        cr_enabled: "string_value"
,        sla_enabled: "string_value"
,        type: "string_value"
,        resource_name: "string_value"
,        pagesize: "integer_value"
,        csv_mapping_id: "string_value"
}]
        export_time: "1580927400"
        export_now: "false"
        records_limit: "50000"
        feature_origin: "string_value"

  export_report_readwrite:
    type: object
    properties:
      slack_profile_name:
        description: "Slack profile name to send slack notification."
        type: string
        format: string
        maxLength: 255
      page_name:
        description: "Page name."
        type: string
        format: string
        minLength: 1
        maxLength: 255
      recurrence_option:
        description: "Recurrence option (Weekly -> mon - sun, Monthly -> date in DD format)."
        type: string
        format: string
        maxLength: 128
      subject:
        description: "subject"
        type: string
        format: string
        maxLength: 255
      export_format:
        description: "Report Export format (PDF/JPEG/PNG)"
        type: string
        format: string
        minLength: 3
        maxLength: 4
      description:
        description: "Report Description."
        type: string
        format: string
        maxLength: 512
      report_title:
        description: "Report Title"
        type: string
        format: string
        maxLength: 512
      mail_profile_name:
        description: "Mail profile name to send notification mail."
        type: string
        format: string
        maxLength: 255
      recurrence:
        description: "Recurrence (Daily, Weekly, Monthly)."
        type: string
        format: string
        maxLength: 16
      tabular_report:
        description: "Tabular report value true and snapshot report value false."
        type: boolean
        format: boolean
      export_time:
        description: "Report Export time epoch (string representation of 11 digit numbers)."
        type: string
        format: string
        minLength: 10
        maxLength: 16
      export_now:
        description: "Export now"
        type: boolean
        format: boolean
      records_limit:
        description: "Record limit for csv export"
        type: integer
        format: int32

  export_report:
    allOf:
      -
        properties:
          file_name:
            description: Report File name.
            type: string
            format: string
      - $ref: '#/definitions/export_report_readwrite'

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