v2

package
v0.4.49 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextWithClient

func NewContextWithClient(ctx context.Context, c ClientV2) 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)

func (*Client) CreateCluster

func (c *Client) CreateCluster(ctx context.Context, input CreateClusterInput) (CreateClusterResponse, error)

func (*Client) CreateClusterBackup

func (c *Client) CreateClusterBackup(ctx context.Context, clusterID string, input CreateClusterBackupInput) error

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(ctx context.Context, id string, input CreateDatabaseInput) 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)

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

func (*Client) GetCluster

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

func (*Client) GetClusterById

func (c *Client) GetClusterById(ctx context.Context, id string) (GetClusterResponse, 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) ListClusterBackups

func (c *Client) ListClusterBackups(ctx context.Context, clusterID string) (ListClusterBackupsResponse, error)

func (*Client) ListDatabases

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

func (*Client) ListRegions

func (c *Client) ListRegions(ctx context.Context, orgSlug string) (ListRegionsResponse, error)

func (*Client) ListUsers

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

func (*Client) RestoreClusterBackup

func (c *Client) RestoreClusterBackup(ctx context.Context, clusterID string, input RestoreClusterBackupInput) (RestoreClusterBackupResponse, error)

func (*Client) UpdateUserRole

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

type ClientV2

type ClientV2 interface {
	GetCluster(ctx context.Context, orgSlug string, id string) (GetClusterResponse, error)
	GetClusterById(ctx context.Context, id string) (GetClusterResponse, error)
	ListRegions(ctx context.Context, orgSlug string) (ListRegionsResponse, error)
	CreateUserWithRole(ctx context.Context, id string, input CreateUserWithRoleInput) (CreateUserWithRoleResponse, error)
	UpdateUserRole(ctx context.Context, id string, username string, input UpdateUserRoleInput) 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) error
	CreateCluster(ctx context.Context, input CreateClusterInput) (CreateClusterResponse, error)
	DestroyCluster(ctx context.Context, orgSlug string, id string) error
	ListClusterBackups(ctx context.Context, clusterID string) (ListClusterBackupsResponse, error)
	CreateClusterBackup(ctx context.Context, clusterID string, input CreateClusterBackupInput) error
	RestoreClusterBackup(ctx context.Context, clusterID string, input RestoreClusterBackupInput) (RestoreClusterBackupResponse, 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) ClientV2

ClientFromContext returns the ClientV2 ctx carries.

type ClusterBackup

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

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 CreateClusterBackupInput

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

type CreateClusterInput

type CreateClusterInput struct {
	Name           string `json:"name"`
	Region         string `json:"region"`
	OrgSlug        string `json:"org_slug"`
	Plan           string `json:"plan"`
	PGMajorVersion string `json:"pg_major_version"`
	StorageInGb    int    `json:"storage_in_gb"`
	PostGISEnabled bool   `json:"postgis_enabled"`
}

type CreateClusterResponse

type CreateClusterResponse struct {
	Ok     bool                `json:"ok"`
	Errors uiex.DetailedErrors `json:"errors"`
	Data   struct {
		Id             string                          `json:"id"`
		Name           string                          `json:"name"`
		Status         *string                         `json:"status"`
		Plan           string                          `json:"plan"`
		Environment    *string                         `json:"environment"`
		Region         string                          `json:"region"`
		Organization   fly.Organization                `json:"organization"`
		Replicas       int                             `json:"replicas"`
		Disk           int                             `json:"disk"`
		IpAssignments  mpg.ManagedClusterIpAssignments `json:"ip_assignments"`
		PostGISEnabled bool                            `json:"postgis_enabled"`
	} `json:"data"`
}

type CreateDatabaseInput

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

type CreateUserWithRoleInput

type CreateUserWithRoleInput struct {
	Username string `json:"username"`
	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 GetClusterCredentialsResponse

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

type GetClusterResponse

type GetClusterResponse struct {
	Data        ManagedCluster                `json:"data"`
	Credentials GetClusterCredentialsResponse `json:"credentials"`
}

type GetUserCredentialsResponse

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

type ListClusterBackupsResponse

type ListClusterBackupsResponse struct {
	Data []ClusterBackup `json:"data"`
}

type ListDatabasesResponse

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

type ListRegionsResponse

type ListRegionsResponse struct {
	Data []Region `json:"data"`
}

type ListUsersResponse

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

type ManagedCluster

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

type Region

type Region struct {
	Code      string `json:"code"`      // e.g., "fra"
	Available bool   `json:"available"` // Whether this region supports MPG
}

type RestoreClusterBackupInput

type RestoreClusterBackupInput struct {
	BackupId string `json:"backup_id"`
}

type RestoreClusterBackupResponse

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

type UpdateUserRoleInput

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

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