api: google.golang.org/api/compute/v0.beta Index | Files

package compute

import "google.golang.org/api/compute/v0.beta"

Package compute provides access to the Compute Engine API.

For product documentation, see: https://developers.google.com/compute/docs/reference/latest/

Creating a client

Usage example:

import "google.golang.org/api/compute/v0.beta"
...
ctx := context.Background()
computeService, err := compute.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:

computeService, err := compute.NewService(ctx, option.WithScopes(compute.DevstorageReadWriteScope))

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

computeService, err := compute.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
computeService, err := compute.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index

Package Files

compute-gen.go

Constants

const (
    // View and manage your data across Google Cloud Platform services
    CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"

    // View and manage your Google Compute Engine resources
    ComputeScope = "https://www.googleapis.com/auth/compute"

    // View your Google Compute Engine resources
    ComputeReadonlyScope = "https://www.googleapis.com/auth/compute.readonly"

    // Manage your data and permissions in Google Cloud Storage
    DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"

    // View your data in Google Cloud Storage
    DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"

    // Manage your data in Google Cloud Storage
    DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
)

OAuth2 scopes used by this API.

type AcceleratorConfig Uses

type AcceleratorConfig struct {
    // AcceleratorCount: The number of the guest accelerator cards exposed
    // to this instance.
    AcceleratorCount int64 `json:"acceleratorCount,omitempty"`

    // AcceleratorType: Full or partial URL of the accelerator type resource
    // to attach to this instance. For example:
    // projects/my-project/zones/us-central1-c/acceleratorTypes/nvidia-tesla-
    // p100 If you are creating an instance template, specify only the
    // accelerator name. See GPUs on Compute Engine for a full list of
    // accelerator types.
    AcceleratorType string `json:"acceleratorType,omitempty"`

    // ForceSendFields is a list of field names (e.g. "AcceleratorCount") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "AcceleratorCount") to
    // include in API requests with the JSON null value. By default, fields
    // with empty values are omitted from API requests. However, any field
    // with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

AcceleratorConfig: A specification of the type and number of accelerator cards attached to the instance.

func (*AcceleratorConfig) MarshalJSON Uses

func (s *AcceleratorConfig) MarshalJSON() ([]byte, error)

type AcceleratorType Uses

type AcceleratorType struct {
    // CreationTimestamp: [Output Only] Creation timestamp in RFC3339 text
    // format.
    CreationTimestamp string `json:"creationTimestamp,omitempty"`

    // Deprecated: [Output Only] The deprecation status associated with this
    // accelerator type.
    Deprecated *DeprecationStatus `json:"deprecated,omitempty"`

    // Description: [Output Only] An optional textual description of the
    // resource.
    Description string `json:"description,omitempty"`

    // Id: [Output Only] The unique identifier for the resource. This
    // identifier is defined by the server.
    Id  uint64 `json:"id,omitempty,string"`

    // Kind: [Output Only] The type of the resource. Always
    // compute#acceleratorType for accelerator types.
    Kind string `json:"kind,omitempty"`

    // MaximumCardsPerInstance: [Output Only] Maximum accelerator cards
    // allowed per instance.
    MaximumCardsPerInstance int64 `json:"maximumCardsPerInstance,omitempty"`

    // Name: [Output Only] Name of the resource.
    Name string `json:"name,omitempty"`

    // SelfLink: [Output Only] Server-defined fully-qualified URL for this
    // resource.
    SelfLink string `json:"selfLink,omitempty"`

    // Zone: [Output Only] The name of the zone where the accelerator type
    // resides, such as us-central1-a. You must specify this field as part
    // of the HTTP request URL. It is not settable as a field in the request
    // body.
    Zone string `json:"zone,omitempty"`

    // ServerResponse contains the HTTP response code and headers from the
    // server.
    googleapi.ServerResponse `json:"-"`

    // ForceSendFields is a list of field names (e.g. "CreationTimestamp")
    // to unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "CreationTimestamp") to
    // include in API requests with the JSON null value. By default, fields
    // with empty values are omitted from API requests. However, any field
    // with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

AcceleratorType: Represents an Accelerato