package macservice
import "golang.org/x/build/internal/macservice"
Package macservice defines the client API for MacService.
Index ¶
- type Client
- func NewClient(apiKey string) *Client
- func (c *Client) Find(req FindRequest) (FindResponse, error)
- func (c *Client) Lease(req LeaseRequest) (LeaseResponse, error)
- func (c *Client) Renew(req RenewRequest) (RenewResponse, error)
- func (c *Client) Vacate(req VacateRequest) error
- type DiskSelection
- type FindRequest
- type FindResponse
- type ImageHashes
- type Instance
- type InstanceSpecification
- type Lease
- type LeaseRequest
- type LeaseResponse
- type MachineProfile
- type MetadataEntry
- type Namespace
- type NetworkAccessLevel
- type RenewRequest
- type RenewResponse
- type VacateRequest
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a MacService client.
func NewClient ¶
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 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 VacateRequest ¶
type VacateRequest struct { LeaseID string `json:"leaseId"` }
Source Files ¶
client.go leases.go
- Version
- v0.0.0-20250421191922-3619c213cff3 (latest)
- Published
- Apr 21, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 3 months ago –
Tools for package owners.