client

package
v0.0.0-...-2b06d51 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyResponse = errors.New("empty response")
)

Functions

func DefaultFlightctlClientConfigPath

func DefaultFlightctlClientConfigPath() string

DefaultFlightctlClientConfigPath returns the default path to the FlightCtl client config file.

func NewFromConfig

func NewFromConfig(config *Config) (*client.ClientWithResponses, error)

NewFromConfig returns a new FlightCtl API client from the given config.

func NewFromConfigFile

func NewFromConfigFile(filename string) (*client.ClientWithResponses, error)

NewFromConfigFile returns a new FlightCtl API client using the config read from the given file.

func NewWithResponses

func NewWithResponses(endpoint string, caFilePath, certFilePath, keyFilePath string) (*client.ClientWithResponses, error)

func WriteConfig

func WriteConfig(filename string, server string, tlsServerName string, ca *crypto.TLSCertificateConfig, client *crypto.TLSCertificateConfig) error

WriteConfig writes a client config file using the given parameters.

Types

type AuthInfo

type AuthInfo struct {
	// ClientCertificate is the path to a client cert file for TLS.
	// +optional
	ClientCertificate string `json:"client-certificate,omitempty"`
	// ClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificate.
	// +optional
	ClientCertificateData []byte `json:"client-certificate-data,omitempty"`
	// ClientKey is the path to a client key file for TLS.
	// +optional
	ClientKey string `json:"client-key,omitempty"`
	// ClientKeyData contains PEM-encoded data from a client key file for TLS. Overrides ClientKey.
	// +optional
	ClientKeyData []byte `json:"client-key-data,omitempty" datapolicy:"security-key"`
}

AuthInfo contains information for authenticating FlightCtl API clients.

type Config

type Config struct {
	Service  Service  `json:"service"`
	AuthInfo AuthInfo `json:"authentication"`
}

Config holds the information needed to connect to a FlightCtl API server

func (*Config) Flatten

func (c *Config) Flatten() error

Reads the contents of all referenced files and embeds them in the config.

func (*Config) Validate

func (c *Config) Validate() error

type Enrollment

type Enrollment struct {
	// contains filtered or unexported fields
}

func NewEnrollment

func NewEnrollment(
	client *client.ClientWithResponses,
) *Enrollment

func (*Enrollment) CreateEnrollmentRequest

func (*Enrollment) GetEnrollmentRequest

func (e *Enrollment) GetEnrollmentRequest(ctx context.Context, id string, cb ...client.RequestEditorFn) (*v1alpha1.EnrollmentRequest, error)

func (*Enrollment) SetRPCMetricsCallback

func (e *Enrollment) SetRPCMetricsCallback(cb func(operation string, durationSeconds float64, err error))

type Management

type Management struct {
	// contains filtered or unexported fields
}

func NewManagement

func NewManagement(
	client *client.ClientWithResponses,
) *Management

func (*Management) GetDevice

func (m *Management) GetDevice(ctx context.Context, name string, rcb ...client.RequestEditorFn) (*v1alpha1.Device, error)

func (*Management) GetRenderedDeviceSpec

GetRenderedDeviceSpec returns the rendered device spec for the given device and the response code. If the server returns a 200, the rendered device spec is returned. If the server returns a 204, the rendered device spec is nil, and the response code is returned which should be evaluated but the caller.

func (*Management) UpdateDevice

func (m *Management) UpdateDevice(ctx context.Context, name string, req v1alpha1.Device, rcb ...client.RequestEditorFn) (*v1alpha1.Device, error)

func (*Management) UpdateDeviceStatus

func (m *Management) UpdateDeviceStatus(ctx context.Context, name string, device v1alpha1.Device, rcb ...client.RequestEditorFn) error

UpdateDeviceStatus updates the status of the device with the given name.

type Service

type Service struct {
	// Server is the URL of the FlightCtl API server (the part before /api/v1/...).
	Server string `json:"server"`
	// TLSServerName is passed to the server for SNI and is used in the client to check server certificates against.
	// If TLSServerName is empty, the hostname used to contact the server is used.
	// +optional
	TLSServerName string `json:"tls-server-name,omitempty"`
	// CertificateAuthority is the path to a cert file for the certificate authority.
	CertificateAuthority string `json:"certificate-authority,omitempty"`
	// CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority
	CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"`
}

Service contains information how to connect to and authenticate the FlightCtl API server.

Jump to

Keyboard shortcuts

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