Documentation
¶
Index ¶
- Constants
- func ClusterURL(c *gcorecloud.ServiceClient, clusterName string) string
- func Create(client *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)
- func Delete(client *gcorecloud.ServiceClient, clusterName string, opts DeleteOptsBuilder) (r tasks.Result)
- func ExtractClusterNameFromTask(task *tasks.Task) (string, error)
- func ExtractClustersInto(r pagination.Page, v interface{}) error
- func IsValidRoleAttribute(s string) bool
- func List(client *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func RoleAttributeSliceToStrings(roleAttributes []RoleAttribute) []string
- func RoleAttributeStringList() []string
- func Update(client *gcorecloud.ServiceClient, clusterName string, opts UpdateOptsBuilder) (r tasks.Result)
- type ClusterPage
- type ClusterStatus
- type ClusterTaskResult
- type CreateOpts
- type CreateOptsBuilder
- type DatabaseOpts
- type DatabaseOverview
- type DeleteOpts
- type DeleteOptsBuilder
- type Flavor
- type FlavorOpts
- type GetResult
- type HighAvailability
- type HighAvailabilityOpts
- type HighAvailabilityReplicationMode
- type ListOpts
- type ListOptsBuilder
- type Network
- type NetworkOpts
- type PGServerConfiguration
- type PGServerConfigurationOpts
- type PGServerConfigurationUpdateOpts
- type PGStorageConfiguration
- type PGStorageConfigurationOpts
- type PGStorageConfigurationUpdateOpts
- type PgUserOpts
- type PgUserOverview
- type Pooler
- type PoolerMode
- type PoolerOpts
- type PostgresSQLCluster
- type PostgresSQLClusterShort
- type RoleAttribute
- type UpdateOpts
- type UpdateOptsBuilder
Constants ¶
const ( HighAvailabilityReplicationModeAsync HighAvailabilityReplicationMode = "async" HighAvailabilityReplicationModeSync HighAvailabilityReplicationMode = "sync" PoolerModeSession PoolerMode = "session" PoolerModeStatement PoolerMode = "statement" PoolerModeTransaction PoolerMode = "transaction" ClusterStatusDeleting ClusterStatus = "DELETING" ClusterStatusFailed ClusterStatus = "FAILED" ClusterStatusPreparing ClusterStatus = "PREPARING" ClusterStatusReady ClusterStatus = "READY" ClusterStatusUnhealthy ClusterStatus = "UNHEALTHY" ClusterStatusUpdating ClusterStatus = "UPDATING" ClusterStatusUnknown ClusterStatus = "UNKNOWN" RoleAttributeBypassRLS RoleAttribute = "BYPASSRLS" RoleAttributeCreateRole RoleAttribute = "CREATEROLE" RoleAttributeCreateDB RoleAttribute = "CREATEDB" RoleAttributeInherit RoleAttribute = "INHERIT" RoleAttributeLogin RoleAttribute = "LOGIN" RoleAttributeNoLogin RoleAttribute = "NOLOGIN" )
Variables ¶
This section is empty.
Functions ¶
func ClusterURL ¶
func ClusterURL(c *gcorecloud.ServiceClient, clusterName string) string
ClusterURL returns the URL for specific PostgreSQL cluster operations
func Create ¶
func Create(client *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)
Create creates a new PostgreSQL cluster.
func Delete ¶
func Delete(client *gcorecloud.ServiceClient, clusterName string, opts DeleteOptsBuilder) (r tasks.Result)
Delete deletes a specific PostgreSQL cluster.
func ExtractClustersInto ¶
func ExtractClustersInto(r pagination.Page, v interface{}) error
func IsValidRoleAttribute ¶
func List ¶
func List(client *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List retrieves PostgreSQL clusters.
func RoleAttributeSliceToStrings ¶
func RoleAttributeSliceToStrings(roleAttributes []RoleAttribute) []string
func RoleAttributeStringList ¶
func RoleAttributeStringList() []string
func Update ¶
func Update(client *gcorecloud.ServiceClient, clusterName string, opts UpdateOptsBuilder) (r tasks.Result)
Update updates a new PostgreSQL cluster.
Types ¶
type ClusterPage ¶
type ClusterPage struct {
pagination.OffsetPageBase
}
ClusterPage is the page returned by a pager when traversing over a collection of PG clusters.
type ClusterStatus ¶
type ClusterStatus string
type ClusterTaskResult ¶
type ClusterTaskResult struct {
PostgresClusters []string `mapstructure:"postgresql_clusters"`
}
type CreateOpts ¶
type CreateOpts struct {
ClusterName string `json:"cluster_name" validate:"required"`
Databases []DatabaseOpts `json:"databases" validate:"required,dive"`
Flavor FlavorOpts `json:"flavor" validate:"required"`
HighAvailability *HighAvailabilityOpts `json:"high_availability" validate:"omitempty"`
Network NetworkOpts `json:"network" validate:"required"`
PGServerConfiguration PGServerConfigurationOpts `json:"pg_server_configuration" validate:"required"`
Storage PGStorageConfigurationOpts `json:"storage" validate:"required"`
Users []PgUserOpts `json:"users" validate:"required,dive"`
}
CreateOpts specifies the parameters for the Create method.
func (CreateOpts) ToCreateMap ¶
func (opts CreateOpts) ToCreateMap() (map[string]interface{}, error)
ToCreateMap builds a request body from CreateOpts.
func (CreateOpts) Validate ¶
func (opts CreateOpts) Validate() error
Validate checks if the provided options are valid.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type DatabaseOpts ¶
type DatabaseOverview ¶
type DeleteOpts ¶
type DeleteOpts struct{}
DeleteOpts specifies the parameters for the Delete method.
func (DeleteOpts) ToClusterDeleteQuery ¶
func (d DeleteOpts) ToClusterDeleteQuery() (string, error)
type DeleteOptsBuilder ¶
DeleteOptsBuilder allows extensions to add parameters to delete cluster options.
type FlavorOpts ¶
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a PG Cluster.
func Get ¶
func Get(client *gcorecloud.ServiceClient, clusterName string) (r GetResult)
func (GetResult) Extract ¶
func (r GetResult) Extract() (*PostgresSQLCluster, error)
Extract is a function that accepts a result and extracts a PostgreSQL cluster resource.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type HighAvailability ¶
type HighAvailability struct {
ReplicationMode HighAvailabilityReplicationMode `json:"replication_mode"`
}
type HighAvailabilityOpts ¶
type HighAvailabilityOpts struct {
ReplicationMode HighAvailabilityReplicationMode `json:"replication_mode" validate:"required,oneof=async sync"`
}
type HighAvailabilityReplicationMode ¶
type HighAvailabilityReplicationMode string
type ListOpts ¶
type ListOpts struct {
Limit int `q:"limit" validate:"omitempty,gt=0"`
Offset int `q:"offset" validate:"omitempty,gte=0"`
}
ListOpts allows the filtering and sorting of paginated collections through the API.
func (ListOpts) ToListClustersQuery ¶
ToListClustersQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type NetworkOpts ¶
type PGServerConfiguration ¶
type PGServerConfigurationOpts ¶
type PGServerConfigurationOpts struct {
PGConf string `json:"pg_conf" validate:"required"`
Version string `json:"version" validate:"required"`
Pooler *PoolerOpts `json:"pooler,omitempty" validate:"omitempty"`
}
type PGServerConfigurationUpdateOpts ¶
type PGServerConfigurationUpdateOpts struct {
PGConf string `json:"pg_conf,omitempty" validate:"omitempty"`
Version string `json:"version,omitempty" validate:"omitempty"`
Pooler *PoolerOpts `json:"pooler,omitempty" validate:"omitempty"`
}
type PGStorageConfiguration ¶
type PGStorageConfigurationUpdateOpts ¶
type PGStorageConfigurationUpdateOpts struct {
SizeGiB int `json:"size_gib" validate:"required,gte=1,lte=100"`
}
type PgUserOpts ¶
type PgUserOpts struct {
Name string `json:"name" validate:"required"`
RoleAttributes []RoleAttribute `json:"role_attributes" validate:"required,min=1,dive,oneof=BYPASSRLS CREATEROLE CREATEDB INHERIT LOGIN NOLOGIN"`
}
type PgUserOverview ¶
type PgUserOverview struct {
IsSecretRevealed bool `json:"is_secret_revealed"`
Name string `json:"name"`
RoleAttributes []RoleAttribute `json:"role_attributes"`
}
type Pooler ¶
type Pooler struct {
Mode PoolerMode `json:"mode"`
Type string `json:"type"`
}
type PoolerMode ¶
type PoolerMode string
type PoolerOpts ¶
type PoolerOpts struct {
Mode PoolerMode `json:"mode" validate:"required,oneof=session statement transaction"`
Type string `json:"type" validate:"oneof=pgbouncer"`
}
type PostgresSQLCluster ¶
type PostgresSQLCluster struct {
ClusterName string `json:"cluster_name"`
CreatedAt gcorecloud.JSONRFC3339Z `json:"created_at"`
Databases []DatabaseOverview `json:"databases"`
Flavor Flavor `json:"flavor"`
HighAvailability *HighAvailability `json:"high_availability"`
Network Network `json:"network"`
PGServerConfiguration PGServerConfiguration `json:"pg_server_configuration"`
Status ClusterStatus `json:"status"`
Storage PGStorageConfiguration `json:"storage"`
Users []PgUserOverview `json:"users"`
}
type PostgresSQLClusterShort ¶
type PostgresSQLClusterShort struct {
ClusterName string `json:"cluster_name"`
CreatedAt gcorecloud.JSONRFC3339Z `json:"created_at"`
Status ClusterStatus `json:"status"`
Version string `json:"version"`
}
func ExtractClusters ¶
func ExtractClusters(r pagination.Page) ([]PostgresSQLClusterShort, error)
ExtractClusters accepts a Page struct, specifically a ClusterPage struct, and extracts the elements into a slice of PG cluster structs. In other words, a generic collection is mapped into a relevant slice.
func ListAll ¶
func ListAll(client *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]PostgresSQLClusterShort, error)
ListAll is a convenience function that returns all PG clusters.
type RoleAttribute ¶
type RoleAttribute string
func RoleAttributeList ¶
func RoleAttributeList() []RoleAttribute
func (*RoleAttribute) String ¶
func (it *RoleAttribute) String() string
type UpdateOpts ¶
type UpdateOpts struct {
Databases []DatabaseOpts `json:"databases,omitempty" validate:"omitempty,dive"`
Flavor *FlavorOpts `json:"flavor,omitempty" validate:"omitempty"`
HighAvailability *HighAvailabilityOpts `json:"high_availability,omitempty" validate:"omitempty"`
Network *NetworkOpts `json:"network,omitempty" validate:"omitempty"`
PGServerConfiguration *PGServerConfigurationUpdateOpts `json:"pg_server_configuration,omitempty" validate:"omitempty"`
Storage *PGStorageConfigurationUpdateOpts `json:"storage,omitempty" validate:"omitempty"`
Users []PgUserOpts `json:"users,omitempty" validate:"omitempty,dive"`
}
func (UpdateOpts) ToUpdateMap ¶
func (opts UpdateOpts) ToUpdateMap() (map[string]interface{}, error)
ToUpdateMap builds a request body from UpdateOpts.
func (UpdateOpts) Validate ¶
func (opts UpdateOpts) Validate() error
Validate checks if the provided options are valid.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.