openapi: 3.0.0
info:
  contact:
    name: VMware
  description: Interconnecxt APIs.
  license:
    name: Copyright (c) 2016-2017 VMware, Inc. All rights reserved.
  termsOfService: https://hcx.vmware.com/terms-and-conditions
  title: Interconnecxt APIs.
  version: "1.0"
servers:
- url: https://{server}/hybridity/api/interconnect
  variables:
    server:
      default: api.example.com
      description: server host name
tags:
- description: Interconnect Apis
  name: ComputeProfiles
paths:
  /computeProfiles:
    get:
      description: List compute profiles
      operationId: getComputeProfiles
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfileListResponse'
          description: Accepted
        401:
          description: Unauthorized
        403:
          description: Forbidden
        500:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal Server Error
      summary: List compute profiles
      tags:
      - ComputeProfiles
    post:
      description: Create new compute profile
      operationId: createComputeProfile
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/computeProfile'
        description: Compute Profile object.
        required: true
      responses:
        202:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Accepted
        401:
          description: Unauthorized
        403:
          description: Forbidden
        422:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Unprocessable Entity
        400:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Bad Request
        500:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal Server Error
      summary: Create new compute profile
      tags:
      - ComputeProfiles
  /computeProfiles/query:
    post:
      description: Query compute profiles
      operationId: queryComputeProfiles
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/computeProfileFilter'
        description: Filter object.
        required: true
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfileListResponse'
          description: Accepted
        401:
          description: Unauthorized
        403:
          description: Forbidden
        400:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Bad Request
        500:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal Server Error
      summary: Query compute profiles
      tags:
      - ComputeProfiles
  /computeProfiles/preview:
    post:
      description: Provides a preview of firewall rules for a compute profile not
        yet created. Tomorrow preview may provide other functionality/validations.
      operationId: previewComputeProfile
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/computeProfile'
        description: Preview Compute Profiles.
        required: true
      responses:
        202:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Accepted
        401:
          description: Unauthorized
        403:
          description: Forbidden
        422:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Unprocessable Entity
      summary: Provides a preview of firewall rules for a compute profile not yet
        created.
      tags:
      - ComputeProfiles
  /computeProfiles/{computeProfileId}:
    delete:
      description: Delete a compute profile by id.
      operationId: deleteComputeProfile
      parameters:
      - description: Compute Profile ID
        explode: false
        in: path
        name: computeProfileId
        required: true
        schema:
          type: string
        style: simple
      responses:
        202:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Accepted
        400:
          description: Bad Request
        401:
          description: Unauthorized
        403:
          description: Forbidden
        404:
          description: Not Found
        500:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal Server Error
      summary: Delete a compute profile by id.
      tags:
      - ComputeProfiles
    get:
      description: Get a compute profile.
      operationId: getComputeProfile
      parameters:
      - description: Compute Profile ID
        explode: false
        in: path
        name: computeProfileId
        required: true
        schema:
          type: string
        style: simple
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfileGetResponse'
          description: Accepted
        404:
          description: Not Found
        401:
          description: Unauthorized
        403:
          description: Forbidden
        500:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal Server Error
      summary: Gets a Compute Profile by ID.
      tags:
      - ComputeProfiles
    put:
      description: Modify a compute profile with config. The behavior is same as create
        operation.
      operationId: modifyComputeProfile
      parameters:
      - description: Compute Profile ID
        explode: false
        in: path
        name: computeProfileId
        required: true
        schema:
          type: string
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/computeProfile'
        description: Compute Profile as request body.
        required: true
      responses:
        202:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Accepted
        401:
          description: Unauthorized
        403:
          description: Forbidden
        404:
          description: Not Found
        422:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Unprocessable Entity
        500:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal Server Error
      summary: Update compute profile.
      tags:
      - ComputeProfiles
  /computeProfiles/{computeProfileId}/preview:
    post:
      description: Provides a preview of firewall rules for an existing compute profile.
      operationId: previewComputeProfileById
      parameters:
      - description: Compute Profile ID
        explode: false
        in: path
        name: computeProfileId
        required: true
        schema:
          type: string
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/computeProfile'
        description: Compute Profile as body.
        required: false
      responses:
        202:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Accepted
        400:
          description: Bad Request
        401:
          description: Unauthorized
        403:
          description: Forbidden
        404:
          description: Not Found
        422:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/computeProfilePostResponse'
          description: Unprocessable Entity
        500:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal Server Error
      summary: Preview a compute profile with config.
      tags:
      - ComputeProfiles
components:
  schemas:
    computeProfile:
      properties:
        computeProfileId:
          type: string
        name:
          type: string
        location:
          type: string
        locationName:
          type: string
        state:
          type: string
        deploymentComputeClusterName:
          type: string
        deploymentComputeClusterId:
          type: string
        compute:
          items:
            $ref: '#/components/schemas/compute'
          minItems: 1
          type: array
        services:
          items:
            $ref: '#/components/schemas/service'
          minItems: 1
          type: array
        deploymentContainer:
          $ref: '#/components/schemas/deploymentContainer'
        networks:
          items:
            $ref: '#/components/schemas/network'
          minItems: 1
          type: array
        switches:
          items:
            $ref: '#/components/schemas/switch'
          type: array
        storage:
          items:
            $ref: '#/components/schemas/storage'
          minItems: 0
          type: array
      required:
      - compute
      - deploymentContainer
      - name
      - networks
      - services
      type: object
    errorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/error'
          type: array
      type: object
    computeProfileFilter:
      properties:
        filter:
          $ref: '#/components/schemas/computeProfileFilter_filter'
      type: object
    computeProfileGetResponse:
      allOf:
      - $ref: '#/components/schemas/computeProfile'
      - properties:
          lastTaskDetails:
            properties:
              interconnectTaskId:
                type: string
              type:
                type: string
              status:
                type: string
            type: object
        type: object
    computeProfileListResponse:
      example:
        items:
        - null
        - null
      properties:
        items:
          items:
            $ref: '#/components/schemas/computeProfileGetResponse'
          type: array
      type: object
    computeProfilePostResponse:
      example:
        data:
          computeProfileId: computeProfileId
          interconnectTaskId: interconnectTaskId
        warnings:
        - message: message
        - message: message
        errors:
        - code: code
          message: message
        - code: code
          message: message
      properties:
        data:
          $ref: '#/components/schemas/computeProfilePostResponse_data'
        warnings:
          items:
            $ref: '#/components/schemas/warning'
          type: array
        errors:
          items:
            $ref: '#/components/schemas/error'
          type: array
      type: object
    compute:
      properties:
        cmpId:
          type: string
        cmpName:
          type: string
        cmpType:
          type: string
        type:
          type: string
        id:
          type: string
        name:
          type: string
      required:
      - cmpId
      - id
      - type
      type: object
    service:
      properties:
        name:
          type: string
      required:
      - name
      type: object
    deploymentContainer:
      properties:
        compute:
          items:
            $ref: '#/components/schemas/compute'
          minItems: 1
          type: array
        storage:
          items:
            $ref: '#/components/schemas/storage'
          minItems: 1
          type: array
      type: object
    storage:
      additionalProperties: false
      properties:
        cmpId:
          type: string
        cmpName:
          type: string
        cmpType:
          type: string
        type:
          type: string
        id:
          type: string
        name:
          type: string
      required:
      - cmpId
      - id
      - type
      type: object
    network:
      properties:
        id:
          type: string
        name:
          type: string
        tags:
          items:
            enum:
            - management
            - vmotion
            - replication
            - guest
            - uplink
            type: string
          minItems: 1
          type: array
        staticRoutes:
          items:
            $ref: '#/components/schemas/networkStaticRoute'
          type: array
      required:
      - id
      - tags
      type: object
    networkStaticRoute:
      properties:
        network:
          type: string
        nextHop:
          type: string
      required:
      - network
      - nextHop
      type: object
    switch:
      additionalProperties: false
      properties:
        cmpId:
          type: string
        id:
          type: string
        type:
          type: string
        name:
          type: string
        maxMtu:
          type: number
        l2cApplianceCount:
          type: number
        host:
          $ref: '#/components/schemas/switchHost'
      required:
      - cmpId
      - id
      - type
      type: object
    switchHost:
      additionalProperties: false
      properties:
        id:
          type: string
        name:
          type: string
      required:
      - id
      type: object
    error:
      example:
        code: code
        message: message
      properties:
        code:
          type: string
        message:
          type: string
      type: object
    warning:
      example:
        message: message
      properties:
        message:
          type: string
      type: object
    computeProfileFilter_filter:
      properties:
        name:
          type: string
        computeProfileId:
          type: string
    computeProfilePostResponse_data:
      example:
        computeProfileId: computeProfileId
        interconnectTaskId: interconnectTaskId
      properties:
        interconnectTaskId:
          type: string
        computeProfileId:
          type: string
  securitySchemes:
    x-hm-authorization:
      description: Obtained from /hybridity/api/session
      in: header
      name: x-hm-authorization
      type: apiKey
