gcloud

package
v1.50.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputeMetadata

type ComputeMetadata struct {
	Project  ProjectMetadata  `json:"project"`
	Instance InstanceMetadata `json:"instance"`
}

ComputeMetadata represents Google Cloud project metadata returned by /computeMetadata/v1 endpoint.

See https://cloud.google.com/compute/docs/storing-retrieving-metadata for further details.

type ComputeMetadataProvider

type ComputeMetadataProvider struct {
	Endpoint string
	// contains filtered or unexported fields
}

ComputeMetadataProvider retireves Google Cloud service compute metadata from provided endpoint

func NewComputeMetadataProvider

func NewComputeMetadataProvider(endpoint string, c *http.Client) *ComputeMetadataProvider

NewComputeMetadataProvider initializes a new ComputeMetadataClient with given endpoint and HTTP client. If there is no HTTP client provided, the provider will use http.DefaultClient

func (*ComputeMetadataProvider) ComputeMetadata

func (p *ComputeMetadataProvider) ComputeMetadata(ctx context.Context) (ComputeMetadata, error)

ComputeMetadata returns compute metadata for current instance

type InstanceMetadata

type InstanceMetadata struct {
	ID     string `json:"id"`
	Region string `json:"region"`
}

InstanceMetadata represents Google Cloud project metadata returned by /computeMetadata/v1/instance endpoint.

See https://cloud.google.com/compute/docs/storing-retrieving-metadata for further details.

type ProjectMetadata

type ProjectMetadata struct {
	ProjectID        string `json:"projectId"`
	NumericProjectID int    `json:"numericProjectId"`
}

ProjectMetadata represents Google Cloud project metadata returned by /computeMetadata/v1/project endpoint.

See https://cloud.google.com/compute/docs/storing-retrieving-metadata for further details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL