Documentation ¶
Index ¶
- func AddClusterMember(ctx context.Context, c *Client, args types.ClusterMember) (*internalTypes.TokenResponse, error)
- func AddTrustStoreEntry(ctx context.Context, c *Client, args types.ClusterMemberLocal) error
- func DeleteTrustStoreEntry(ctx context.Context, c *Client, name string) error
- func GetSQL(ctx context.Context, c *Client, schema bool) (*types.SQLDump, error)
- func IsForwardedRequest(r *http.Request) bool
- func PostSQL(ctx context.Context, c *Client, query types.SQLQuery) (*types.SQLBatch, error)
- func ResetClusterMember(ctx context.Context, c *Client, name string, force bool) error
- func RunNewMemberHook(ctx context.Context, c *Client, config internalTypes.HookNewMemberOptions) error
- func RunOnDaemonConfigUpdateHook(ctx context.Context, c *Client, config *types.DaemonConfig) error
- func RunPostRemoveHook(ctx context.Context, c *Client, config internalTypes.HookRemoveMemberOptions) error
- func RunPreRemoveHook(ctx context.Context, c *Client, config internalTypes.HookRemoveMemberOptions) error
- func TLSClientConfig(clientCert *shared.CertInfo, remoteCert *x509.Certificate) (*tls.Config, error)
- type Client
- func (c *Client) CheckReady(ctx context.Context) error
- func (c *Client) ControlDaemon(ctx context.Context, args types.Control) error
- func (c *Client) DeleteClusterMember(ctx context.Context, name string, force bool) error
- func (c *Client) DeleteTokenRecord(ctx context.Context, name string) error
- func (c *Client) GetClusterMembers(ctx context.Context) ([]types.ClusterMember, error)
- func (c *Client) GetTokenRecords(ctx context.Context) ([]types.TokenRecord, error)
- func (c *Client) MakeRequest(r *http.Request) (*api.Response, error)
- func (c *Client) QueryStruct(ctx context.Context, method string, endpointType types.EndpointPrefix, ...) error
- func (c *Client) RequestToken(ctx context.Context, name string, expireAfter time.Duration) (string, error)
- func (c *Client) SetClusterNotification()
- func (c *Client) ShutdownDaemon(ctx context.Context) error
- func (c *Client) URL() api.URL
- func (c *Client) UpdateCertificate(ctx context.Context, name types.CertificateName, args types.KeyPair) error
- func (c *Client) UpdateServers(ctx context.Context, config map[string]apiTypes.ServerConfig) error
- func (c *Client) UseTarget(name string) *Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddClusterMember ¶
func AddClusterMember(ctx context.Context, c *Client, args types.ClusterMember) (*internalTypes.TokenResponse, error)
AddClusterMember records a new cluster member in the trust store of each current cluster member.
func AddTrustStoreEntry ¶
AddTrustStoreEntry adds a new record to the truststore on all cluster members.
func DeleteTrustStoreEntry ¶
DeleteTrustStoreEntry deletes the record corresponding to the given cluster member from the trust store.
func IsForwardedRequest ¶
IsForwardedRequest determines if this request has been forwarded from another cluster member.
func ResetClusterMember ¶
ResetClusterMember clears the state directory of the cluster member, and re-execs its daemon.
func RunNewMemberHook ¶
func RunNewMemberHook(ctx context.Context, c *Client, config internalTypes.HookNewMemberOptions) error
RunNewMemberHook executes the OnNewMember hook with the given configuration on the cluster member targeted by this client.
func RunOnDaemonConfigUpdateHook ¶
RunOnDaemonConfigUpdateHook executes the OnDaemonConfigUpdate hook with the given configuration on the cluster member targeted by this client.
func RunPostRemoveHook ¶
func RunPostRemoveHook(ctx context.Context, c *Client, config internalTypes.HookRemoveMemberOptions) error
RunPostRemoveHook executes the PostRemove hook with the given configuration on the cluster member targeted by this client.
func RunPreRemoveHook ¶
func RunPreRemoveHook(ctx context.Context, c *Client, config internalTypes.HookRemoveMemberOptions) error
RunPreRemoveHook executes the PreRemove hook with the given configuration on the cluster member targeted by this client.
func TLSClientConfig ¶
func TLSClientConfig(clientCert *shared.CertInfo, remoteCert *x509.Certificate) (*tls.Config, error)
TLSClientConfig returns a TLS configuration suitable for establishing horizontal and vertical connections. clientCert contains the private key pair for the client. remoteCert is the public key of the server we are connecting to.
Types ¶
type Client ¶
Client is a rest client for the daemon.
func New ¶
func New(url api.URL, clientCert *shared.CertInfo, remoteCert *x509.Certificate, forwarding bool) (*Client, error)
New returns a new client configured with the given url and certificates.
func (*Client) CheckReady ¶
CheckReady returns once the daemon has signalled to the ready channel that it is done setting up.
func (*Client) ControlDaemon ¶
ControlDaemon posts control data to the daemon.
func (*Client) DeleteClusterMember ¶
DeleteClusterMember deletes the cluster member with the given name.
func (*Client) DeleteTokenRecord ¶
DeleteTokenRecord deletes the toekn record.
func (*Client) GetClusterMembers ¶
GetClusterMembers returns the database record of cluster members.
func (*Client) GetTokenRecords ¶
GetTokenRecords returns the token records.
func (*Client) MakeRequest ¶
MakeRequest performs a request and parses the response into an api.Response.
func (*Client) QueryStruct ¶
func (c *Client) QueryStruct(ctx context.Context, method string, endpointType types.EndpointPrefix, endpoint *api.URL, data any, target any) error
QueryStruct sends a request of the specified method to the provided endpoint (optional) on the API matching the endpointType. The response gets unpacked into the target struct. POST requests can optionally provide raw data to be sent through.
The final URL is that provided as the endpoint combined with the applicable prefix for the endpointType and the scheme and host from the client.
func (*Client) RequestToken ¶
func (c *Client) RequestToken(ctx context.Context, name string, expireAfter time.Duration) (string, error)
RequestToken requests a join token with the given name.
func (*Client) SetClusterNotification ¶
func (c *Client) SetClusterNotification()
SetClusterNotification sets the client's proxy to apply the forwarding headers to a request.
func (*Client) ShutdownDaemon ¶
ShutdownDaemon begins the daemon shutdown sequence.
func (*Client) UpdateCertificate ¶
func (c *Client) UpdateCertificate(ctx context.Context, name types.CertificateName, args types.KeyPair) error
UpdateCertificate sets a new keypair and CA.
func (*Client) UpdateServers ¶
UpdateServers updates the additional servers config.