client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInfo

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
}

A simplified client for the Replicated SDK designed for the purposes of validating licenses and producing sensible error messages, log entries, monitoring events, etc.

func NewClient

func NewClient(baseURL string) *Client

Returns a new client with that will access the Replicated SDK at the provided URL

func (*Client) GetAppInfo

func (c *Client) GetAppInfo() (*AppInfo, error)

List details about an application instance, including the app name, location of the Helm chart in the Replicated OCI registry, and details about the current application release that the instance is running.

func (*Client) GetAppName

func (c *Client) GetAppName() (string, error)

Returns the name of for the application, as returned from the Replicated SDK

func (*Client) GetAppSlug

func (c *Client) GetAppSlug() (string, error)

Returns the application slug for the application, as returned from the Replicated SDK

func (*Client) GetExpirationDate

func (c *Client) GetExpirationDate() (time.Time, error)

Return the expiration date for the license as a date field since it's a special case of the fields in the license

func (*Client) GetLicenseField

func (c *Client) GetLicenseField(field string) (*license.LicenseField, error)

GetLicenseField fetches a field from the license by name, and returns it only if it's valid

type MockAPIClient

type MockAPIClient struct {
	mock.Mock
	// contains filtered or unexported fields
}

func DefaultMockAPIClient

func DefaultMockAPIClient() *MockAPIClient

func NewMockAPIClient

func NewMockAPIClient(name string, slug string, expiration time.Time, fields ...*license.LicenseField) *MockAPIClient

func (*MockAPIClient) GetAppName

func (m *MockAPIClient) GetAppName() (string, error)

func (*MockAPIClient) GetAppSlug

func (m *MockAPIClient) GetAppSlug() (string, error)

func (*MockAPIClient) GetExpirationDate

func (m *MockAPIClient) GetExpirationDate() (time.Time, error)

func (*MockAPIClient) GetLicenseField

func (m *MockAPIClient) GetLicenseField(field string) (*license.LicenseField, error)

type ReplicatedClient

type ReplicatedClient interface {
	GetAppName() (string, error)
	GetAppSlug() (string, error)
	GetExpirationDate() (time.Time, error)

	GetLicenseField(string) (*license.LicenseField, error)
}

A client for a subset of the Replicated SDK as required for validating license and descrbing the application when discussing it in errors messages or recording information about the license

Jump to

Keyboard shortcuts

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