api

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ComputeBaseURL = "https://compute.googleapis.com"
View Source
const DNSBaseURL = "https://dns.googleapis.com"
View Source
const IAMBaseURL = "https://iam.googleapis.com"

Variables

This section is empty.

Functions

func DecodeError

func DecodeError(statusCode int, body []byte) error

func IsAuthFailure

func IsAuthFailure(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsRateLimited

func IsRateLimited(err error) bool

func NewHTTPClient

func NewHTTPClient() *http.Client

Types

type APIError

type APIError struct {
	StatusCode int
	Code       int
	Status     string
	Message    string
	Reason     string
	Domain     string
}

func (*APIError) Error

func (e *APIError) Error() string

type AccessConfig

type AccessConfig struct {
	NatIP string `json:"natIP"`
}

type Client

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

func NewClient

func NewClient(ts *auth.TokenSource, opts ...Option) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req Request, out any) error

type Instance

type Instance struct {
	Hostname          string             `json:"hostname"`
	Name              string             `json:"name"`
	Zone              string             `json:"zone"`
	Status            string             `json:"status"`
	NetworkInterfaces []NetworkInterface `json:"networkInterfaces"`
}

type ListInstancesResponse

type ListInstancesResponse struct {
	Items         []Instance `json:"items"`
	NextPageToken string     `json:"nextPageToken"`
}

type ListManagedZonesResponse

type ListManagedZonesResponse struct {
	ManagedZones  []ManagedZone `json:"managedZones"`
	NextPageToken string        `json:"nextPageToken"`
}

type ListRRSetsResponse

type ListRRSetsResponse struct {
	RRSets        []RRSet `json:"rrsets"`
	NextPageToken string  `json:"nextPageToken"`
}

type ListServiceAccountsResponse

type ListServiceAccountsResponse struct {
	Accounts      []ServiceAccount `json:"accounts"`
	NextPageToken string           `json:"nextPageToken"`
}

type ListZonesResponse

type ListZonesResponse struct {
	Items         []Zone `json:"items"`
	NextPageToken string `json:"nextPageToken"`
}

type ManagedZone

type ManagedZone struct {
	Name    string `json:"name"`
	DNSName string `json:"dnsName"`
}

type NetworkInterface

type NetworkInterface struct {
	NetworkIP     string         `json:"networkIP"`
	AccessConfigs []AccessConfig `json:"accessConfigs"`
}

type Option

type Option func(*Client)

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

func WithRetryPolicy

func WithRetryPolicy(p RetryPolicy) Option

type Pager

type Pager[T any] struct {
	// contains filtered or unexported fields
}

func NewPager

func NewPager[T any](c *Client, initial Request, itemsField string) *Pager[T]

func (*Pager[T]) All

func (p *Pager[T]) All(ctx context.Context) ([]T, error)

type RRSet

type RRSet struct {
	Name    string   `json:"name"`
	Type    string   `json:"type"`
	RRDatas []string `json:"rrdatas"`
}

type Request

type Request struct {
	Method     string
	BaseURL    string
	Path       string
	Query      url.Values
	Headers    http.Header
	Body       []byte
	Idempotent bool
}

type RetryPolicy

type RetryPolicy interface {
	Do(ctx context.Context, idempotent bool, fn func() (*http.Response, error)) (*http.Response, error)
}

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

type ServiceAccount

type ServiceAccount struct {
	Name           string `json:"name"`
	ProjectID      string `json:"projectId"`
	UniqueID       string `json:"uniqueId"`
	Email          string `json:"email"`
	DisplayName    string `json:"displayName"`
	OAuth2ClientID string `json:"oauth2ClientId"`
	Disabled       bool   `json:"disabled"`
}

type Zone

type Zone struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

Jump to

Keyboard shortcuts

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