Google Cloud Platform APIs Instances API

Virtual machine instances

Documentation

Specifications

Other Resources

OpenAPI Specification

gcp-instances-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Google Cloud Compute Engine Disks Instances API
  description: 'REST API for managing virtual machines, disks, networking, load balancing,

    and related Compute Engine resources on Google Cloud Platform. This spec

    covers a representative subset of v1 resources. Full canonical machine

    spec is the Google Discovery Document at

    https://compute.googleapis.com/$discovery/rest?version=v1.

    '
  version: v1
  contact:
    name: Google Cloud Compute Engine Documentation
    url: https://cloud.google.com/compute/docs/reference/rest/v1
servers:
- url: https://compute.googleapis.com/compute/v1
  description: Production
security:
- oauth2:
  - https://www.googleapis.com/auth/compute
  - https://www.googleapis.com/auth/cloud-platform
- bearerAuth: []
tags:
- name: Instances
  description: Virtual machine instances
paths:
  /projects/{project}/zones/{zone}/instances:
    parameters:
    - $ref: '#/components/parameters/Project'
    - $ref: '#/components/parameters/Zone'
    get:
      tags:
      - Instances
      summary: List instances
      operationId: listInstances
      parameters:
      - $ref: '#/components/parameters/Filter'
      - $ref: '#/components/parameters/MaxResults'
      - $ref: '#/components/parameters/PageToken'
      - $ref: '#/components/parameters/OrderBy'
      responses:
        '200':
          description: Instance list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstanceList'
    post:
      tags:
      - Instances
      summary: Create an instance
      operationId: insertInstance
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Instance'
      responses:
        '200':
          description: Operation accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Operation'
  /projects/{project}/zones/{zone}/instances/{instance}:
    parameters:
    - $ref: '#/components/parameters/Project'
    - $ref: '#/components/parameters/Zone'
    - $ref: '#/components/parameters/InstanceName'
    get:
      tags:
      - Instances
      summary: Get an instance
      operationId: getInstance
      responses:
        '200':
          description: Instance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Instance'
    delete:
      tags:
      - Instances
      summary: Delete an instance
      operationId: deleteInstance
      responses:
        '200':
          description: Operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Operation'
  /projects/{project}/zones/{zone}/instances/{instance}/start:
    parameters:
    - $ref: '#/components/parameters/Project'
    - $ref: '#/components/parameters/Zone'
    - $ref: '#/components/parameters/InstanceName'
    post:
      tags:
      - Instances
      summary: Start an instance
      operationId: startInstance
      responses:
        '200':
          description: Operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Operation'
  /projects/{project}/zones/{zone}/instances/{instance}/stop:
    parameters:
    - $ref: '#/components/parameters/Project'
    - $ref: '#/components/parameters/Zone'
    - $ref: '#/components/parameters/InstanceName'
    post:
      tags:
      - Instances
      summary: Stop an instance
      operationId: stopInstance
      responses:
        '200':
          description: Operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Operation'
  /projects/{project}/zones/{zone}/instances/{instance}/reset:
    parameters:
    - $ref: '#/components/parameters/Project'
    - $ref: '#/components/parameters/Zone'
    - $ref: '#/components/parameters/InstanceName'
    post:
      tags:
      - Instances
      summary: Reset an instance
      operationId: resetInstance
      responses:
        '200':
          description: Operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Operation'
components:
  parameters:
    PageToken:
      name: pageToken
      in: query
      schema:
        type: string
    OrderBy:
      name: orderBy
      in: query
      schema:
        type: string
    InstanceName:
      name: instance
      in: path
      required: true
      schema:
        type: string
    MaxResults:
      name: maxResults
      in: query
      schema:
        type: integer
        default: 500
    Project:
      name: project
      in: path
      required: true
      description: Project ID
      schema:
        type: string
    Zone:
      name: zone
      in: path
      required: true
      description: Zone name (e.g. us-central1-a)
      schema:
        type: string
    Filter:
      name: filter
      in: query
      schema:
        type: string
  schemas:
    InstanceList:
      type: object
      properties:
        kind:
          type: string
        id:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/Instance'
        nextPageToken:
          type: string
        selfLink:
          type: string
    Operation:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        operationType:
          type: string
        targetLink:
          type: string
        status:
          type: string
          enum:
          - PENDING
          - RUNNING
          - DONE
        progress:
          type: integer
        startTime:
          type: string
          format: date-time
        endTime:
          type: string
          format: date-time
        error:
          type: object
    Instance:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        machineType:
          type: string
        status:
          type: string
          enum:
          - PROVISIONING
          - STAGING
          - RUNNING
          - STOPPING
          - STOPPED
          - SUSPENDING
          - SUSPENDED
          - TERMINATED
        zone:
          type: string
        networkInterfaces:
          type: array
          items:
            type: object
        disks:
          type: array
          items:
            type: object
        metadata:
          type: object
        labels:
          type: object
        creationTimestamp:
          type: string
          format: date-time
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/v2/auth
          tokenUrl: https://oauth2.googleapis.com/token
          scopes:
            https://www.googleapis.com/auth/compute: Manage Compute Engine resources
            https://www.googleapis.com/auth/cloud-platform: View and manage all Google Cloud resources
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT