swagger: '2.0'
info:
  description: Configuration for NetScaler Console License Information resource.
  version: 'v2'
  title: mas_service_license
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: mas_service_license
    description: NetScaler Console License Information
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
   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/mas_service_license:
    get:
      tags:
        - mas_service_license
      summary: GET all mas_service_license
      operationId: getall_mas_service_license
      description: Use this operation to get NetScaler Console license information
      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 mas_service_license 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 mas_service_license 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 mas_service_license resources.
          enum:
            - yes
      responses:
        200:
          description:  for mas_service_license
          schema: 
              $ref: '#/definitions/getmas_service_licensesResponse'
        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/mas_service_license/{id}:
    get:
      tags:
        - mas_service_license
      summary: GET by key for mas_service_license
      operationId: getbykey_mas_service_license
      description: Use this operation to get NetScaler Console license information
      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:  for mas_service_license
          schema: 
              $ref: '#/definitions/getmas_service_licenseResponse'
        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:
        - mas_service_license
      summary: PUT for mas_service_license
      operationId: putbykey_mas_service_license
      description: Use this operation to enable/disable NetScaler Console system features
      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: mas_service_license
          description: mas_service_license object
          schema:
              $ref: '#/definitions/modifymas_service_licenseRequest'
      responses:
        200:
          description:  for mas_service_license
          schema: 
              $ref: '#/definitions/modifymas_service_licenseResponse'
        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:
  getmas_service_licenseResponse:
    type: object
    required:
      - mas_service_license
    properties:
      mas_service_license:
        $ref: '#/definitions/mas_service_license'
    title: getmas_service_licenseResponse
    example:
      mas_service_license:
        entitlement_id: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        end_time: "1605863777"
        customer_id: "ua2b1500qdur"
        serial_numbers: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        id: "d59372be-3396-4c84-89ea-ddf25e0536cd"
        start_date: "2019-08-19T06:52:44.227Z"
        entitlement_type: "Production"
        lic_type: "1"
        max_vips: "10"
        quantity: "0"
        start_time: "1605863777"
        max_storage: "0"
        approved: "true"
        product_sku: "000000000013677XXX"
        end_date: "2019-08-19T06:52:44.227Z"
        max_tp_vservers: "10"
        days_to_expire: "287"
        total_allowed_tp_vips: "10"
        total_allowed_vips: "10"
        entitled_db_storage: "25"

  getmas_service_licensesResponse:
    type: object
    required:
      - mas_service_license
    properties:
      mas_service_license:
        type: array
        items:
          $ref: '#/definitions/mas_service_license'
    title: getmas_service_licensesResponse
    example:
      mas_service_license:
        entitlement_id: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        end_time: "1605863777"
        customer_id: "ua2b1500qdur"
        serial_numbers: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        id: "d59372be-3396-4c84-89ea-ddf25e0536cd"
        start_date: "2019-08-19T06:52:44.227Z"
        entitlement_type: "Production"
        lic_type: "1"
        max_vips: "10"
        quantity: "0"
        start_time: "1605863777"
        max_storage: "0"
        approved: "true"
        product_sku: "000000000013677XXX"
        end_date: "2019-08-19T06:52:44.227Z"
        max_tp_vservers: "10"
        days_to_expire: "287"
        total_allowed_tp_vips: "10"
        total_allowed_vips: "10"
        entitled_db_storage: "25"

  modifymas_service_licenseRequest:
    type: object
    required:
      - mas_service_license
    properties:
      mas_service_license:
        $ref: '#/definitions/mas_service_license_readwrite'
    title: modifymas_service_licenseRequest
    example:
      mas_service_license:
        entitlement_id: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        end_time: "1605863777"
        customer_id: "ua2b1500qdur"
        serial_numbers: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        start_date: "2019-08-19T06:52:44.227Z"
        entitlement_type: "Production"
        lic_type: "1"
        quantity: "0"
        start_time: "1605863777"
        approved: "true"
        product_sku: "000000000013677XXX"
        end_date: "2019-08-19T06:52:44.227Z"

  modifymas_service_licenseResponse:
    type: object
    required:
      - mas_service_license
    properties:
      mas_service_license:
        $ref: '#/definitions/mas_service_license'
    title: modifymas_service_licenseResponse
    example:
      mas_service_license:
        entitlement_id: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        end_time: "1605863777"
        customer_id: "ua2b1500qdur"
        serial_numbers: "ee655f3e-5d5d-4e89-80fb-d154fd422aeb"
        id: "d59372be-3396-4c84-89ea-ddf25e0536cd"
        start_date: "2019-08-19T06:52:44.227Z"
        entitlement_type: "Production"
        lic_type: "1"
        max_vips: "10"
        quantity: "0"
        start_time: "1605863777"
        max_storage: "0"
        approved: "true"
        product_sku: "000000000013677XXX"
        end_date: "2019-08-19T06:52:44.227Z"
        max_tp_vservers: "10"
        days_to_expire: "287"
        total_allowed_tp_vips: "10"
        total_allowed_vips: "10"
        entitled_db_storage: "25"

  mas_service_license_readwrite:
    type: object
    properties:
      entitlement_id:
        description: "Entitlement Id for the license file"
        type: string
        format: uuid
      end_time:
        description: "License expires at this timestamp"
        type: number
        format: int64
      customer_id:
        description: "Customer Id for the tenant who has purchased the license"
        type: string
        format: string
      serial_numbers:
        description: "SerialNumbers"
        type: string
        format: uuid
      start_date:
        description: "Start date of license subscription"
        type: string
        format: date-time
      entitlement_type:
        description: "Entitlement Type eg. ProductionTrial"
        type: string
        format: string
      lic_type:
        description: "0 = Trial Period, 1 = Licensed, 2 = Grace period, 3 = Unlicensed, 4 = Canceled"
        type: integer
        format: int32
      quantity:
        description: "Number of Licenses of the type purchased"
        type: string
        format: password
      start_time:
        description: "License validity starts from this timestamp"
        type: number
        format: int64
      approved:
        description: "Approved"
        type: boolean
        format: boolean
      product_sku:
        description: "Product SKU of the License which specifies the type of license : VIPs, Storage or ThirdParty VIPS"
        type: string
        format: string
      end_date:
        description: "Expiry date of license subscription"
        type: string
        format: date-time

  mas_service_license:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key
            type: string
            format: uuid
          max_vips:
             description: "Maximum VIPs"
             type: string
             format: password
          max_storage:
             description: "Maximum Storage for the license in GB"
             type: string
             format: password
          max_tp_vservers:
             description: "Maximum Third Party Vservers"
             type: string
             format: password
          days_to_expire:
             description: "Days to expire"
             type: integer
             format: int32
          total_allowed_tp_vips:
             description: "Total Allowed Third Party Vservres"
             type: integer
             format: int32
          total_allowed_vips:
             description: "Total Allowed VIPs"
             type: integer
             format: int32
          entitled_db_storage:
             description: "Total entitled DB storage"
             type: number
             format: double
      - $ref: '#/definitions/mas_service_license_readwrite'

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