build: golang.org/x/build/internal/cloud Index | Files

package cloud

import "golang.org/x/build/internal/cloud"

Index

Package Files

aws.go fake_aws.go

Constants

const (
    // QuotaCodeCPUOnDemand is the quota code for on-demand CPUs.
    QuotaCodeCPUOnDemand = "L-1216C47A"
    // QuotaServiceEC2 is the service code for the EC2 service.
    QuotaServiceEC2 = "ec2"
)

type AWSClient Uses

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

AWSClient is a client for AWS services.

func NewAWSClient Uses

func NewAWSClient(region, keyID, accessKey string) (*AWSClient, error)

NewAWSClient creates a new AWS client.

func (*AWSClient) CreateInstance Uses

func (ac *AWSClient) CreateInstance(ctx context.Context, config *EC2VMConfiguration) (*Instance, error)

CreateInstance creates an EC2 VM instance.

func (*AWSClient) DestroyInstances Uses

func (ac *AWSClient) DestroyInstances(ctx context.Context, instIDs ...string) error

DestroyInstances terminates EC2 VM instances.

func (*AWSClient) Instance Uses

func (ac *AWSClient) Instance(ctx context.Context, instID string) (*Instance, error)

Instance retrieves an EC2 instance by instance ID.

func (*AWSClient) InstanceTypesARM Uses

func (ac *AWSClient) InstanceTypesARM(ctx context.Context) ([]*InstanceType, error)

InstanceTypesARM retrieves all EC2 instance types in a region which support the ARM64 architecture.

func (*AWSClient) Quota Uses

func (ac *AWSClient) Quota(ctx context.Context, service, code string) (int64, error)

Quota retrieves the requested service quota for the service.

func (*AWSClient) RunningInstances Uses

func (ac *AWSClient) RunningInstances(ctx context.Context) ([]*Instance, error)

RunningInstances retrieves all EC2 instances in a region which have not been terminated or stopped.

func (*AWSClient) WaitUntilInstanceRunning Uses

func (ac *AWSClient) WaitUntilInstanceRunning(ctx context.Context, instID string) error

WaitUntilInstanceRunning waits until a stopping condition is met. The stopping conditions are: - The requested instance state is `running`. - The passed in context is cancelled or the deadline expires. - 40 requests are made made with a 15 second delay between each request.

type EC2UserData Uses

type EC2UserData struct {
    // BuildletBinaryURL is the url to the buildlet binary stored on GCS.
    BuildletBinaryURL string `json:"buildlet_binary_url,omitempty"`
    // BuildletHostType is the host type used by the buildlet. For example, `host-linux-arm64-aws`.
    BuildletHostType string `json:"buildlet_host_type,omitempty"`
    // BuildletImageURL is the url for the buildlet container image.
    BuildletImageURL string `json:"buildlet_image_url,omitempty"`
    // BuildletName is the name which should be passed onto the buildlet.
    BuildletName string `json:"buildlet_name,omitempty"`
    // Metadata provides a location for arbitrary metadata to be stored.
    Metadata map[string]string `json:"metadata,omitempty"`
    // TLSCert is the TLS certificate used by the buildlet.
    TLSCert string `json:"tls_cert,omitempty"`
    // TLSKey is the TLS key used by the buildlet.
    TLSKey string `json:"tls_key,omitempty"`
    // TLSPassword contains the SHA1 of the TLS key used by the buildlet for basic authentication.
    TLSPassword string `json:"tls_password,omitempty"`
}

EC2UserData is stored in the user data for each EC2 instance. This is used to store metadata about the running instance. The buildlet will retrieve this on EC2 instances before allowing connections from the coordinator.

func (*EC2UserData) EncodedString Uses

func (ud *EC2UserData) EncodedString() string

EncodedString converts `EC2UserData` into JSON which is base64 encoded. User data must be base64 encoded upon creation.

type EC2VMConfiguration Uses

type EC2VMConfiguration struct {
    // Description is a user defined description of the instance. It is displayed
    // on the AWS UI. It is an optional field.
    Description string
    // ImageID is the ID of the image used to launch the instance. It is a required field.
    ImageID string
    // Name is a user defined name for the instance. It is displayed on the AWS UI. It is
    // is an optional field.
    Name string
    // SSHKeyID is the name of the SSH key pair to use for access. It is a required field.
    SSHKeyID string
    // SecurityGroups contains the names of the security groups to be applied to the VM. If none
    // are provided the default security group will be used.
    SecurityGroups []string
    // Tags the tags to apply to the resources during launch.
    Tags map[string]string
    // Type is the type of instance.
    Type string
    // UserData is the user data to make available to the instance. This data is available
    // on the VM via the metadata endpoints. It must be a base64-encoded string. User
    // data is limited to 16 KB.
    UserData string
    // Zone the Availability Zone of the instance.
    Zone string
}

EC2VMConfiguration is the configuration needed for an EC2 instance.

type FakeAWSClient Uses

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

FakeAWSClient provides a fake AWS Client used to test the AWS client functionality.

func NewFakeAWSClient Uses

func NewFakeAWSClient() *FakeAWSClient

NewFakeAWSClient crates a fake AWS client.

func (*FakeAWSClient) CreateInstance Uses

func (f *FakeAWSClient) CreateInstance(ctx context.Context, config *EC2VMConfiguration) (*Instance, error)

CreateInstance creates an EC2 VM instance.

func (*FakeAWSClient) DestroyInstances Uses

func (f *FakeAWSClient) DestroyInstances(ctx context.Context, instIDs ...string) error

DestroyInstances terminates EC2 VM instances.

func (*FakeAWSClient) Instance Uses

func (f *FakeAWSClient) Instance(ctx context.Context, instID string) (*Instance, error)

Instance returns the `Instance` record for the rquested instance. The instance record will return records for recently terminated instances. If an instance is not found an error will be returned.

func (*FakeAWSClient) InstanceTypesARM Uses

func (f *FakeAWSClient) InstanceTypesARM(ctx context.Context) ([]*InstanceType, error)

InstanceTypesArm retrieves all EC2 instance types in a region which support the ARM64 architecture.

func (*FakeAWSClient) Quota Uses

func (f *FakeAWSClient) Quota(ctx context.Context, service, code string) (int64, error)

Quota retrieves the requested service quota for the service.

func (*FakeAWSClient) RunningInstances Uses

func (f *FakeAWSClient) RunningInstances(ctx context.Context) ([]*Instance, error)

Instances retrieves all EC2 instances in a region which have not been terminated or stopped.

func (*FakeAWSClient) WaitUntilInstanceRunning Uses

func (f *FakeAWSClient) WaitUntilInstanceRunning(ctx context.Context, instID string) error

WaitUntilInstanceRunning returns when an instance has transitioned into the running state.

type Instance Uses

type Instance struct {
    // CPUCount is the number of VCPUs the instance is configured with.
    CPUCount int64
    // CreatedAt is the time when the instance was launched.
    CreatedAt time.Time
    // Description is a user defined descripton of the instance.
    Description string
    // ID is the instance ID.
    ID  string
    // IPAddressExternal is the public IPv4 address assigned to the instance.
    IPAddressExternal string
    // IPAddressInternal is the private IPv4 address assigned to the instance.
    IPAddressInternal string
    // ImageID is The ID of the AMI(image)  used to launch the instance.
    ImageID string
    // Name is a user defined name for the instance instance.
    Name string
    // SSHKeyID is the name of the SSH key pair to use for access. It is a required field.
    SSHKeyID string
    // SecurityGroups is the security groups for the instance.
    SecurityGroups []string
    // State contains the state of the instance.
    State string
    // Tags contains tags assigned to the instance.
    Tags map[string]string
    // Type is the name of instance type.
    Type string
    // Zone is the availability zone where the instance is deployed.
    Zone string
}

Instance is a virtual machine.

type InstanceType Uses

type InstanceType struct {
    // Type is the textual label used to describe an instance type.
    Type string
    // CPU is the Default vCPU count.
    CPU int64
}

InstanceType contains information about an EC2 vm instance type.

Package cloud imports 16 packages (graph) and is imported by 8 packages. Updated 2020-10-27. Refresh now. Tools for package owners.