swagger: '2.0'
info:
  description: Configuration for This collection holds private ip block information. resource.
  version: 'v2'
  title: ip_block
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ip_block
    description: This collection holds private ip block information.
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: id
   in: path
   type: string
   description: Id is IP block 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/ip_block:
    get:
      tags:
        - ip_block
      summary: GET all ip_block
      operationId: getall_ip_block
      description: Use this operation to get ip block
      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 ip_block 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 ip_block 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 ip_block resources.
          enum:
            - yes
      responses:
        200:
          description:  for ip_block
          schema: 
              $ref: '#/definitions/getip_blocksResponse'
        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:
        - ip_block
      summary: POST operation for ip_block
      operationId: post_ip_block
      description: POST operation for ip_block
      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: ip_block
          description: ip_block object
          schema:
              $ref: '#/definitions/addip_blockRequest'
      responses:
        200:
          description: add for ip_block
          schema: 
              $ref: '#/definitions/addip_blockResponse'
        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/ip_block/{id}:
    get:
      tags:
        - ip_block
      summary: GET by key for ip_block
      operationId: getbykey_ip_block
      description: Use this operation to get ip block
      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 ip_block
          schema: 
              $ref: '#/definitions/getip_blockResponse'
        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:
        - ip_block
      summary: PUT for ip_block
      operationId: putbykey_ip_block
      description: Use this operation to modify ip block
      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: ip_block
          description: ip_block object
          schema:
              $ref: '#/definitions/modifyip_blockRequest'
      responses:
        200:
          description: add for ip_block
          schema: 
              $ref: '#/definitions/modifyip_blockResponse'
        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:
        - ip_block
      summary: Delete for ip_block
      operationId: deletebykey_ip_block
      description: Use this operation to delete ip block(s)
      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 ip_block
        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:
  addip_blockRequest:
    type: object
    required:
      - ip_block
    properties:
      ip_block:
        $ref: '#/definitions/ip_block_readwrite'
    title: addip_blockRequest
    example:
      ip_block:
        longitude: "-117.99"
        region_code: "CA"
        end_ip_num: "168430335"
        country_code: "IN"
        name: "test_ipblock1"
        description: "IP blocks for California datacenter"
        city: "California City"
        latitude: "35.15"
        start_ip_num: "168430081"
        custom_city: "false"
        custom_country: "false"
        country: "United Stats"
        end_ip: "1.1.1.5"
        start_ip: "1.1.1.1"
        custom_region: "false"
        region: "California"

  addip_blockResponse:
    type: object
    required:
      - ip_block
    properties:
      ip_block:
        $ref: '#/definitions/ip_block'
    title: addip_blockResponse
    example:
      ip_block:
        longitude: "-117.99"
        region_code: "CA"
        end_ip_num: "168430335"
        country_code: "IN"
        name: "test_ipblock1"
        description: "IP blocks for California datacenter"
        tenant_id: "7ed7946f-4af7-11e9-99d2-b6fe81a85d18"
        city: "California City"
        latitude: "35.15"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        start_ip_num: "168430081"
        custom_city: "false"
        custom_country: "false"
        country: "United Stats"
        end_ip: "1.1.1.5"
        start_ip: "1.1.1.1"
        custom_region: "false"
        region: "California"

  getip_blockResponse:
    type: object
    required:
      - ip_block
    properties:
      ip_block:
        $ref: '#/definitions/ip_block'
    title: getip_blockResponse
    example:
      ip_block:
        longitude: "-117.99"
        region_code: "CA"
        end_ip_num: "168430335"
        country_code: "IN"
        name: "test_ipblock1"
        description: "IP blocks for California datacenter"
        tenant_id: "7ed7946f-4af7-11e9-99d2-b6fe81a85d18"
        city: "California City"
        latitude: "35.15"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        start_ip_num: "168430081"
        custom_city: "false"
        custom_country: "false"
        country: "United Stats"
        end_ip: "1.1.1.5"
        start_ip: "1.1.1.1"
        custom_region: "false"
        region: "California"

  getip_blocksResponse:
    type: object
    required:
      - ip_block
    properties:
      ip_block:
        type: array
        items:
          $ref: '#/definitions/ip_block'
    title: getip_blocksResponse
    example:
      ip_block:
        longitude: "-117.99"
        region_code: "CA"
        end_ip_num: "168430335"
        country_code: "IN"
        name: "test_ipblock1"
        description: "IP blocks for California datacenter"
        tenant_id: "7ed7946f-4af7-11e9-99d2-b6fe81a85d18"
        city: "California City"
        latitude: "35.15"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        start_ip_num: "168430081"
        custom_city: "false"
        custom_country: "false"
        country: "United Stats"
        end_ip: "1.1.1.5"
        start_ip: "1.1.1.1"
        custom_region: "false"
        region: "California"

  modifyip_blockRequest:
    type: object
    required:
      - ip_block
    properties:
      ip_block:
        $ref: '#/definitions/ip_block_readwrite'
    title: modifyip_blockRequest
    example:
      ip_block:
        longitude: "-117.99"
        region_code: "CA"
        end_ip_num: "168430335"
        country_code: "IN"
        name: "test_ipblock1"
        description: "IP blocks for California datacenter"
        city: "California City"
        latitude: "35.15"
        start_ip_num: "168430081"
        custom_city: "false"
        custom_country: "false"
        country: "United Stats"
        end_ip: "1.1.1.5"
        start_ip: "1.1.1.1"
        custom_region: "false"
        region: "California"

  modifyip_blockResponse:
    type: object
    required:
      - ip_block
    properties:
      ip_block:
        $ref: '#/definitions/ip_block'
    title: modifyip_blockResponse
    example:
      ip_block:
        longitude: "-117.99"
        region_code: "CA"
        end_ip_num: "168430335"
        country_code: "IN"
        name: "test_ipblock1"
        description: "IP blocks for California datacenter"
        tenant_id: "7ed7946f-4af7-11e9-99d2-b6fe81a85d18"
        city: "California City"
        latitude: "35.15"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        start_ip_num: "168430081"
        custom_city: "false"
        custom_country: "false"
        country: "United Stats"
        end_ip: "1.1.1.5"
        start_ip: "1.1.1.1"
        custom_region: "false"
        region: "California"

  ip_block_readwrite:
    type: object
    properties:
      longitude:
        description: "longitude"
        type: number
        format: double
      region_code:
        description: "region_code"
        type: string
        format: string
        maxLength: 16
      end_ip_num:
        description: "end_ip_num"
        type: number
        format: double
      country_code:
        description: "country_code"
        type: string
        format: string
        maxLength: 256
      name:
        description: "name"
        type: string
        format: string
        minLength: 1
        maxLength: 256
      description:
        description: "Description about Ip Block"
        type: string
        format: string
        maxLength: 256
      city:
        description: "city"
        type: string
        format: string
        maxLength: 256
      latitude:
        description: "latitude"
        type: number
        format: double
      start_ip_num:
        description: "start_ip_num"
        type: number
        format: double
      custom_city:
        description: "custom_city"
        type: boolean
        format: boolean
      custom_country:
        description: "custom_country"
        type: boolean
        format: boolean
      country:
        description: "country"
        type: string
        format: string
        maxLength: 256
      end_ip:
        description: "end_ip"
        type: string
        format: ipaddress
      start_ip:
        description: "start_ip"
        type: string
        format: ipaddress
      custom_region:
        description: "custom_region"
        type: boolean
        format: boolean
      region:
        description: "region"
        type: string
        format: string
        maxLength: 256

  ip_block:
    allOf:
      -
        properties:
          id:
            description: Id is IP block name
            type: string
            format: uuid
          tenant_id:
             description: "Tenant Id"
             type: string
             format: uuid
             maxLength: 255
      - $ref: '#/definitions/ip_block_readwrite'

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