v1

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextWithClient

func NewContextWithClient(ctx context.Context, c ClientV1) context.Context

NewContext derives a Context that carries c from ctx.

Types

type Client

type Client struct {
	*uiex.Client
}

func NewClientWithOptions

func NewClientWithOptions(ctx context.Context, opts uiex.NewClientOpts) (*Client, error)

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

func (*Client) CreateAttachment

func (c *Client) CreateAttachment(ctx context.Context, clusterId string, input CreateAttachmentInput) (CreateAttachmentResponse, error)

CreateAttachment creates a ManagedServiceAttachment record linking an app to a managed Postgres cluster

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(ctx context.Context, id string, input CreateDatabaseInput) (CreateDatabaseResponse, error)

func (*Client) CreateManagedClusterBackup

func (c *Client) CreateManagedClusterBackup(ctx context.Context, clusterID string, input CreateManagedClusterBackupInput) (CreateManagedClusterBackupResponse, error)

CreateManagedClusterBackup creates a new backup for a managed Postgres cluster

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, id string, input CreateUserInput) (CreateUserResponse, error)

func (*Client) CreateUserWithRole

func (c *Client) CreateUserWithRole(ctx context.Context, id string, input CreateUserWithRoleInput) (CreateUserWithRoleResponse, error)

func (*Client) DeleteAttachment

func (c *Client) DeleteAttachment(ctx context.Context, clusterId string, appName string) (DeleteAttachmentResponse, error)

DeleteAttachment removes a ManagedServiceAttachment record linking an app to a managed Postgres cluster

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, id string, username string) error

func (*Client) DestroyCluster

func (c *Client) DestroyCluster(ctx context.Context, orgSlug string, id string) error

DestroyCluster permanently destroys a managed Postgres cluster

func (*Client) DisableExtension added in v0.4.68

func (c *Client) DisableExtension(ctx context.Context, id, database, name string, force bool) error

DisableExtension drops a Postgres extension from the given database.

func (*Client) EnableExtension added in v0.4.68

func (c *Client) EnableExtension(ctx context.Context, id, database string, input EnableExtensionInput) error

EnableExtension installs a Postgres extension in the given database.

func (*Client) GetManagedCluster

func (c *Client) GetManagedCluster(ctx context.Context, orgSlug string, id string) (GetManagedClusterResponse, error)

func (*Client) GetManagedClusterById

func (c *Client) GetManagedClusterById(ctx context.Context, id string) (GetManagedClusterResponse, error)

func (*Client) GetUserCredentials

func (c *Client) GetUserCredentials(ctx context.Context, id string, username string) (GetUserCredentialsResponse, error)

func (*Client) HTTPClient

func (c *Client) HTTPClient() *http.Client

func (*Client) ListDatabases

func (c *Client) ListDatabases(ctx context.Context, id string) (ListDatabasesResponse, error)

func (*Client) ListExtensions added in v0.4.68

func (c *Client) ListExtensions(ctx context.Context, id, database string) (ListExtensionsResponse, error)

ListExtensions returns the catalog of available Postgres extensions for the given database, along with whether each one is currently installed.

func (*Client) ListManagedClusterBackups

func (c *Client) ListManagedClusterBackups(ctx context.Context, clusterID string) (ListManagedClusterBackupsResponse, error)

ListManagedClusterBackups returns the list of backups for a managed Postgres cluster

func (*Client) ListManagedClusters

func (c *Client) ListManagedClusters(ctx context.Context, orgSlug string, deleted bool) (ListManagedClustersResponse, error)

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, id string) (ListUsersResponse, error)

func (*Client) RestoreManagedClusterBackup

func (c *Client) RestoreManagedClusterBackup(ctx context.Context, clusterID string, input RestoreManagedClusterBackupInput) (RestoreManagedClusterBackupResponse, error)

RestoreManagedClusterBackup restores a managed Postgres cluster from a backup

func (*Client) UpdateUserRole

func (c *Client) UpdateUserRole(ctx context.Context, id string, username string, input UpdateUserRoleInput) (UpdateUserRoleResponse, error)

type ClientV1

type ClientV1 interface {
	// List clusters. NOTE: Odd but the v1 client endpoint returns both v1 and v2 clusters,
	// they are just identified with the `Version` field being 1 or 2.
	ListManagedClusters(ctx context.Context, orgSlug string, deleted bool) (ListManagedClustersResponse, error)
	GetManagedCluster(ctx context.Context, orgSlug string, id string) (GetManagedClusterResponse, error)
	GetManagedClusterById(ctx context.Context, id string) (GetManagedClusterResponse, error)
	CreateUser(ctx context.Context, id string, input CreateUserInput) (CreateUserResponse, error)
	CreateUserWithRole(ctx context.Context, id string, input CreateUserWithRoleInput) (CreateUserWithRoleResponse, error)
	UpdateUserRole(ctx context.Context, id string, username string, input UpdateUserRoleInput) (UpdateUserRoleResponse, error)
	DeleteUser(ctx context.Context, id string, username string) error
	GetUserCredentials(ctx context.Context, id string, username string) (GetUserCredentialsResponse, error)
	ListUsers(ctx context.Context, id string) (ListUsersResponse, error)
	ListDatabases(ctx context.Context, id string) (ListDatabasesResponse, error)
	CreateDatabase(ctx context.Context, id string, input CreateDatabaseInput) (CreateDatabaseResponse, error)
	ListExtensions(ctx context.Context, id, database string) (ListExtensionsResponse, error)
	EnableExtension(ctx context.Context, id, database string, input EnableExtensionInput) error
	DisableExtension(ctx context.Context, id, database, name string, force bool) error
	DestroyCluster(ctx context.Context, orgSlug string, id string) error
	ListManagedClusterBackups(ctx context.Context, clusterID string) (ListManagedClusterBackupsResponse, error)
	CreateManagedClusterBackup(ctx context.Context, clusterID string, input CreateManagedClusterBackupInput) (CreateManagedClusterBackupResponse, error)
	RestoreManagedClusterBackup(ctx context.Context, clusterID string, input RestoreManagedClusterBackupInput) (RestoreManagedClusterBackupResponse, error)
	CreateAttachment(ctx context.Context, clusterId string, input CreateAttachmentInput) (CreateAttachmentResponse, error)
	DeleteAttachment(ctx context.Context, clusterId string, appName string) (DeleteAttachmentResponse, error)
}

func ClientFromContext

func ClientFromContext(ctx context.Context) ClientV1

ClientFromContext returns the ClientV1 ctx carries.

type CreateAttachmentInput

type CreateAttachmentInput struct {
	AppName string `json:"app_name"`
}

type CreateAttachmentResponse

type CreateAttachmentResponse struct {
	Data struct {
		Id               int64  `json:"id"`
		AppId            int64  `json:"app_id"`
		ManagedServiceId int64  `json:"managed_service_id"`
		AttachedAt       string `json:"attached_at"`
	} `json:"data"`
}

type CreateDatabaseInput

type CreateDatabaseInput struct {
	Name string `json:"name"`
}

type CreateDatabaseResponse

type CreateDatabaseResponse struct {
	Data Database `json:"data"`
}

type CreateManagedClusterBackupInput

type CreateManagedClusterBackupInput struct {
	Type string `json:"type"`
}

type CreateManagedClusterBackupResponse

type CreateManagedClusterBackupResponse struct {
	Data ManagedClusterBackup `json:"data"`
}

type CreateUserInput

type CreateUserInput struct {
	DbName   string `json:"db_name"`
	UserName string `json:"user_name"`
}

type CreateUserResponse

type CreateUserResponse struct {
	ConnectionUri string              `json:"connection_uri"`
	Ok            bool                `json:"ok"`
	Errors        uiex.DetailedErrors `json:"errors"`
}

type CreateUserWithRoleInput

type CreateUserWithRoleInput struct {
	UserName string `json:"user_name"`
	Role     string `json:"role"` // 'schema_admin' | 'writer' | 'reader'
}

type CreateUserWithRoleResponse

type CreateUserWithRoleResponse struct {
	Data User `json:"data"`
}

type Database

type Database struct {
	Name string `json:"name"`
}

type DeleteAttachmentResponse

type DeleteAttachmentResponse struct {
	Data struct {
		Message string `json:"message"`
	} `json:"data"`
}

type EnableExtensionInput added in v0.4.68

type EnableExtensionInput struct {
	Name                 string `json:"name"`
	Schema               string `json:"schema,omitempty"`
	CreateSchemaIfNeeded bool   `json:"create_schema_if_needed"`
}

type Extension added in v0.4.68

type Extension struct {
	Name           string              `json:"name"`
	Description    string              `json:"description"`
	DocsURL        string              `json:"docs_url"`
	DefaultVersion string              `json:"default_version"`
	IsSystem       bool                `json:"is_system"`
	Installed      *InstalledExtension `json:"installed"`
}

type GetManagedClusterCredentialsResponse

type GetManagedClusterCredentialsResponse struct {
	Status        string `json:"status"`
	User          string `json:"user"`
	Password      string `json:"password"`
	DBName        string `json:"dbname"`
	ConnectionUri string `json:"pgbouncer_uri"`
}

type GetManagedClusterResponse

type GetManagedClusterResponse struct {
	Data        ManagedCluster                       `json:"data"`
	Credentials GetManagedClusterCredentialsResponse `json:"credentials"`
}

type GetUserCredentialsResponse

type GetUserCredentialsResponse struct {
	Data struct {
		User     string `json:"user"`
		Password string `json:"password"`
	} `json:"data"`
}

type InstalledExtension added in v0.4.68

type InstalledExtension struct {
	Version string `json:"version"`
	Schema  string `json:"schema"`
}

type ListDatabasesResponse

type ListDatabasesResponse struct {
	Data []Database `json:"data"`
}

type ListExtensionsResponse added in v0.4.68

type ListExtensionsResponse struct {
	Data []Extension `json:"data"`
}

type ListManagedClusterBackupsResponse

type ListManagedClusterBackupsResponse struct {
	Data []ManagedClusterBackup `json:"data"`
}

type ListManagedClustersResponse

type ListManagedClustersResponse struct {
	Data []ManagedCluster `json:"data"`
}

type ListUsersResponse

type ListUsersResponse struct {
	Data []User `json:"data"`
}

type ManagedCluster

type ManagedCluster struct {
	Id            string                          `json:"id"`
	ClusterId     string                          `json:"mpgd_cluster_id"`
	Version       int                             `json:"version"`
	Name          string                          `json:"name"`
	Region        string                          `json:"region"`
	Status        string                          `json:"status"`
	Plan          string                          `json:"plan"`
	Disk          int                             `json:"disk"`
	Replicas      int                             `json:"replicas"`
	Organization  fly.Organization                `json:"organization"`
	IpAssignments mpg.ManagedClusterIpAssignments `json:"ip_assignments"`
	AttachedApps  []mpg.AttachedApp               `json:"attached_apps"`
}

type ManagedClusterBackup

type ManagedClusterBackup struct {
	Id     string `json:"id"`
	Status string `json:"status"`
	Type   string `json:"type"`
	Start  string `json:"start"`
	Stop   string `json:"stop"`
}

type RestoreManagedClusterBackupInput

type RestoreManagedClusterBackupInput struct {
	BackupId string `json:"backup_id"`
	Name     string `json:"name,omitempty"`
}

type RestoreManagedClusterBackupResponse

type RestoreManagedClusterBackupResponse struct {
	Data ManagedCluster `json:"data"`
}

type UpdateUserRoleInput

type UpdateUserRoleInput struct {
	Role string `json:"role"` // 'schema_admin' | 'writer' | 'reader'
}

type UpdateUserRoleResponse

type UpdateUserRoleResponse struct {
	Data User `json:"data"`
}

type User

type User struct {
	Name string `json:"name"`
	Role string `json:"role"`
}

Jump to

Keyboard shortcuts

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