macservice

package
v0.0.0-...-4f1971e Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package macservice defines the client API for MacService.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a MacService client.

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a MacService client, authenticated with the provided API key.

func (*Client) Find

func (c *Client) Find(req FindRequest) (FindResponse, error)

Find searches for leases.

func (*Client) Lease

func (c *Client) Lease(req LeaseRequest) (LeaseResponse, error)

Lease creates a new lease.

func (*Client) Renew

func (c *Client) Renew(req RenewRequest) (RenewResponse, error)

Renew updates the expiration time of a lease. Note that RenewRequest.Duration is the lease duration from now, not from the current lease expiration time.

func (*Client) Vacate

func (c *Client) Vacate(req VacateRequest) error

Vacate vacates a lease.

type DiskSelection

type DiskSelection struct {
	ImageHashes ImageHashes `json:"imageHashes"`
}

type FindRequest

type FindRequest struct {
	VMResourceNamespace Namespace `json:"vmResourceNamespace"`
}

type FindResponse

type FindResponse struct {
	Instances []Instance `json:"instances"`
}

type ImageHashes

type ImageHashes struct {
	BootSHA256 string `json:"bootSha256"`
}

type Instance

type Instance struct {
	Lease Lease `json:"lease"`

	InstanceSpecification InstanceSpecification `json:"instanceSpecification"`
}

type InstanceSpecification

type InstanceSpecification struct {
	Profile     MachineProfile     `json:"profile"`
	AccessLevel NetworkAccessLevel `json:"accessLevel"`

	Metadata []MetadataEntry `json:"metadata"`

	DiskSelection DiskSelection `json:"diskSelection"`
}

type Lease

type Lease struct {
	LeaseID string `json:"leaseId"`

	VMResourceNamespace Namespace `json:"vmResourceNamespace"`

	Expires time.Time `json:"expires"`
}

type LeaseRequest

type LeaseRequest struct {
	VMResourceNamespace Namespace `json:"vmResourceNamespace"`

	InstanceSpecification InstanceSpecification `json:"instanceSpecification"`

	// Duration is ultimately a Duration protobuf message.
	//
	// https://pkg.go.dev/google.golang.org/protobuf@v1.31.0/types/known/durationpb#hdr-JSON_Mapping:
	// "In JSON format, the Duration type is encoded as a string rather
	// than an object, where the string ends in the suffix "s" (indicating
	// seconds) and is preceded by the number of seconds, with nanoseconds
	// expressed as fractional seconds."
	Duration string `json:"duration"`
}

type LeaseResponse

type LeaseResponse struct {
	PendingLease Lease `json:"pendingLease"`
}

type MachineProfile

type MachineProfile string
const (
	V1_MEDIUM_VM MachineProfile = "V1_MEDIUM_VM"
)

type MetadataEntry

type MetadataEntry struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Namespace

type Namespace struct {
	CustomerName    string `json:"customerName"`
	ProjectName     string `json:"projectName"`
	SubCustomerName string `json:"subCustomerName"`
}

type NetworkAccessLevel

type NetworkAccessLevel string
const (
	GOLANG_OSS NetworkAccessLevel = "GOLANG_OSS"
)

type RenewRequest

type RenewRequest struct {
	LeaseID string `json:"leaseId"`

	// Duration is ultimately a Duration protobuf message.
	//
	// https://pkg.go.dev/google.golang.org/protobuf@v1.31.0/types/known/durationpb#hdr-JSON_Mapping:
	// "In JSON format, the Duration type is encoded as a string rather
	// than an object, where the string ends in the suffix "s" (indicating
	// seconds) and is preceded by the number of seconds, with nanoseconds
	// expressed as fractional seconds."
	Duration string `json:"duration"`
}

type RenewResponse

type RenewResponse struct {
	Expires time.Time `json:"expires"`
}

type VacateRequest

type VacateRequest struct {
	LeaseID string `json:"leaseId"`
}

Jump to

Keyboard shortcuts

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