Documentation
¶
Index ¶
- Variables
- func ToReader[T NoopRequestBody | any](t T) (io.Reader, error)
- type APIKey
- type AccessToken
- type AccessTokenService
- type AccountService
- type AuthenticatedAccount
- type CertificateService
- type Client
- type Cluster
- type ClusterDiskUsage
- type ClusterEnvironment
- type ClusterProvider
- type ClusterService
- func (c *ClusterService) Create(ctx context.Context, opts *CreateClusterOptions) (Cluster, error)
- func (c *ClusterService) Delete(ctx context.Context, opts FetchClusterOptions) error
- func (c *ClusterService) List(ctx context.Context, opts ListClusterOptions) (ListClusterResponse, error)
- func (c *ClusterService) Ping(ctx context.Context, opts FetchClusterOptions) error
- type CreateAccessTokenOptions
- type CreateClusterOptions
- type EID
- type FetchClusterOptions
- type FetchProviderOptions
- type FetchTeamCertificateOption
- type ListClusterOptions
- type ListClusterResponse
- type ListFilterOrderType
- type ListOrderFieldType
- type NoopRequestBody
- type Option
- type ProviderPlan
- type ProviderResponse
- type ProviderService
- type Response
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidClusterEnvironment = errors.New("not a valid ClusterEnvironment")
var ErrInvalidClusterProvider = errors.New("not a valid ClusterProvider")
var ErrInvalidListFilterOrderType = errors.New("not a valid ListFilterOrderType")
var ErrInvalidListOrderFieldType = errors.New("not a valid ListOrderFieldType")
Functions ¶
Types ¶
type AccessToken ¶
type AccessToken struct {
ID string `json:"id,omitempty"`
AccessToken string `json:"access_token,omitempty"`
AccountID string `json:"account_id,omitempty"`
APIKeyID string `json:"api_key_id,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
TokenType string `json:"token_type,omitempty"`
}
type AccessTokenService ¶
type AccessTokenService service
func (*AccessTokenService) Create ¶
func (a *AccessTokenService) Create(ctx context.Context, opts *CreateAccessTokenOptions, ) (AccessToken, error)
func (*AccessTokenService) Delete ¶
func (a *AccessTokenService) Delete(ctx context.Context, token AccessToken, ) error
type AccountService ¶
type AccountService service
func (*AccountService) User ¶
func (a *AccountService) User(ctx context.Context) (AuthenticatedAccount, error)
type AuthenticatedAccount ¶
type AuthenticatedAccount struct {
CreatedAt time.Time `json:"created_at"`
DefaultTeamID string `json:"default_team_id"`
Email string `json:"email"`
FirstName string `json:"first_name"`
HasPassword bool `json:"has_password"`
HasSso bool `json:"has_sso"`
ID string `json:"id"`
LastSeenAt time.Time `json:"last_seen_at"`
MultiFactorEnabled bool `json:"multi_factor_enabled"`
Name string `json:"name"`
NotificationsEnabled bool `json:"notifications_enabled"`
UpdatedAt time.Time `json:"updated_at"`
}
type CertificateService ¶
type CertificateService service
func (*CertificateService) Get ¶
func (c *CertificateService) Get( ctx context.Context, opts FetchTeamCertificateOption, ) (string, error)
type Client ¶
type Client struct {
Account *AccountService
AccessToken *AccessTokenService
Certificate *CertificateService
Cluster *ClusterService
Provider *ProviderService
// contains filtered or unexported fields
}
type Cluster ¶
type Cluster struct {
ClusterID any `json:"cluster_id"`
CPU int `json:"cpu"`
CreatedAt time.Time `json:"created_at"`
DiskUsage ClusterDiskUsage `json:"disk_usage"`
Environment ClusterEnvironment `json:"environment"`
Host string `json:"host"`
ID EID `json:"id"`
IsHighlyAvailable bool `json:"is_ha"`
IsProtected bool `json:"is_protected"`
IsSuspended bool `json:"is_suspended"`
MaintenanceWindowStart int `json:"maintenance_window_start"`
MajorVersion int `json:"major_version"`
Memory float64 `json:"memory"`
Name string `json:"name"`
NetworkID EID `json:"network_id"`
ParentID EID `json:"parent_id"`
PlanID string `json:"plan_id"`
PostgresVersionID string `json:"postgres_version_id"`
ProviderID EID `json:"provider_id"`
RegionID EID `json:"region_id"`
Replicas []struct {
ClusterID any `json:"cluster_id"`
CPU int `json:"cpu"`
CreatedAt time.Time `json:"created_at"`
DiskUsage ClusterDiskUsage `json:"disk_usage"`
Environment ClusterEnvironment `json:"environment"`
Host string `json:"host"`
ID EID `json:"id"`
IsHighlyAvailable bool `json:"is_ha"`
IsProtected bool `json:"is_protected"`
IsSuspended bool `json:"is_suspended"`
MaintenanceWindowStart int `json:"maintenance_window_start"`
MajorVersion int `json:"major_version"`
Memory float64 `json:"memory"`
Name string `json:"name"`
NetworkID EID `json:"network_id"`
ParentID EID `json:"parent_id"`
PlanID string `json:"plan_id"`
PostgresVersionID string `json:"postgres_version_id"`
ProviderID EID `json:"provider_id"`
RegionID EID `json:"region_id"`
ResetStatsWeekly bool `json:"reset_stats_weekly"`
Storage int `json:"storage"`
TailscaleActive bool `json:"tailscale_active"`
TeamID EID `json:"team_id"`
UpdatedAt time.Time `json:"updated_at"`
} `json:"replicas"`
ResetStatsWeekly bool `json:"reset_stats_weekly"`
Storage int `json:"storage"`
TailscaleActive bool `json:"tailscale_active"`
TeamID EID `json:"team_id"`
UpdatedAt time.Time `json:"updated_at"`
}
type ClusterDiskUsage ¶
type ClusterEnvironment ¶
type ClusterEnvironment string
ENUM(production)
const ( // ClusterEnvironmentProduction is a ClusterEnvironment of type production. ClusterEnvironmentProduction ClusterEnvironment = "production" )
func ParseClusterEnvironment ¶
func ParseClusterEnvironment(name string) (ClusterEnvironment, error)
ParseClusterEnvironment attempts to convert a string to a ClusterEnvironment.
func (ClusterEnvironment) IsValid ¶
func (x ClusterEnvironment) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ClusterEnvironment) String ¶
func (x ClusterEnvironment) String() string
String implements the Stringer interface.
type ClusterProvider ¶
type ClusterProvider string
ENUM(aws,gcp,azure)
const ( // ClusterProviderAws is a ClusterProvider of type aws. ClusterProviderAws ClusterProvider = "aws" // ClusterProviderGcp is a ClusterProvider of type gcp. ClusterProviderGcp ClusterProvider = "gcp" // ClusterProviderAzure is a ClusterProvider of type azure. ClusterProviderAzure ClusterProvider = "azure" )
func ParseClusterProvider ¶
func ParseClusterProvider(name string) (ClusterProvider, error)
ParseClusterProvider attempts to convert a string to a ClusterProvider.
func (ClusterProvider) IsValid ¶
func (x ClusterProvider) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ClusterProvider) String ¶
func (x ClusterProvider) String() string
String implements the Stringer interface.
type ClusterService ¶
type ClusterService service
func (*ClusterService) Create ¶
func (c *ClusterService) Create(ctx context.Context, opts *CreateClusterOptions, ) (Cluster, error)
func (*ClusterService) Delete ¶
func (c *ClusterService) Delete(ctx context.Context, opts FetchClusterOptions) error
func (*ClusterService) List ¶
func (c *ClusterService) List(ctx context.Context, opts ListClusterOptions) (ListClusterResponse, error)
func (*ClusterService) Ping ¶
func (c *ClusterService) Ping(ctx context.Context, opts FetchClusterOptions) error
type CreateAccessTokenOptions ¶
type CreateAccessTokenOptions struct {
ExpiresAt time.Time
// contains filtered or unexported fields
}
func (CreateAccessTokenOptions) MarshalJSON ¶
func (c CreateAccessTokenOptions) MarshalJSON() ([]byte, error)
type CreateClusterOptions ¶
type CreateClusterOptions struct {
// Hunan readable name for the cluster. If non is provided,
// a default name would be generated for the cluster
Name string `json:"name,omitempty"`
PlanID string `json:"plan_id,omitempty"`
// You must have admin access to create a cluster
TeamID EID `json:"team_id,omitempty"`
ClusterGroupID EID `json:"cluster_group_id,omitempty"`
HighlyAvailable bool `json:"is_ha,omitempty"`
KeychainID EID `json:"keychain_id,omitempty"`
NetworkID EID `json:"network_id,omitempty"`
PostgresVersionID int `json:"postgres_version_id,omitempty"`
// You cannot set this and NetworkID together
RegionID string `json:"region_id,omitempty"`
StorageSize int `json:"storage,omitempty"`
ProviderID ClusterProvider `json:"provider_id,omitempty"`
Environment ClusterEnvironment `json:"environment,omitempty"`
}
func (*CreateClusterOptions) Validate ¶
func (c *CreateClusterOptions) Validate() error
type FetchClusterOptions ¶
type FetchClusterOptions struct {
ID EID
}
type FetchProviderOptions ¶
type FetchProviderOptions struct {
Provider ClusterProvider
}
type FetchTeamCertificateOption ¶
type FetchTeamCertificateOption struct {
TeamID string
}
type ListClusterOptions ¶
type ListClusterOptions struct {
Order ListFilterOrderType `url:"order,omitempty"`
OrderField string `url:"order_field,omitempty"`
TeamID EID `url:"team_id,omitempty"`
Limit int `url:"limit,omitempty"`
}
type ListClusterResponse ¶
type ListFilterOrderType ¶
type ListFilterOrderType string
ENUM(asc,desc)
const ( // ListFilterOrderTypeAsc is a ListFilterOrderType of type asc. ListFilterOrderTypeAsc ListFilterOrderType = "asc" // ListFilterOrderTypeDesc is a ListFilterOrderType of type desc. ListFilterOrderTypeDesc ListFilterOrderType = "desc" )
func ParseListFilterOrderType ¶
func ParseListFilterOrderType(name string) (ListFilterOrderType, error)
ParseListFilterOrderType attempts to convert a string to a ListFilterOrderType.
func (ListFilterOrderType) IsValid ¶
func (x ListFilterOrderType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ListFilterOrderType) String ¶
func (x ListFilterOrderType) String() string
String implements the Stringer interface.
type ListOrderFieldType ¶
type ListOrderFieldType string
ENUM(id,name)
const ( // ListOrderFieldTypeId is a ListOrderFieldType of type id. ListOrderFieldTypeId ListOrderFieldType = "id" // ListOrderFieldTypeName is a ListOrderFieldType of type name. ListOrderFieldTypeName ListOrderFieldType = "name" )
func ParseListOrderFieldType ¶
func ParseListOrderFieldType(name string) (ListOrderFieldType, error)
ParseListOrderFieldType attempts to convert a string to a ListOrderFieldType.
func (ListOrderFieldType) IsValid ¶
func (x ListOrderFieldType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ListOrderFieldType) String ¶
func (x ListOrderFieldType) String() string
String implements the Stringer interface.
type Option ¶
type Option func(*Client)
func WithAPIKey ¶
func WithHTTPClient ¶
func WithUserAgent ¶
type ProviderPlan ¶
type ProviderPlan struct {
DisplayName string `json:"display_name"`
ID string `json:"id"`
Plans []struct {
CPU int `json:"cpu"`
DisplayName string `json:"display_name"`
ID EID `json:"id"`
IopsBaseline int `json:"iops_baseline"`
IopsMaximum int `json:"iops_maximum"`
MaximumPerformanceLimited bool `json:"maximum_performance_limited"`
Memory float64 `json:"memory"`
Rate int `json:"rate"`
} `json:"plans"`
Regions []struct {
DisplayName string `json:"display_name"`
ID EID `json:"id"`
Location string `json:"location"`
} `json:"regions"`
}
type ProviderResponse ¶
type ProviderResponse struct {
Providers []ProviderPlan `json:"providers"`
}
type ProviderService ¶
type ProviderService service
func (*ProviderService) Get ¶
func (p *ProviderService) Get(ctx context.Context, opts FetchProviderOptions) (ProviderPlan, error)