client

package
v0.0.0-...-540bb61 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemberMaintenanceModeMaintenance MemberMaintenanceMode = "maintenance"
	MemberMaintenanceModeNormal      MemberMaintenanceMode = "normal"

	MemberMaintenanceUrl = "/_admin/cluster/maintenance/%s"

	DefaultMaintenanceModeTimeout = Seconds(15 * time.Minute)
)
View Source
const (
	// ServerProgressPhaseInWait describes success progress state of a server.
	ServerProgressPhaseInWait = "in wait"
	// ServerStatusEndpoint describes endpoint of a server status.
	ServerStatusEndpoint = "/_admin/status"
	// ServerApiVersionEndpoint describes endpoint of a server version.
	ServerApiVersionEndpoint = "/_api/version"
	// ServerAvailabilityEndpoint describes endpoint of a server availability.
	ServerAvailabilityEndpoint = "/_admin/server/availability"
)
View Source
const AdminLicenseUrl = "/_admin/license"
View Source
const DeleteExpiredJobsURL = "/_api/job/expired"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	GetAuth() conn.Auth

	Connection(ctx context.Context, host string) (driver.Connection, error)

	GetRaw(group api.ServerGroup, id string) (conn.Connection, error)

	Get(ctx context.Context, group api.ServerGroup, id string) (driver.Client, error)
	GetDatabase(ctx context.Context) (driver.Client, error)
	GetAgency(ctx context.Context, agencyIDs ...string) (agency.Agency, error)
}

func NewClientCache

func NewClientCache(in CacheGen, factory conn.Factory) Cache

type Client

type Client interface {
	LicenseClient
	MaintenanceClient

	GetTLS(ctx context.Context) (TLSDetails, error)
	RefreshTLS(ctx context.Context) (TLSDetails, error)

	GetEncryption(ctx context.Context) (EncryptionDetails, error)
	RefreshEncryption(ctx context.Context) (EncryptionDetails, error)

	GetJWT(ctx context.Context) (JWTDetails, error)
	RefreshJWT(ctx context.Context) (JWTDetails, error)

	DeleteExpiredJobs(ctx context.Context, timeout time.Duration) error
}

func NewClient

func NewClient(c driver.Connection, log logging.Logger) Client

type EncryptionDetails

type EncryptionDetails struct {
	Result EncryptionDetailsResult `json:"result,omitempty"`
}

type EncryptionDetailsResult

type EncryptionDetailsResult struct {
	Keys Entries `json:"encryption-keys,omitempty"`
}

func (EncryptionDetailsResult) KeysPresent

func (e EncryptionDetailsResult) KeysPresent(m map[string][]byte) bool

type Entries

type Entries []Entry

func (Entries) Contains

func (e Entries) Contains(s string) bool

func (Entries) KeysPresent

func (e Entries) KeysPresent(m map[string][]byte) bool

type Entry

type Entry struct {
	Sha256    *Sha `json:"sha256,omitempty"`
	Sha256Old *Sha `json:"SHA256,omitempty"`
}

func (*Entry) GetSHA

func (e *Entry) GetSHA() Sha

type JWTDetails

type JWTDetails struct {
	Result JWTDetailsResult `json:"result,omitempty"`
}

type JWTDetailsResult

type JWTDetailsResult struct {
	Active  *Entry  `json:"active,omitempty"`
	Passive Entries `json:"passive,omitempty"`
}

type License

type License struct {
	Hash string `json:"hash,omitempty"`
}

type LicenseClient

type LicenseClient interface {
	GetLicense(ctx context.Context) (License, error)
	SetLicense(ctx context.Context, license string, force bool) error
}

type MaintenanceClient

type MaintenanceClient interface {
	EnableMaintenance(ctx context.Context, id string, timeout Seconds) error
	EnableMaintenanceWithDefaultTimeout(ctx context.Context, id string) error
	DisableMaintenance(ctx context.Context, id string) error
}

type MemberMaintenanceMode

type MemberMaintenanceMode string

type MemberMaintenanceRequest

type MemberMaintenanceRequest struct {
	Mode    MemberMaintenanceMode `json:"mode"`
	Timeout *Seconds              `json:"timeout,omitempty"`
}

type Seconds

type Seconds time.Duration

func SetSeconds

func SetSeconds(i int) Seconds

func (Seconds) MarshalJSON

func (s Seconds) MarshalJSON() ([]byte, error)

func (Seconds) Ptr

func (s Seconds) Ptr() *Seconds

func (*Seconds) UnmarshalJSON

func (s *Seconds) UnmarshalJSON(bytes []byte) error

type ServerInfo

type ServerInfo struct {
	ServerProgress ServerProgress `json:"progress,omitempty"`
}

ServerInfo describes server information.

type ServerProgress

type ServerProgress struct {
	// Phase is a name of the lifecycle phase the instance is currently in.
	Phase string `json:"phase,omitempty"`
	// Feature is internal name of the feature that is currently being prepared
	Feature string `json:"feature,omitempty"`
	// Current recovery sequence number value, if the instance is currently recovering.
	// If the instance is already past the recovery, this attribute contains the last handled recovery sequence number.
	RecoveryTick int `json:"recoveryTick,omitempty"`
}

ServerProgress describes server progress.

type ServerStatus

type ServerStatus struct {
	ServerInfo ServerInfo `json:"serverInfo,omitempty"`
}

ServerStatus describes server status.

func (ServerStatus) GetProgress

func (s ServerStatus) GetProgress() (string, bool)

GetProgress returns human-readable progress status of the server, and true if server is ready.

type Sha

type Sha string

func (Sha) Checksum

func (s Sha) Checksum() string

func (Sha) String

func (s Sha) String() string

func (Sha) Type

func (s Sha) Type() string

type TLSDetails

type TLSDetails struct {
	Result TLSDetailsResult `json:"result,omitempty"`
}

type TLSDetailsResult

type TLSDetailsResult struct {
	KeyFile TLSKeyFile            `json:"keyfile,omitempty"`
	SNI     map[string]TLSKeyFile `json:"SNI,omitempty"`
}

type TLSKeyFile

type TLSKeyFile struct {
	*Entry `json:",inline"`

	PrivateKeyHash string   `json:"privateKeySHA256,omitempty"`
	Certificates   []string `json:"certificates,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL