Documentation
¶
Index ¶
- Constants
- Variables
- func GetErrorRequestID(err error) string
- func GetErrorTraceID(err error) string
- func IsCapacityError(err error) bool
- func IsNameTakenError(err error) bool
- func Retry(ctx context.Context, op func() error) error
- type App
- type AppOrganizationInfo
- type AssignIPRequest
- type AssignIPResponse
- type CapacityScope
- type Client
- func (f *Client) AcquireLease(ctx context.Context, appName, machineID string, ttl *int) (*fly.MachineLease, error)
- func (f *Client) AppNameAvailable(ctx context.Context, name string) (bool, error)
- func (f *Client) AssignIP(ctx context.Context, appName string, req AssignIPRequest) (res *AssignIPResponse, err error)
- func (f *Client) CheckCertificate(ctx context.Context, appName, hostname string) (*fly.CertificateDetailResponse, error)
- func (f *Client) Cordon(ctx context.Context, appName, machineID string, nonce string) (err error)
- func (f *Client) CreateACMECertificate(ctx context.Context, appName string, req fly.CreateCertificateRequest) (*fly.CertificateDetailResponse, error)
- func (f *Client) CreateApp(ctx context.Context, in CreateAppRequest) (app *App, err error)
- func (f *Client) CreateCustomCertificate(ctx context.Context, appName string, req fly.ImportCertificateRequest) (*fly.CertificateDetailResponse, error)
- func (f *Client) CreateManagedPostgresAttachment(ctx context.Context, id string, req CreateManagedPostgresAttachmentRequest) (ManagedPostgresAttachment, error)
- func (f *Client) CreateManagedPostgresBackup(ctx context.Context, id string, req CreateManagedPostgresBackupRequest) error
- func (f *Client) CreateManagedPostgresCluster(ctx context.Context, req CreateManagedPostgresClusterRequest) (ManagedPostgresCluster, error)
- func (f *Client) CreateManagedPostgresDatabase(ctx context.Context, id string, req CreateManagedPostgresDatabaseRequest) (ManagedPostgresDatabase, error)
- func (f *Client) CreateManagedPostgresUser(ctx context.Context, id string, req CreateManagedPostgresUserRequest) (ManagedPostgresUser, error)
- func (f *Client) CreateVolume(ctx context.Context, appName string, req fly.CreateVolumeRequest) (*fly.Volume, error)
- func (f *Client) CreateVolumeSnapshot(ctx context.Context, appName, volumeId string) error
- func (f *Client) DecryptSecretKey(ctx context.Context, appName, name string, ciphertext, assoc []byte, ...) (*fly.DecryptSecretKeyResp, error)
- func (f *Client) DeleteACMECertificate(ctx context.Context, appName, hostname string) error
- func (f *Client) DeleteApp(ctx context.Context, name string) error
- func (f *Client) DeleteAppSecret(ctx context.Context, appName, name string) (*fly.DeleteAppSecretResp, error)
- func (f *Client) DeleteCertificate(ctx context.Context, appName, hostname string) error
- func (f *Client) DeleteCustomCertificate(ctx context.Context, appName, hostname string) error
- func (f *Client) DeleteIPAssignment(ctx context.Context, appName, ip string) (err error)
- func (f *Client) DeleteManagedPostgresAttachment(ctx context.Context, id, appName string) error
- func (f *Client) DeleteManagedPostgresCluster(ctx context.Context, id string) error
- func (f *Client) DeleteManagedPostgresUser(ctx context.Context, id, username string) error
- func (f *Client) DeleteMetadata(ctx context.Context, appName, machineID, key string) error
- func (f *Client) DeleteSecretKey(ctx context.Context, appName, name string) error
- func (f *Client) DeleteVolume(ctx context.Context, appName, volumeId string) (*fly.Volume, error)
- func (f *Client) Destroy(ctx context.Context, appName string, input fly.RemoveMachineInput, ...) (err error)
- func (f *Client) DisableManagedPostgresExtension(ctx context.Context, id, database, name string, force bool) error
- func (f *Client) EnableManagedPostgresExtension(ctx context.Context, id, database string, ...) error
- func (f *Client) EncryptSecretKey(ctx context.Context, appName, name string, plaintext, assoc []byte, ...) (*fly.EncryptSecretKeyResp, error)
- func (f *Client) Exec(ctx context.Context, appName, machineID string, in *fly.MachineExecRequest) (*fly.MachineExecResponse, error)
- func (f *Client) ExtendVolume(ctx context.Context, appName, volumeId string, size_gb int) (*fly.Volume, bool, error)
- func (f *Client) FindLease(ctx context.Context, appName, machineID string) (*fly.MachineLease, error)
- func (f *Client) ForkManagedPostgresCluster(ctx context.Context, id string, req ForkManagedPostgresClusterRequest) (ManagedPostgresCluster, error)
- func (f *Client) GenerateSecretKey(ctx context.Context, appName, name string, typ string) (*fly.SetSecretKeyResp, error)
- func (f *Client) Get(ctx context.Context, appName, machineID string) (*fly.Machine, error)
- func (f *Client) GetAllVolumes(ctx context.Context, appName string) ([]fly.Volume, error)
- func (f *Client) GetApp(ctx context.Context, name string) (app *App, err error)
- func (f *Client) GetAppSecrets(ctx context.Context, appName, name string, version *uint64, showSecrets bool) (*fly.AppSecret, error)
- func (f *Client) GetCertificate(ctx context.Context, appName, hostname string) (*fly.CertificateDetailResponse, error)
- func (f *Client) GetIPAssignments(ctx context.Context, appName string) (res *ListIPAssignmentsResponse, err error)
- func (f *Client) GetManagedPostgresCluster(ctx context.Context, id string) (ManagedPostgresCluster, error)
- func (f *Client) GetManagedPostgresUserCredentials(ctx context.Context, id, username string) (ManagedPostgresUserCredentials, error)
- func (f *Client) GetMany(ctx context.Context, appName string, machineIDs []string) ([]*fly.Machine, error)
- func (f *Client) GetMetadata(ctx context.Context, appName, machineID string) (map[string]string, error)
- func (f *Client) GetPlacements(ctx context.Context, request *GetPlacementsRequest) ([]RegionPlacement, error)
- func (f *Client) GetProcesses(ctx context.Context, appName, machineID string) (fly.MachinePsResponse, error)
- func (f *Client) GetRegions(ctx context.Context) (*RegionData, error)
- func (f *Client) GetSecretKey(ctx context.Context, appName, name string, version *uint64) (*fly.SecretKey, error)
- func (f *Client) GetVolume(ctx context.Context, appName, volumeId string) (*fly.Volume, error)
- func (f *Client) GetVolumeSnapshots(ctx context.Context, appName, volumeId string) ([]fly.VolumeSnapshot, error)
- func (f *Client) GetVolumes(ctx context.Context, appName string) ([]fly.Volume, error)
- func (f *Client) Kill(ctx context.Context, appName, machineID string) (err error)
- func (f *Client) Launch(ctx context.Context, appName string, builder fly.LaunchMachineInput) (out *fly.Machine, err error)
- func (f *Client) List(ctx context.Context, appName, state string) ([]*fly.Machine, error)
- func (f *Client) ListActive(ctx context.Context, appName string) ([]*fly.Machine, error)
- func (f *Client) ListAppSecrets(ctx context.Context, appName string, version *uint64, showSecrets bool) ([]fly.AppSecret, error)
- func (f *Client) ListApps(ctx context.Context, req ListAppsRequest) ([]App, error)
- func (f *Client) ListCertificates(ctx context.Context, appName string, opts *ListCertificatesOpts) (*fly.ListCertificatesResponse, error)
- func (f *Client) ListFlyAppsMachines(ctx context.Context, appName string) ([]*fly.Machine, *fly.Machine, error)
- func (f *Client) ListManagedPostgresBackups(ctx context.Context, id string) ([]ManagedPostgresBackup, error)
- func (f *Client) ListManagedPostgresClusters(ctx context.Context, req ListManagedPostgresClustersRequest) ([]ManagedPostgresClusterSummary, error)
- func (f *Client) ListManagedPostgresDatabases(ctx context.Context, id string) ([]ManagedPostgresDatabase, error)
- func (f *Client) ListManagedPostgresExtensions(ctx context.Context, id, database string) ([]ManagedPostgresExtension, error)
- func (f *Client) ListManagedPostgresPlans(ctx context.Context, orgSlug string) ([]ManagedPostgresPlan, error)
- func (f *Client) ListManagedPostgresUsers(ctx context.Context, id string) ([]ManagedPostgresUser, error)
- func (f *Client) ListSecretKeys(ctx context.Context, appName string, version *uint64) ([]fly.SecretKey, error)
- func (f *Client) NewRequest(ctx context.Context, method, path string, in interface{}, ...) (*http.Request, error)
- func (f *Client) RefreshLease(ctx context.Context, appName, machineID string, ttl *int, nonce string) (*fly.MachineLease, error)
- func (f *Client) ReleaseLease(ctx context.Context, appName, machineID, nonce string) error
- func (f *Client) Restart(ctx context.Context, appName string, in fly.RestartMachineInput, nonce string) (err error)
- func (f *Client) RestoreManagedPostgresCluster(ctx context.Context, id string, req RestoreManagedPostgresClusterRequest) (ManagedPostgresCluster, error)
- func (f *Client) RotateManagedPostgresUserPassword(ctx context.Context, id, username string, ...) (ManagedPostgresUserCredentials, error)
- func (f *Client) SetAppSecret(ctx context.Context, appName, name string, value string) (*fly.SetAppSecretResp, error)
- func (f *Client) SetMetadata(ctx context.Context, appName, machineID, key, value string) error
- func (f *Client) SetSecretKey(ctx context.Context, appName, name string, typ string, value []byte) (*fly.SetSecretKeyResp, error)
- func (f *Client) SignSecretKey(ctx context.Context, appName, name string, plaintext []byte, version *uint64) (*fly.SignSecretKeyResp, error)
- func (f *Client) Start(ctx context.Context, appName, machineID string, nonce string) (out *fly.MachineStartResponse, err error)
- func (f *Client) Stop(ctx context.Context, appName string, in fly.StopMachineInput, nonce string) (err error)
- func (f *Client) Suspend(ctx context.Context, appName, machineID, nonce string) error
- func (f *Client) Uncordon(ctx context.Context, appName, machineID string, nonce string) (err error)
- func (f *Client) Update(ctx context.Context, appName string, builder fly.LaunchMachineInput, ...) (out *fly.Machine, err error)
- func (f *Client) UpdateAppSecrets(ctx context.Context, appName string, values map[string]*string) (*fly.UpdateAppSecretsResp, error)
- func (f *Client) UpdateManagedPostgresUserRole(ctx context.Context, id, username string, ...) error
- func (f *Client) UpdateVolume(ctx context.Context, appName, volumeId string, req fly.UpdateVolumeRequest) (*fly.Volume, error)
- func (f *Client) VerifySecretKey(ctx context.Context, appName, name string, plaintext, sig []byte, ...) error
- func (f *Client) Wait(ctx context.Context, appName string, machineID string, waitOpts ...WaitOption) (err error)
- func (f *Client) WaitForApp(ctx context.Context, name string) error
- type CreateAppRequest
- type CreateManagedPostgresAttachmentRequest
- type CreateManagedPostgresBackupRequest
- type CreateManagedPostgresClusterRequest
- type CreateManagedPostgresDatabaseRequest
- type CreateManagedPostgresUserRequest
- type EnableManagedPostgresExtensionRequest
- type ErrorRequestID
- type ErrorStatusCode
- type ErrorTraceID
- type ExtendVolumeRequest
- type ExtendVolumeResponse
- type FlapsError
- func (fe *FlapsError) ErrRequestID() string
- func (fe *FlapsError) ErrTraceID() string
- func (fe *FlapsError) Error() string
- func (fe *FlapsError) Is(target error) bool
- func (fe *FlapsError) ResponseBodyString() string
- func (fe *FlapsError) StatusCode() *StatusCode
- func (fe *FlapsError) Suggestion() string
- func (fe *FlapsError) Unwrap() error
- type ForkManagedPostgresClusterRequest
- type GetPlacementsRequest
- type GetPlacementsResponse
- type IPAssignment
- type IPAssignmentNetwork
- type IPAssignmentType
- type IPPair
- type ListAppsRequest
- type ListCertificatesOpts
- type ListIPAssignmentsResponse
- type ListManagedPostgresClustersRequest
- type ManagedPostgresAttachedApp
- type ManagedPostgresAttachment
- type ManagedPostgresBackup
- type ManagedPostgresCluster
- type ManagedPostgresClusterSummary
- type ManagedPostgresDatabase
- type ManagedPostgresEndpoint
- type ManagedPostgresEndpoints
- type ManagedPostgresExtension
- type ManagedPostgresInstalledExtension
- type ManagedPostgresOrganization
- type ManagedPostgresPlan
- type ManagedPostgresUser
- type ManagedPostgresUserCredentials
- type ManagedPostgresUserRole
- type NewClientOpts
- type RegionData
- type RegionPlacement
- type RestoreManagedPostgresClusterRequest
- type RotateManagedPostgresUserPasswordRequest
- type StatusCode
- type UpdateManagedPostgresUserRoleRequest
- type WaitOption
- type Weights
Constants ¶
const ( ManagedPostgresStatusReady = "ready" ManagedPostgresStatusFailed = "failed" ManagedPostgresStatusError = "error" )
Statuses a Managed Postgres cluster reports while provisioning. The API documents "failed" as the terminal failure status; "error" is declared too because the service behind it reports that spelling for the same state.
Variables ¶
var ErrFlapsGone = &FlapsError{ResponseStatusCode: http.StatusGone}
ErrFlapsGone is returned when the API reports a resource as gone (HTTP 410). Managed Postgres returns it for a cluster that has already been deleted.
var ErrFlapsNotFound = &FlapsError{ResponseStatusCode: http.StatusNotFound}
var NonceHeader = "fly-machine-lease-nonce"
Functions ¶
func GetErrorRequestID ¶
func GetErrorTraceID ¶ added in v0.1.5
func IsCapacityError ¶ added in v0.11.0
func IsNameTakenError ¶ added in v0.9.5
IsNameTakenError reports whether err is a rejection of an app name that is already in use.
Prefer this over matching the error's text: it reads the status code the API sets, and falls back to the message only when there is no code at all. The fallback covers two cases and is not vestigial:
- a client running against a Fly.io API that predates the status code, and
- app creation that never went through the Machines API at all, such as the extension providers that create their apps over GraphQL, where nothing sets a status code in the first place.
Note what the fallback deliberately does not match: a collision that races past the validation and trips the database constraint instead is reported with a generic message covering every unique constraint the platform has, not just app names. Telling that one apart needs context only the server has, so the API classifies it there and reports it here as the name_taken code.
Types ¶
type App ¶ added in v0.1.67
type App struct {
ID string `json:"id"`
Name string `json:"name"`
InternalNumericID int32 `json:"internal_numeric_id"`
Network string `json:"network"`
NetworkCIDR string `json:"network_cidr"`
Status string `json:"status"`
MachineCount int64 `json:"machine_count"`
VolumeCount int64 `json:"volume_count"`
Organization AppOrganizationInfo `json:"organization"`
// hashid.appname.fly.dev, for ACME HTTP-01 pointing only to v6
CnameTarget string `json:"cname_target"`
// a role like "postgres_cluster" or "remote-docker-builder"
AppRole string `json:"app_role"`
}
func (*App) IsPostgresApp ¶ added in v0.1.67
type AppOrganizationInfo ¶ added in v0.1.67
type AssignIPRequest ¶ added in v0.1.67
type AssignIPRequest struct {
Type IPAssignmentType `json:"type"`
Region string `json:"region"`
Organization string `json:"org_slug"`
Network string `json:"network"`
ServiceName string `json:"service_name"`
}
type AssignIPResponse ¶ added in v0.9.14
type AssignIPResponse struct {
IP *string `json:"ip"`
// IPPair is set when EgressPair IP type was requested; in that case IP is nil.
IPPair *IPPair `json:"ip_pair"`
Region string `json:"region"`
ServiceName string `json:"service_name"`
CreatedAt time.Time `json:"created_at"`
Egress bool `json:"egress"`
// Network is set for Flycast (private_v6) addresses only.
Network *IPAssignmentNetwork `json:"network"`
}
type CapacityScope ¶ added in v0.11.0
type CapacityScope int
CapacityScope says which pool of resources a Machines API call ran out of. A caller decides what to do from the scope alone: a host-scoped failure is fixed by placing the machine somewhere else, a region-scoped one is not fixable by the caller at all.
const ( // CapacityScopeNone means the error is not a capacity failure. CapacityScopeNone CapacityScope = iota // CapacityScopeHost means the host the machine already lives on // cannot fit the requested guest. Produced by machine update, which // can only re-reserve resources on the current host. Recreating the // machine lets the placer pick another host. CapacityScopeHost // CapacityScopeVolumePlacement means the machine must be created on // the host holding one of its volumes, and that host cannot fit the // guest. Only the volume's host is exhausted; the region may have room. CapacityScopeVolumePlacement // CapacityScopeRegion means no host in the region can place the // machine or volume. Retrying, relocating, or recreating in the same // region will not help. CapacityScopeRegion )
func CapacityScopeOf ¶ added in v0.11.0
func CapacityScopeOf(err error) CapacityScope
func (CapacityScope) String ¶ added in v0.11.0
func (s CapacityScope) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewWithOptions ¶
func NewWithOptions(ctx context.Context, opts NewClientOpts) (*Client, error)
func (*Client) AcquireLease ¶
func (*Client) AppNameAvailable ¶ added in v0.1.67
AppNameAvailable reports whether name is free to use for a new app.
App names are a single global namespace, so a name can be taken by an app this client cannot see. The API does not hide that: it looks the name up globally and then refuses the read, so a name held by another organization comes back as a 403 and counts as taken just as much as an app we can read. Only a 404 means the name is free.
Any other failure is returned as-is, alongside a false that means "not available" rather than "taken", because such a failure says nothing either way about the name. That includes a 401, which is what an unauthenticated or unusable token gets: reporting it as "taken" would tell the caller their name is in use when the truth is that nobody asked the question successfully.
func (*Client) AssignIP ¶ added in v0.1.67
func (f *Client) AssignIP(ctx context.Context, appName string, req AssignIPRequest) (res *AssignIPResponse, err error)
func (*Client) CheckCertificate ¶ added in v0.3.1
func (f *Client) CheckCertificate(ctx context.Context, appName, hostname string) (*fly.CertificateDetailResponse, error)
Triggers DNS validation + ACME issuance if required.
func (*Client) CreateACMECertificate ¶ added in v0.3.1
func (f *Client) CreateACMECertificate(ctx context.Context, appName string, req fly.CreateCertificateRequest) (*fly.CertificateDetailResponse, error)
Add a hostname and start ACME issuance.
func (*Client) CreateCustomCertificate ¶ added in v0.3.1
func (f *Client) CreateCustomCertificate(ctx context.Context, appName string, req fly.ImportCertificateRequest) (*fly.CertificateDetailResponse, error)
Add a custom certificate. Will not start ACME issuance if not already present.
func (*Client) CreateManagedPostgresAttachment ¶ added in v0.9.13
func (f *Client) CreateManagedPostgresAttachment(ctx context.Context, id string, req CreateManagedPostgresAttachmentRequest) (ManagedPostgresAttachment, error)
CreateManagedPostgresAttachment attaches an app to a Managed Postgres cluster. The server returns 201 if the attachment was created, or 200 if it already existed (idempotent find-or-create semantics). Both are treated as success. The cluster ID is escaped as URL path segments.
func (*Client) CreateManagedPostgresBackup ¶ added in v0.9.10
func (*Client) CreateManagedPostgresCluster ¶ added in v0.9.4
func (f *Client) CreateManagedPostgresCluster(ctx context.Context, req CreateManagedPostgresClusterRequest) (ManagedPostgresCluster, error)
func (*Client) CreateManagedPostgresDatabase ¶ added in v0.9.9
func (f *Client) CreateManagedPostgresDatabase(ctx context.Context, id string, req CreateManagedPostgresDatabaseRequest) (ManagedPostgresDatabase, error)
func (*Client) CreateManagedPostgresUser ¶ added in v0.9.12
func (f *Client) CreateManagedPostgresUser(ctx context.Context, id string, req CreateManagedPostgresUserRequest) (ManagedPostgresUser, error)
func (*Client) CreateVolume ¶
func (*Client) CreateVolumeSnapshot ¶
func (*Client) DecryptSecretKey ¶ added in v0.1.46
func (*Client) DeleteACMECertificate ¶ added in v0.3.1
Removes ACME certificates and stops renewals, leaving a custom certificate in place.
func (*Client) DeleteAppSecret ¶ added in v0.1.46
func (*Client) DeleteCertificate ¶ added in v0.3.1
Removes hostname and all certificates.
func (*Client) DeleteCustomCertificate ¶ added in v0.3.1
Removes a custom certificate, leaving the ACME certificates in place.
func (*Client) DeleteIPAssignment ¶ added in v0.1.67
func (*Client) DeleteManagedPostgresAttachment ¶ added in v0.9.13
DeleteManagedPostgresAttachment removes an app's attachment to a Managed Postgres cluster. Returns no content on success. Both the cluster ID and app name are escaped as URL path segments.
func (*Client) DeleteManagedPostgresCluster ¶ added in v0.9.8
func (*Client) DeleteManagedPostgresUser ¶ added in v0.9.12
func (*Client) DeleteMetadata ¶
func (*Client) DeleteSecretKey ¶ added in v0.1.46
func (*Client) DeleteVolume ¶
func (*Client) DisableManagedPostgresExtension ¶ added in v0.9.12
func (*Client) EnableManagedPostgresExtension ¶ added in v0.9.12
func (*Client) EncryptSecretKey ¶ added in v0.1.46
func (*Client) Exec ¶
func (f *Client) Exec(ctx context.Context, appName, machineID string, in *fly.MachineExecRequest) (*fly.MachineExecResponse, error)
func (*Client) ExtendVolume ¶
func (*Client) ForkManagedPostgresCluster ¶ added in v0.11.5
func (f *Client) ForkManagedPostgresCluster(ctx context.Context, id string, req ForkManagedPostgresClusterRequest) (ManagedPostgresCluster, error)
ForkManagedPostgresCluster creates a new cluster from the current data of the source cluster identified by id. The fork is provisioned asynchronously; the returned cluster reflects its initial state.
func (*Client) GenerateSecretKey ¶ added in v0.1.46
func (*Client) GetAllVolumes ¶
func (*Client) GetAppSecrets ¶ added in v0.1.46
func (*Client) GetCertificate ¶ added in v0.3.1
func (*Client) GetIPAssignments ¶ added in v0.1.67
func (*Client) GetManagedPostgresCluster ¶ added in v0.9.4
func (*Client) GetManagedPostgresUserCredentials ¶ added in v0.9.4
func (*Client) GetMetadata ¶
func (*Client) GetPlacements ¶ added in v0.1.47
func (f *Client) GetPlacements(ctx context.Context, request *GetPlacementsRequest) ([]RegionPlacement, error)
func (*Client) GetProcesses ¶
func (*Client) GetRegions ¶ added in v0.1.45
func (f *Client) GetRegions(ctx context.Context) (*RegionData, error)
func (*Client) GetSecretKey ¶ added in v0.1.46
func (*Client) GetVolumeSnapshots ¶
func (*Client) GetVolumes ¶
func (*Client) ListActive ¶
ListActive returns only non-destroyed that aren't in a reserved process group.
func (*Client) ListAppSecrets ¶ added in v0.1.46
func (*Client) ListCertificates ¶ added in v0.3.1
func (f *Client) ListCertificates(ctx context.Context, appName string, opts *ListCertificatesOpts) (*fly.ListCertificatesResponse, error)
func (*Client) ListFlyAppsMachines ¶
func (f *Client) ListFlyAppsMachines(ctx context.Context, appName string) ([]*fly.Machine, *fly.Machine, error)
ListFlyAppsMachines returns apps that are part of Fly Launch. Destroyed machines and console machines are excluded. Unlike other List functions, this function retries multiple times.
func (*Client) ListManagedPostgresBackups ¶ added in v0.9.10
func (*Client) ListManagedPostgresClusters ¶ added in v0.9.8
func (f *Client) ListManagedPostgresClusters(ctx context.Context, req ListManagedPostgresClustersRequest) ([]ManagedPostgresClusterSummary, error)
func (*Client) ListManagedPostgresDatabases ¶ added in v0.9.9
func (*Client) ListManagedPostgresExtensions ¶ added in v0.9.12
func (*Client) ListManagedPostgresPlans ¶ added in v0.11.5
func (f *Client) ListManagedPostgresPlans(ctx context.Context, orgSlug string) ([]ManagedPostgresPlan, error)
ListManagedPostgresPlans returns the Managed Postgres plans available to an organization. orgSlug may be "personal".
func (*Client) ListManagedPostgresUsers ¶ added in v0.9.12
func (*Client) ListSecretKeys ¶ added in v0.1.46
func (*Client) NewRequest ¶
func (*Client) RefreshLease ¶
func (*Client) ReleaseLease ¶
func (*Client) RestoreManagedPostgresCluster ¶ added in v0.9.11
func (f *Client) RestoreManagedPostgresCluster(ctx context.Context, id string, req RestoreManagedPostgresClusterRequest) (ManagedPostgresCluster, error)
func (*Client) RotateManagedPostgresUserPassword ¶ added in v0.11.3
func (f *Client) RotateManagedPostgresUserPassword(ctx context.Context, id, username string, req RotateManagedPostgresUserPasswordRequest) (ManagedPostgresUserCredentials, error)
func (*Client) SetAppSecret ¶ added in v0.1.46
func (*Client) SetMetadata ¶
func (*Client) SetSecretKey ¶ added in v0.1.46
func (*Client) SignSecretKey ¶ added in v0.1.46
func (*Client) UpdateAppSecrets ¶ added in v0.1.51
func (f *Client) UpdateAppSecrets(ctx context.Context, appName string, values map[string]*string) (*fly.UpdateAppSecretsResp, error)
UpdateAppSecrets can set and delete secrets. Nil secret values are deleted, while others are set.
func (*Client) UpdateManagedPostgresUserRole ¶ added in v0.9.12
func (*Client) UpdateVolume ¶
func (*Client) VerifySecretKey ¶ added in v0.1.46
type CreateAppRequest ¶ added in v0.1.67
type CreateManagedPostgresAttachmentRequest ¶ added in v0.9.13
type CreateManagedPostgresAttachmentRequest struct {
AppName string `json:"app_name"`
}
CreateManagedPostgresAttachmentRequest is the body for POST /v1/postgres/:id/attachments.
type CreateManagedPostgresBackupRequest ¶ added in v0.9.10
type CreateManagedPostgresBackupRequest struct {
Type string `json:"type"`
}
CreateManagedPostgresBackupRequest is the body for POST /v1/postgres/:id/backups.
type CreateManagedPostgresClusterRequest ¶ added in v0.9.4
type CreateManagedPostgresClusterRequest struct {
OrgSlug string `json:"org_slug"`
Name string `json:"name,omitempty"`
Region string `json:"region"`
Plan string `json:"plan"`
DiskSizeGB int `json:"disk_size_gb,omitempty"`
PGMajorVersion string `json:"pg_major_version,omitempty"`
PostGISEnabled bool `json:"postgis_enabled"`
}
CreateManagedPostgresClusterRequest is the body for POST /v1/postgres.
type CreateManagedPostgresDatabaseRequest ¶ added in v0.9.9
type CreateManagedPostgresDatabaseRequest struct {
Name string `json:"name"`
}
CreateManagedPostgresDatabaseRequest is the body for POST /v1/postgres/:id/databases.
type CreateManagedPostgresUserRequest ¶ added in v0.9.12
type CreateManagedPostgresUserRequest struct {
Username string `json:"username"`
Role string `json:"role"`
}
CreateManagedPostgresUserRequest is the body for POST /v1/postgres/:id/users.
type EnableManagedPostgresExtensionRequest ¶ added in v0.9.12
type EnableManagedPostgresExtensionRequest struct {
Name string `json:"name"`
Schema string `json:"schema,omitempty"`
CreateSchema bool `json:"create_schema"`
}
EnableManagedPostgresExtensionRequest is the body for POST /v1/postgres/:id/databases/:database/extensions.
type ErrorRequestID ¶
type ErrorRequestID interface {
ErrRequestID() string
}
TODO: we might not actually need an interface type here
type ErrorStatusCode ¶
type ErrorStatusCode interface {
error
StatusCode() *StatusCode
}
type ErrorTraceID ¶ added in v0.1.5
type ErrorTraceID interface {
ErrTraceID() string
}
type ExtendVolumeRequest ¶
type ExtendVolumeRequest struct {
SizeGB int `json:"size_gb"`
}
type ExtendVolumeResponse ¶
type FlapsError ¶
type FlapsError struct {
OriginalError error
ResponseStatusCode int
ResponseBody []byte
FlyRequestId string
TraceID string
}
func (*FlapsError) ErrRequestID ¶
func (fe *FlapsError) ErrRequestID() string
func (*FlapsError) ErrTraceID ¶ added in v0.1.5
func (fe *FlapsError) ErrTraceID() string
func (*FlapsError) Error ¶
func (fe *FlapsError) Error() string
func (*FlapsError) Is ¶
func (fe *FlapsError) Is(target error) bool
func (*FlapsError) ResponseBodyString ¶
func (fe *FlapsError) ResponseBodyString() string
func (*FlapsError) StatusCode ¶
func (fe *FlapsError) StatusCode() *StatusCode
func (*FlapsError) Suggestion ¶
func (fe *FlapsError) Suggestion() string
func (*FlapsError) Unwrap ¶
func (fe *FlapsError) Unwrap() error
type ForkManagedPostgresClusterRequest ¶ added in v0.11.5
type ForkManagedPostgresClusterRequest struct {
// Name for the fork. Defaults to the source's name with a -fork suffix.
Name string `json:"name,omitempty"`
// Plan for the fork. Defaults to the source cluster's plan.
Plan string `json:"plan,omitempty"`
}
ForkManagedPostgresClusterRequest is the body for POST /v1/postgres/:id/fork. Both fields are optional; empty values are omitted so the API applies its defaults.
type GetPlacementsRequest ¶ added in v0.1.47
type GetPlacementsRequest struct {
// Resource requirements for the Machine to simulate. Defaults to a performance-1x machine
ComputeRequirements *fly.MachineGuest `json:"compute"`
// Region expression for placement as a comma-delimited set of regions or aliases.
// Defaults to "[region],any", to prefer the API endpoint's local region with any other region as fallback.
Region string `json:"region"`
// Number of machines to simulate placement.
// Defaults to 0, which returns the org-specific limit for each region.
Count uint64 `json:"count"`
VolumeName string `json:"volume_name"`
VolumeSizeBytes uint64 `json:"volume_size_bytes"`
// Optional weights to override default placement preferences.
Weights *Weights `json:"weights"`
Org string `json:"org_slug"`
}
type GetPlacementsResponse ¶ added in v0.1.47
type GetPlacementsResponse struct {
Regions []RegionPlacement
}
type IPAssignment ¶ added in v0.1.67
type IPAssignment struct {
IP string `json:"ip"`
Region string `json:"region"`
ServiceName string `json:"service_name"`
CreatedAt time.Time `json:"created_at"`
Egress bool `json:"egress"`
// Network is set for Flycast (private_v6) addresses only.
Network *IPAssignmentNetwork `json:"network"`
}
func (IPAssignment) IsFlycast ¶ added in v0.1.67
func (ip IPAssignment) IsFlycast() bool
func (IPAssignment) IsV6 ¶ added in v0.9.14
func (ip IPAssignment) IsV6() bool
func (IPAssignment) Type ¶ added in v0.9.14
func (ip IPAssignment) Type() IPAssignmentType
type IPAssignmentNetwork ¶ added in v0.9.15
type IPAssignmentNetwork struct {
// Name is empty for the organization's default network.
Name string `json:"name"`
OrgSlug string `json:"org_slug"`
}
IPAssignmentNetwork is the 6PN network a Flycast (private_v6) address belongs to.
type IPAssignmentType ¶ added in v0.9.14
type IPAssignmentType string
IPAssignmentType is the type of IP address to allocate.
const ( IPAssignmentTypeV4 IPAssignmentType = "v4" IPAssignmentTypeV6 IPAssignmentType = "v6" IPAssignmentTypePrivateV6 IPAssignmentType = "private_v6" IPAssignmentTypeEgressV4 IPAssignmentType = "egress_v4" IPAssignmentTypeEgressV6 IPAssignmentType = "egress_v6" // IPAssignmentTypeEgressPair allocates both an egress v4 and v6 address at once. IPAssignmentTypeEgressPair IPAssignmentType = "egress_pair" )
type IPPair ¶ added in v0.9.14
IPPair is the pair of addresses returned when an IPAssignmentTypeEgressPair is allocated.
type ListAppsRequest ¶ added in v0.1.69
type ListCertificatesOpts ¶ added in v0.3.1
type ListIPAssignmentsResponse ¶ added in v0.1.67
type ListIPAssignmentsResponse struct {
IPs []IPAssignment `json:"ips"`
}
type ListManagedPostgresClustersRequest ¶ added in v0.9.8
ListManagedPostgresClustersRequest contains the query parameters for GET /v1/postgres.
type ManagedPostgresAttachedApp ¶ added in v0.9.4
type ManagedPostgresAttachedApp struct {
Name string `json:"name"`
}
type ManagedPostgresAttachment ¶ added in v0.9.13
type ManagedPostgresAttachment struct {
PostgresClusterID string `json:"postgres_cluster_id"`
AppName string `json:"app_name"`
AttachedAt string `json:"attached_at"`
}
ManagedPostgresAttachment is the public projection of an attachment between a Managed Postgres cluster and an app.
type ManagedPostgresBackup ¶ added in v0.9.10
type ManagedPostgresBackup struct {
ID string `json:"id"`
Status string `json:"status"`
Type string `json:"type"`
SizeBytes int64 `json:"size_bytes"`
StartedAt string `json:"started_at"`
FinishedAt string `json:"finished_at"`
}
ManagedPostgresBackup is the public projection of a backup belonging to a Managed Postgres cluster.
type ManagedPostgresCluster ¶ added in v0.9.4
type ManagedPostgresCluster struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Region string `json:"region"`
Plan string `json:"plan"`
DiskSizeGB int `json:"disk_size_gb"`
StorageUsedBytes *int64 `json:"storage_used_bytes"`
StorageProvisionedBytes *int64 `json:"storage_provisioned_bytes"`
CPUs int `json:"cpus"`
CPUKind string `json:"cpu_kind"`
MemoryMB int `json:"memory_mb"`
Replicas int `json:"replicas"`
PGMajorVersion string `json:"pg_major_version"`
PostGISEnabled bool `json:"postgis_enabled"`
Endpoints ManagedPostgresEndpoints `json:"endpoints"`
Organization ManagedPostgresOrganization `json:"organization"`
CreatedAt string `json:"created_at"`
AttachedApps []ManagedPostgresAttachedApp `json:"attached_apps"`
}
ManagedPostgresCluster is the public projection of a Managed Postgres cluster returned by create/show.
type ManagedPostgresClusterSummary ¶ added in v0.9.8
type ManagedPostgresClusterSummary struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Region string `json:"region"`
Plan string `json:"plan"`
CreatedAt string `json:"created_at"`
DeletedAt string `json:"deleted_at"`
AttachedApps []ManagedPostgresAttachedApp `json:"attached_apps"`
}
ManagedPostgresClusterSummary is the public projection returned by GET /v1/postgres.
type ManagedPostgresDatabase ¶ added in v0.9.9
type ManagedPostgresDatabase struct {
Name string `json:"name"`
}
ManagedPostgresDatabase is the public projection of a database within a Managed Postgres cluster returned by list/create.
type ManagedPostgresEndpoint ¶ added in v0.9.4
type ManagedPostgresEndpoints ¶ added in v0.9.4
type ManagedPostgresEndpoints struct {
Primary struct {
Direct ManagedPostgresEndpoint `json:"direct"`
Pooler ManagedPostgresEndpoint `json:"pooler"`
} `json:"primary"`
}
type ManagedPostgresExtension ¶ added in v0.9.12
type ManagedPostgresExtension struct {
Name string `json:"name"`
Description *string `json:"description"`
DefaultVersion *string `json:"default_version"`
System bool `json:"system"`
Installed *ManagedPostgresInstalledExtension `json:"installed"`
}
ManagedPostgresExtension is the public projection of an extension available to a database.
type ManagedPostgresInstalledExtension ¶ added in v0.9.12
type ManagedPostgresInstalledExtension struct {
Version string `json:"version"`
Schema string `json:"schema"`
}
ManagedPostgresInstalledExtension describes an installed extension version and schema.
type ManagedPostgresOrganization ¶ added in v0.9.4
type ManagedPostgresPlan ¶ added in v0.11.5
type ManagedPostgresPlan struct {
// Plan is the slug to pass as plan on create/fork, e.g. "basic". Slugs
// are not uniformly lowercase ("Performance" is capitalized).
Plan string `json:"plan"`
// CPUKind is "shared" or "performance".
CPUKind string `json:"cpu_kind"`
CPUs int `json:"cpus"`
MemoryMB int `json:"memory_mb"`
MonthlyPriceUSD int `json:"monthly_price_usd"`
}
ManagedPostgresPlan is the public projection of a Managed Postgres plan returned by GET /v1/postgres/plans.
type ManagedPostgresUser ¶ added in v0.9.12
type ManagedPostgresUser struct {
Username string `json:"username"`
Role ManagedPostgresUserRole `json:"role"`
}
ManagedPostgresUser is the public projection of a user within a Managed Postgres cluster.
type ManagedPostgresUserCredentials ¶ added in v0.9.4
type ManagedPostgresUserCredentials struct {
Username string `json:"username"`
Password string `json:"password"`
}
ManagedPostgresUserCredentials is the response from GET /v1/postgres/:id/users/:username/credentials.
type ManagedPostgresUserRole ¶ added in v0.9.12
type ManagedPostgresUserRole string
ManagedPostgresUserRole is a role assigned to a Managed Postgres user.
const ( ManagedPostgresUserRoleSchemaAdmin ManagedPostgresUserRole = "schema_admin" ManagedPostgresUserRoleWriter ManagedPostgresUserRole = "writer" ManagedPostgresUserRoleReader ManagedPostgresUserRole = "reader" )
Roles the API accepts when creating or updating a Managed Postgres user.
type NewClientOpts ¶
type NewClientOpts struct {
// optional, sent with requests
UserAgent string
Tokens *tokens.Tokens
// optional:
Logger fly.Logger
FlyForceInstanceID string
// optional, used to construct the underlying HTTP client
Transport http.RoundTripper
// optional; if non-nil, attaches the Fly-Client-* headers/UA suffix
// derived from these signals
ClientSignals *clientsignals.Signals
}
type RegionData ¶ added in v0.1.67
type RegionPlacement ¶ added in v0.1.47
type RestoreManagedPostgresClusterRequest ¶ added in v0.9.11
type RestoreManagedPostgresClusterRequest struct {
BackupID string `json:"backup_id,omitempty"`
PITRTime string `json:"pitr_time,omitempty"`
Name string `json:"name,omitempty"`
}
RestoreManagedPostgresClusterRequest is the body for POST /v1/postgres/:id/restore. Exactly one of BackupID or PITRTime is required by the API; Name is optional.
type RotateManagedPostgresUserPasswordRequest ¶ added in v0.11.3
type RotateManagedPostgresUserPasswordRequest struct {
KillSessions bool `json:"kill_sessions,omitempty"`
}
RotateManagedPostgresUserPasswordRequest is the body for POST /v1/postgres/:id/users/:username/rotate_password.
type StatusCode ¶
type StatusCode string
func GetErrorStatusCode ¶
func GetErrorStatusCode(err error) *StatusCode
type UpdateManagedPostgresUserRoleRequest ¶ added in v0.9.12
type UpdateManagedPostgresUserRoleRequest struct {
Role string `json:"role"`
}
UpdateManagedPostgresUserRoleRequest is the body for PATCH /v1/postgres/:id/users/:username.
type WaitOption ¶ added in v0.4.0
type WaitOption func(*waitOptions)
func WithWaitFromEventID ¶ added in v0.4.0
func WithWaitFromEventID(fromEventID string) WaitOption
func WithWaitStates ¶ added in v0.4.0
func WithWaitStates(states ...string) WaitOption
func WithWaitTimeout ¶ added in v0.4.0
func WithWaitTimeout(timeout time.Duration) WaitOption
func WithWaitVersion ¶ added in v0.4.0
func WithWaitVersion(version string) WaitOption