Documentation
¶
Index ¶
- func NewContextWithClient(ctx context.Context, c ClientV1) context.Context
- type Client
- func (c *Client) BaseURL() *url.URL
- func (c *Client) CreateAttachment(ctx context.Context, clusterId string, input CreateAttachmentInput) (CreateAttachmentResponse, error)
- func (c *Client) CreateCluster(ctx context.Context, input CreateClusterInput) (CreateClusterResponse, error)
- func (c *Client) CreateDatabase(ctx context.Context, id string, input CreateDatabaseInput) (CreateDatabaseResponse, error)
- func (c *Client) CreateManagedClusterBackup(ctx context.Context, clusterID string, input CreateManagedClusterBackupInput) (CreateManagedClusterBackupResponse, error)
- func (c *Client) CreateUser(ctx context.Context, id string, input CreateUserInput) (CreateUserResponse, error)
- func (c *Client) CreateUserWithRole(ctx context.Context, id string, input CreateUserWithRoleInput) (CreateUserWithRoleResponse, error)
- func (c *Client) DeleteAttachment(ctx context.Context, clusterId string, appName string) (DeleteAttachmentResponse, error)
- func (c *Client) DeleteUser(ctx context.Context, id string, username string) error
- func (c *Client) DestroyCluster(ctx context.Context, orgSlug string, id string) error
- func (c *Client) GetManagedCluster(ctx context.Context, orgSlug string, id string) (GetManagedClusterResponse, error)
- func (c *Client) GetManagedClusterById(ctx context.Context, id string) (GetManagedClusterResponse, error)
- func (c *Client) GetUserCredentials(ctx context.Context, id string, username string) (GetUserCredentialsResponse, error)
- func (c *Client) HTTPClient() *http.Client
- func (c *Client) ListDatabases(ctx context.Context, id string) (ListDatabasesResponse, error)
- func (c *Client) ListMPGRegions(ctx context.Context, orgSlug string) (ListMPGRegionsResponse, error)
- func (c *Client) ListManagedClusterBackups(ctx context.Context, clusterID string) (ListManagedClusterBackupsResponse, error)
- func (c *Client) ListManagedClusters(ctx context.Context, orgSlug string, deleted bool) (ListManagedClustersResponse, error)
- func (c *Client) ListUsers(ctx context.Context, id string) (ListUsersResponse, error)
- func (c *Client) RestoreManagedClusterBackup(ctx context.Context, clusterID string, input RestoreManagedClusterBackupInput) (RestoreManagedClusterBackupResponse, error)
- func (c *Client) UpdateUserRole(ctx context.Context, id string, username string, input UpdateUserRoleInput) (UpdateUserRoleResponse, error)
- type ClientV1
- type CreateAttachmentInput
- type CreateAttachmentResponse
- type CreateClusterInput
- type CreateClusterResponse
- type CreateDatabaseInput
- type CreateDatabaseResponse
- type CreateManagedClusterBackupInput
- type CreateManagedClusterBackupResponse
- type CreateUserInput
- type CreateUserResponse
- type CreateUserWithRoleInput
- type CreateUserWithRoleResponse
- type Database
- type DeleteAttachmentResponse
- type GetManagedClusterCredentialsResponse
- type GetManagedClusterResponse
- type GetUserCredentialsResponse
- type ListDatabasesResponse
- type ListMPGRegionsResponse
- type ListManagedClusterBackupsResponse
- type ListManagedClustersResponse
- type ListUsersResponse
- type MPGRegion
- type ManagedCluster
- type ManagedClusterBackup
- type RestoreManagedClusterBackupInput
- type RestoreManagedClusterBackupResponse
- type UpdateUserRoleInput
- type UpdateUserRoleResponse
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
func NewClientWithOptions ¶
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) CreateCluster ¶
func (c *Client) CreateCluster(ctx context.Context, input CreateClusterInput) (CreateClusterResponse, error)
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 (*Client) DestroyCluster ¶
DestroyCluster permanently destroys a managed Postgres cluster
func (*Client) GetManagedCluster ¶
func (*Client) GetManagedClusterById ¶
func (*Client) GetUserCredentials ¶
func (*Client) HTTPClient ¶
func (*Client) ListDatabases ¶
func (*Client) ListMPGRegions ¶
func (c *Client) ListMPGRegions(ctx context.Context, orgSlug string) (ListMPGRegionsResponse, error)
ListMPGRegions returns the list of regions available for Managed Postgres TODO: Implement the actual API endpoint on the backend
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 (*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)
ListMPGRegions(ctx context.Context, orgSlug string) (ListMPGRegionsResponse, 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)
CreateCluster(ctx context.Context, input CreateClusterInput) (CreateClusterResponse, 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 ¶
ClientFromContext returns the ClientV1 ctx carries.
type CreateAttachmentInput ¶
type CreateAttachmentInput struct {
AppName string `json:"app_name"`
}
type CreateClusterInput ¶
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 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 CreateUserResponse ¶
type CreateUserResponse struct {
ConnectionUri string `json:"connection_uri"`
Ok bool `json:"ok"`
Errors uiex.DetailedErrors `json:"errors"`
}
type CreateUserWithRoleInput ¶
type CreateUserWithRoleResponse ¶
type CreateUserWithRoleResponse struct {
Data User `json:"data"`
}
type DeleteAttachmentResponse ¶
type DeleteAttachmentResponse struct {
Data struct {
Message string `json:"message"`
} `json:"data"`
}
type GetManagedClusterResponse ¶
type GetManagedClusterResponse struct {
Data ManagedCluster `json:"data"`
Credentials GetManagedClusterCredentialsResponse `json:"credentials"`
}
type ListDatabasesResponse ¶
type ListDatabasesResponse struct {
Data []Database `json:"data"`
}
type ListMPGRegionsResponse ¶
type ListMPGRegionsResponse struct {
Data []MPGRegion `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 RestoreManagedClusterBackupInput ¶
type RestoreManagedClusterBackupInput struct {
BackupId string `json:"backup_id"`
}
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"`
}