gce

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gce is a lightweight testable wrapper around GCE compute APIs needed for the gcagent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GCE

type GCE struct {
	// contains filtered or unexported fields
}

GCE is a wrapper for Google Compute Engine services.

func NewGCEClient

func NewGCEClient(ctx context.Context) (*GCE, error)

NewGCEClient creates a new GCE service wrapper.

func (*GCE) GetAddress

func (g *GCE) GetAddress(project, location, name string) (*compute.Address, error)

GetAddress retrieves a GCE Address defined by the project, location, and name provided.

func (*GCE) GetAddressByIP

func (g *GCE) GetAddressByIP(project, region, ip string) (*compute.Address, error)

GetAddressByIP attempts to find a ComputeAddress object with a given IP. The string is assumed to be an exact match, so a full IPv4 address is expected. A region should be supplied, or "" to search for a global address.

func (*GCE) GetDisk

func (g *GCE) GetDisk(project, zone, disk string) (*compute.Disk, error)

GetDisk retrieves a GCE Persistent Disk defined by the project zone and name provided.

func (*GCE) GetFilestoreByIP

func (g *GCE) GetFilestoreByIP(project, location, ip string) (*file.ListInstancesResponse, error)

GetFilestoreByIP attempts to locate a GCE Filestore instance defined by the project, location, and IP Address provided.

func (*GCE) GetFilestoreInstance

func (g *GCE) GetFilestoreInstance(project, location, filestore string) (*file.Instance, error)

GetFilestoreInstance retrieves a GCE Filestore Instance defined by the project, locaiton, and name provided.

func (*GCE) GetForwardingRule

func (g *GCE) GetForwardingRule(project, location, name string) (*compute.ForwardingRule, error)

GetForwardingRule retrieves a GCE Forwarding rule defined by the project, zone, and name provided.

func (*GCE) GetInstance

func (g *GCE) GetInstance(project, zone, instance string) (*compute.Instance, error)

GetInstance retrieves a GCE Instance defined by the project, zone, and name provided.

func (*GCE) GetInstanceByIP

func (g *GCE) GetInstanceByIP(project, ip string) (*compute.Instance, error)

GetInstanceByIP retrieves a GCE Instance defined by the project, and IP provided. May return nil if an instance with the corresponding IP cannot be found.

func (*GCE) GetInstanceGroup

func (g *GCE) GetInstanceGroup(project, zone, name string) (*compute.InstanceGroup, error)

GetInstanceGroup retrieves a GCE Instance Group rule defined by the project, zone, and name provided.

func (*GCE) GetRegionalBackendService

func (g *GCE) GetRegionalBackendService(project, region, service string) (*compute.BackendService, error)

GetRegionalBackendService retrieves a GCE Backend Service defined by the project, region, and name provided.

func (*GCE) GetSecret

func (g *GCE) GetSecret(ctx context.Context, projectID, secretName string) (string, error)

GetSecret accesses the secret manager for the specified project ID and returns the stored password.

func (*GCE) GetURIForIP

func (g *GCE) GetURIForIP(project, ip string) (string, error)

GetURIForIP attempts to locate the URI for any object that is related to the IP address provided.

func (*GCE) ListInstanceGroupInstances

func (g *GCE) ListInstanceGroupInstances(project, zone, name string) (*compute.InstanceGroupsListInstances, error)

ListInstanceGroupInstances retrieves a list of GCE Instances in the Instance group defined by the project, zone, and name provided.

func (*GCE) ListZoneOperations

func (g *GCE) ListZoneOperations(project, zone, filter string, maxResults int64) (*compute.OperationList, error)

ListZoneOperations retrieves a list of Operations resources defined by the project, and zone provided. Results will be filtered according to the provided filter string, and limit the number jof results to maxResults.

type WLM

type WLM struct {
	// contains filtered or unexported fields
}

WLM is a wrapper for Workload Manager API services.

func NewWLMClient

func NewWLMClient(ctx context.Context) (*WLM, error)

NewWLMClient creates a new WLM service wrapper.

func (*WLM) WriteInsight

func (w *WLM) WriteInsight(project string, location string, writeInsightRequest *workloadmanager.WriteInsightRequest) error

WriteInsight wraps a call to the WLM insights:write API.

Directories

Path Synopsis
Package fake provides a fake version of the GCE struct to return canned responses in unit tests.
Package fake provides a fake version of the GCE struct to return canned responses in unit tests.
Package metadataserver performs requests to the metadata server of a GCE instance.
Package metadataserver performs requests to the metadata server of a GCE instance.
Package workloadmanager contains types and functions to interact with the various WorkloadManager cloud APIs.
Package workloadmanager contains types and functions to interact with the various WorkloadManager cloud APIs.

Jump to

Keyboard shortcuts

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