client

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListInstancesEndpointV1               = "/v1/ledger/versions/%s/instances"
	CreateEventEndpointV1                 = "/v1/ledger/versions/%s/instances/%s"
	GetEventsEndpointV1                   = "/v1/ledger/versions/%s/instances/%s"
	GetEventByEventTypeEndpointV1         = "/v1/ledger/versions/%s/instances/%s/events/%s"
	DeleteInstanceEventsEndpointV1        = "/v1/ledger/versions/%s/instances/%s"
	DeleteFunctionVersionEventsEndpointV1 = "/v1/ledger/versions/%s/instances"
	GetStatsEndpointV1                    = "/v1/ledger/versions/%s/stats"

	ListInstancesEndpointV2               = "/v2/ledger/versions/%s/deployments/%s/instances"
	CreateEventEndpointV2                 = "/v2/ledger/versions/%s/deployments/%s/instances/%s"
	GetEventsEndpointV2                   = "/v2/ledger/versions/%s/deployments/%s/instances/%s"
	GetEventByEventTypeEndpointV2         = "/v2/ledger/versions/%s/deployments/%s/instances/%s/events/%s"
	DeleteInstanceEventsEndpointV2        = "/v2/ledger/versions/%s/deployments/%s/instances/%s"
	DeleteFunctionVersionEventsEndpointV2 = "/v2/ledger/versions/%s/deployments/%s/instances"
	GetStatsEndpointV2                    = "/v2/ledger/versions/%s/deployments/%s/stats"
)

Variables

This section is empty.

Functions

func GetStatusCodeFromError

func GetStatusCodeFromError(err error) (int, bool)

GetStatusCodeFromError extracts the HTTP status code from an API error if possible

func IsAPIError

func IsAPIError(err error) bool

IsAPIError checks if an error is an API error

Types

type FndsClient

type FndsClient struct {
	BaseURL string

	NcaId string
	// contains filtered or unexported fields
}

func NewFndsClient

func NewFndsClient(endpoint string, ncaId string, tokenFetcher TokenFetcher, opts ...FndsClientOption) *FndsClient

func (*FndsClient) CreateEvent

func (c *FndsClient) CreateEvent(ctx context.Context, eventData fndstypes.StageTransitionEvent) error

func (*FndsClient) CreateEventV2

func (c *FndsClient) CreateEventV2(ctx context.Context, eventData fndstypes.DeploymentStageTransitionEvent) error

func (*FndsClient) DeleteFunctionVersionEvents

func (c *FndsClient) DeleteFunctionVersionEvents(ctx context.Context, functionVersionId uuid.UUID) error

func (*FndsClient) DeleteFunctionVersionEventsV2

func (c *FndsClient) DeleteFunctionVersionEventsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID) error

func (*FndsClient) DeleteInstanceEvents

func (c *FndsClient) DeleteInstanceEvents(ctx context.Context, functionVersionId uuid.UUID, instanceId string) error

func (*FndsClient) DeleteInstanceEventsV2

func (c *FndsClient) DeleteInstanceEventsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID, instanceId string) error

func (*FndsClient) GetEventByEventType

func (c *FndsClient) GetEventByEventType(ctx context.Context, functionVersionId uuid.UUID, instanceId string, eventType string) (fndstypes.StageTransitionEvent, error)

func (*FndsClient) GetEventByEventTypeV2

func (c *FndsClient) GetEventByEventTypeV2(
	ctx context.Context,
	functionVersionId uuid.UUID,
	deploymentId uuid.UUID,
	instanceId string,
	eventType string,
) (fndstypes.DeploymentStageTransitionEvent, error)

func (*FndsClient) GetEvents

func (c *FndsClient) GetEvents(ctx context.Context, functionVersionId uuid.UUID, instanceId string) ([]fndstypes.StageTransitionEvent, error)

func (*FndsClient) GetEventsV2

func (c *FndsClient) GetEventsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID, instanceId string) ([]fndstypes.DeploymentStageTransitionEvent, error)

func (*FndsClient) GetNcaId

func (c *FndsClient) GetNcaId() string

func (*FndsClient) GetStats

func (c *FndsClient) GetStats(ctx context.Context, functionVersionId uuid.UUID) (fndstypes.DeploymentStats, error)

func (*FndsClient) GetStatsV2

func (c *FndsClient) GetStatsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID) (fndstypes.DeploymentStats, error)

func (*FndsClient) ListInstances

func (c *FndsClient) ListInstances(ctx context.Context, functionVersionId uuid.UUID) ([]fndstypes.Instance, error)

func (*FndsClient) ListInstancesV2

func (c *FndsClient) ListInstancesV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID) ([]fndstypes.Instance, error)

func (*FndsClient) NewDeploymentStageTransitionEvent

func (c *FndsClient) NewDeploymentStageTransitionEvent(
	ncaId string,
	functionId uuid.UUID,
	functionVersionId uuid.UUID,
	deploymentId uuid.UUID,
	instanceId string,
	event string,
	eventType string,
	detailsJSON []byte,
) (fndstypes.DeploymentStageTransitionEvent, error)

func (*FndsClient) NewStageTransitionEvent

func (c *FndsClient) NewStageTransitionEvent(
	ncaId string,
	functionId uuid.UUID,
	functionVersionId uuid.UUID,
	instanceId string,
	event string,
	eventType string,
	detailsJSON []byte,
) (fndstypes.StageTransitionEvent, error)

type FndsClientOption

type FndsClientOption func(*FndsClient)

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) FndsClientOption

type LedgerClient

type LedgerClient interface {
	ListInstances(ctx context.Context, functionVersionId uuid.UUID) ([]fndstypes.Instance, error)
	ListInstancesV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID) ([]fndstypes.Instance, error)
	NewStageTransitionEvent(
		ncaId string,
		functionId uuid.UUID,
		functionVersionId uuid.UUID,
		instanceId string,
		event string,
		eventType string,
		detailsJSON []byte,
	) (fndstypes.StageTransitionEvent, error)
	NewDeploymentStageTransitionEvent(
		ncaId string,
		functionId uuid.UUID,
		functionVersionId uuid.UUID,
		deploymentId uuid.UUID,
		instanceId string,
		event string,
		eventType string,
		detailsJSON []byte,
	) (fndstypes.DeploymentStageTransitionEvent, error)
	CreateEvent(ctx context.Context, eventData fndstypes.StageTransitionEvent) error
	CreateEventV2(ctx context.Context, eventData fndstypes.DeploymentStageTransitionEvent) error
	GetEvents(ctx context.Context, functionVersionId uuid.UUID, instanceId string) ([]fndstypes.StageTransitionEvent, error)
	GetEventsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID, instanceId string) ([]fndstypes.DeploymentStageTransitionEvent, error)
	GetEventByEventType(ctx context.Context, functionVersionId uuid.UUID, instanceId string, eventType string) (fndstypes.StageTransitionEvent, error)
	GetEventByEventTypeV2(
		ctx context.Context,
		functionVersionId uuid.UUID,
		deploymentId uuid.UUID,
		instanceId string,
		eventType string,
	) (fndstypes.DeploymentStageTransitionEvent, error)
	DeleteInstanceEvents(ctx context.Context, functionVersionId uuid.UUID, instanceId string) error
	DeleteInstanceEventsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID, instanceId string) error
	DeleteFunctionVersionEvents(ctx context.Context, functionVersionId uuid.UUID) error
	DeleteFunctionVersionEventsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID) error
	GetStats(ctx context.Context, functionVersionId uuid.UUID) (fndstypes.DeploymentStats, error)
	GetStatsV2(ctx context.Context, functionVersionId uuid.UUID, deploymentId uuid.UUID) (fndstypes.DeploymentStats, error)
}

type SimpleAPIError

type SimpleAPIError struct {
	StatusCode int
	JSONString string
}

SimpleAPIError is a minimal wrapper that contains the HTTP status code and the raw JSON error response as a string

func (*SimpleAPIError) Error

func (e *SimpleAPIError) Error() string

type TokenFetcher

type TokenFetcher interface {
	FetchToken(ctx context.Context) (string, error)
}

TokenFetcher is an interface for fetching authentication tokens

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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