Documentation ¶
Index ¶
- Variables
- func HasStatusCode(err error, statusCode int) bool
- func IsNotFound(err error) bool
- func IsUnautorized(err error) bool
- func NewError(httpCode int, message string) error
- func NewMapParams(params map[string]string) map[string]Param
- type APIError
- type APIErrorItem
- type Client
- type Data
- type Error
- type GenericClient
- func (c *GenericClient[T]) AllExists(ctx context.Context, ids []string, options ...Option) (bool, error)
- func (c *GenericClient[T]) Create(ctx context.Context, name string, attributes T, options ...Option) error
- func (c *GenericClient[T]) Delete(ctx context.Context, name string, options ...Option) error
- func (c *GenericClient[T]) Get(ctx context.Context, name string, options ...Option) (*Data[T], error)
- func (c *GenericClient[T]) List(ctx context.Context, options ...Option) ([]Data[T], error)
- func (c *GenericClient[T]) ListIndex(ctx context.Context, options ...Option) (ds.Index[Data[T]], error)
- func (c *GenericClient[T]) Patch(ctx context.Context, name string, attributes T, options ...Option) error
- func (c *GenericClient[T]) Put(ctx context.Context, name string, options ...Option) error
- func (c *GenericClient[T]) Start(ctx context.Context, name string, options ...Option) error
- func (c *GenericClient[T]) Stop(ctx context.Context, name string, options ...Option) error
- type List
- type ListenerAttributes
- type ListenerClient
- type ListenerParameters
- type MapParams
- type MaxScaleAttributes
- type MaxScaleClient
- type MaxScaleConfigSync
- type MaxScaleParameters
- type MonitorAttributes
- type MonitorClient
- type MonitorParameters
- type Object
- type ObjectType
- type Option
- type Options
- type Param
- type RelationshipData
- type RelationshipItem
- type Relationships
- type RelationshipsBuilder
- func (b *RelationshipsBuilder) Build() *Relationships
- func (b *RelationshipsBuilder) WithListeners(listeners ...string) *RelationshipsBuilder
- func (b *RelationshipsBuilder) WithMonitors(monitors ...string) *RelationshipsBuilder
- func (b *RelationshipsBuilder) WithServers(servers ...string) *RelationshipsBuilder
- func (b *RelationshipsBuilder) WithServices(services ...string) *RelationshipsBuilder
- type ServerAttributes
- type ServerClient
- type ServerParameters
- type ServiceAttributes
- type ServiceClient
- type ServiceParameters
- type UserAccount
- type UserAttributes
- type UserClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMasterServerNotFound = errors.New("master server not found")
Functions ¶
func HasStatusCode ¶
func IsNotFound ¶
func IsUnautorized ¶
Types ¶
type APIError ¶
type APIError struct {
Errors []APIErrorItem `json:"errors"`
}
type APIErrorItem ¶
type APIErrorItem struct {
Detail string `json:"detail"`
}
type Client ¶
type Client struct { User *UserClient Server *ServerClient Monitor *MonitorClient Service *ServiceClient Listener *ListenerClient MaxScale *MaxScaleClient }
type Data ¶
type Data[T any] struct { ID string `json:"id,omitempty"` Type ObjectType `json:"type"` Attributes T `json:"attributes"` Relationships *Relationships `json:"relationships,omitempty"` }
type GenericClient ¶
type GenericClient[T any] struct { // contains filtered or unexported fields }
func NewGenericClient ¶
func NewGenericClient[T any](client *mdbhttp.Client, path string, objectType ObjectType) GenericClient[T]
type ListenerAttributes ¶
type ListenerAttributes struct { State string `json:"state,omitempty"` Parameters ListenerParameters `json:"parameters"` }
type ListenerClient ¶
type ListenerClient struct { GenericClient[ListenerAttributes] }
func NewListenerClient ¶
func NewListenerClient(client *mdbhttp.Client) *ListenerClient
type ListenerParameters ¶
type ListenerParameters struct { Port int32 `json:"port"` Protocol string `json:"protocol"` Params MapParams `json:"-"` }
func (ListenerParameters) MarshalJSON ¶
func (l ListenerParameters) MarshalJSON() ([]byte, error)
type MaxScaleAttributes ¶
type MaxScaleAttributes struct { ConfigSync *MaxScaleConfigSync `json:"config_sync,omitempty"` Parameters MaxScaleParameters `json:"parameters"` }
type MaxScaleClient ¶
type MaxScaleClient struct { GenericClient[MaxScaleAttributes] // contains filtered or unexported fields }
func NewMaxScaleClient ¶
func NewMaxScaleClient(client *mdbhttp.Client) *MaxScaleClient
func (*MaxScaleClient) Get ¶
func (m *MaxScaleClient) Get(ctx context.Context) (*Data[MaxScaleAttributes], error)
func (*MaxScaleClient) Patch ¶
func (m *MaxScaleClient) Patch(ctx context.Context, attributes MaxScaleAttributes) error
type MaxScaleConfigSync ¶
type MaxScaleConfigSync struct {
Version int `json:"version"`
}
type MaxScaleParameters ¶
type MaxScaleParameters struct { ConfigSyncCluster string `json:"config_sync_cluster"` ConfigSyncUser string `json:"config_sync_user"` ConfigSyncPassword string `json:"config_sync_password"` ConfigSyncDB string `json:"config_sync_db"` ConfigSyncInterval metav1.Duration `json:"config_sync_interval"` ConfigSyncTimeout metav1.Duration `json:"config_sync_timeout"` Params MapParams `json:"-"` }
func (MaxScaleParameters) MarshalJSON ¶
func (m MaxScaleParameters) MarshalJSON() ([]byte, error)
type MonitorAttributes ¶
type MonitorAttributes struct { Module mariadbv1alpha1.MonitorModule `json:"module"` State string `json:"state,omitempty"` Parameters MonitorParameters `json:"parameters"` }
type MonitorClient ¶
type MonitorClient struct { GenericClient[MonitorAttributes] }
func NewMonitorClient ¶
func NewMonitorClient(client *mdbhttp.Client) *MonitorClient
type MonitorParameters ¶
type MonitorParameters struct { User string `json:"user"` Password string `json:"password"` MonitorInterval metav1.Duration `json:"monitor_interval,omitempty"` CooperativeMonitoringLocks *mariadbv1alpha1.CooperativeMonitoring `json:"cooperative_monitoring_locks,omitempty"` Params MapParams `json:"-"` }
func (MonitorParameters) MarshalJSON ¶
func (m MonitorParameters) MarshalJSON() ([]byte, error)
type ObjectType ¶
type ObjectType string
const ( ObjectTypeUsers ObjectType = "inet" ObjectTypeServers ObjectType = "servers" ObjectTypeMonitors ObjectType = "monitors" ObjectTypeServices ObjectType = "services" ObjectTypeListeners ObjectType = "listeners" ObjectTypeMaxScale ObjectType = "maxscale" )
type Option ¶
type Option func(o *Options)
func WithForceQuery ¶
func WithForceQuery() Option
func WithRelationships ¶
func WithRelationships(rels *Relationships) Option
type RelationshipData ¶
type RelationshipData struct {
Data []RelationshipItem `json:"data,omitempty"`
}
type RelationshipItem ¶
type RelationshipItem struct { ID string `json:"id"` Type ObjectType `json:"type"` }
type Relationships ¶
type Relationships struct { Servers *RelationshipData `json:"servers,omitempty"` Monitors *RelationshipData `json:"monitors,omitempty"` Services *RelationshipData `json:"services,omitempty"` Listeners *RelationshipData `json:"listeners,omitempty"` }
type RelationshipsBuilder ¶
type RelationshipsBuilder struct {
// contains filtered or unexported fields
}
func NewRelationshipsBuilder ¶
func NewRelationshipsBuilder() *RelationshipsBuilder
func (*RelationshipsBuilder) Build ¶
func (b *RelationshipsBuilder) Build() *Relationships
func (*RelationshipsBuilder) WithListeners ¶
func (b *RelationshipsBuilder) WithListeners(listeners ...string) *RelationshipsBuilder
func (*RelationshipsBuilder) WithMonitors ¶
func (b *RelationshipsBuilder) WithMonitors(monitors ...string) *RelationshipsBuilder
func (*RelationshipsBuilder) WithServers ¶
func (b *RelationshipsBuilder) WithServers(servers ...string) *RelationshipsBuilder
func (*RelationshipsBuilder) WithServices ¶
func (b *RelationshipsBuilder) WithServices(services ...string) *RelationshipsBuilder
type ServerAttributes ¶
type ServerAttributes struct { State string `json:"state,omitempty"` Parameters ServerParameters `json:"parameters"` }
func (*ServerAttributes) IsMaster ¶
func (s *ServerAttributes) IsMaster() bool
type ServerClient ¶
type ServerClient struct { GenericClient[ServerAttributes] }
func NewServerClient ¶
func NewServerClient(client *mdbhttp.Client) *ServerClient
func (*ServerClient) ClearMaintenance ¶
func (s *ServerClient) ClearMaintenance(ctx context.Context, name string) error
func (*ServerClient) SetMaintenance ¶
func (s *ServerClient) SetMaintenance(ctx context.Context, name string) error
type ServerParameters ¶
type ServerParameters struct { Address string `json:"address"` Port int32 `json:"port"` Protocol string `json:"protocol"` Params MapParams `json:"-"` }
func (ServerParameters) MarshalJSON ¶
func (s ServerParameters) MarshalJSON() ([]byte, error)
type ServiceAttributes ¶
type ServiceAttributes struct { Router mariadbv1alpha1.ServiceRouter `json:"router"` State string `json:"state,omitempty"` Parameters ServiceParameters `json:"parameters"` }
type ServiceClient ¶
type ServiceClient struct { GenericClient[ServiceAttributes] }
func NewServiceClient ¶
func NewServiceClient(client *mdbhttp.Client) *ServiceClient
type ServiceParameters ¶
type ServiceParameters struct { User string `json:"user"` Password string `json:"password"` Params MapParams `json:"-"` }
func (ServiceParameters) MarshalJSON ¶
func (s ServiceParameters) MarshalJSON() ([]byte, error)
type UserAccount ¶
type UserAccount string
const ( UserAccountBasic UserAccount = "basic" UserAccountAdmin UserAccount = "admin" )
type UserAttributes ¶
type UserAttributes struct { Account UserAccount `json:"account"` Password *string `json:"password,omitempty"` }
type UserClient ¶
type UserClient struct { GenericClient[UserAttributes] }
func NewUserClient ¶
func NewUserClient(client *mdbhttp.Client) *UserClient
func (*UserClient) DeleteDefaultAdmin ¶
func (u *UserClient) DeleteDefaultAdmin(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.