replication

package
v5.0.0-...-9d434bb Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrReplicationIllegalIDFormatMsg describes an illegal request format
	ErrReplicationIllegalIDFormatMsg = "illegal format of provided ID value"

	// ErrReplicationUnauthorizedMsg describes an unauthorized request
	ErrReplicationUnauthorizedMsg = "unauthorized"

	// ErrReplicationInternalErrorsMsg describes server-side apiclient errors
	ErrReplicationInternalErrorsMsg = "unexpected apiclient errors"

	// ErrReplicationNoPermissionMsg describes a request error without permission
	ErrReplicationNoPermissionMsg = "user does not have permission to the replication"

	// ErrReplicationIDNotExistsMsg describes an error
	// when no proper replication ID is found
	ErrReplicationIDNotExistsMsg = "replication ID does not exist"

	// ErrReplicationNameAlreadyExistsMsg describes a duplicate replication name error
	ErrReplicationNameAlreadyExistsMsg = "replication name already exists"

	// ErrReplicationMismatchMsg describes a failed lookup
	// of a replication with name/id pair
	ErrReplicationMismatchMsg = "id/name pair not found on server side"

	// ErrReplicationNotFoundMsg describes an error
	// when a specific replication is not found
	ErrReplicationNotFoundMsg = "replication not found on server side"

	// ErrReplicationNotProvidedMsg describes an error
	// caused by a missing replication object
	ErrReplicationNotProvidedMsg = "no replication provided"

	// ErrReplicationExecutionNotProvidedMsg describes an error
	// caused by a missing replication execution object
	ErrReplicationExecutionNotProvidedMsg = "no replication execution provided"

	// ErrReplicationExecutionReplicationIDMismatchMsg describes an error
	// caused by an ID mismatch of the desired replication execution and an existing replication
	ErrReplicationExecutionReplicationIDMismatchMsg = "received replication execution id doesn't match"

	// ErrReplicationDisabledMsg describes an error when actions cannot be performed
	// because the underlying replication is currently disabled.
	ErrReplicationDisabledMsg = "the underlying replication is disabled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewReplicationPolicy(ctx context.Context, destRegistry, srcRegistry *model.Registry,
		replicateDeletion, override, enablePolicy bool,
		filters []*model.ReplicationFilter, trigger *model.ReplicationTrigger,
		destNamespace, description, name string) error
	GetReplicationPolicyByName(ctx context.Context, name string) (*model.ReplicationPolicy, error)
	ListReplicationPolicies(ctx context.Context) ([]*model.ReplicationPolicy, error)
	GetReplicationPolicyByID(ctx context.Context, id int64) (*model.ReplicationPolicy, error)
	DeleteReplicationPolicyByID(ctx context.Context, id int64) error
	UpdateReplicationPolicy(ctx context.Context, r *model.ReplicationPolicy, id int64) error
	TriggerReplicationExecution(ctx context.Context, r *model.StartReplicationExecution) error
	ListReplicationExecutions(ctx context.Context, policyID *int64, status, trigger *string) ([]*model.ReplicationExecution, error)
	GetReplicationExecutionByID(ctx context.Context, id int64) (*model.ReplicationExecution, error)
}

type ErrReplicationDisabled

type ErrReplicationDisabled struct{}

ErrReplicationDisabled describes an error that the underlying replication is disabled.

func (*ErrReplicationDisabled) Error

func (e *ErrReplicationDisabled) Error() string

Error returns the error message.

type ErrReplicationExecutionNotProvided

type ErrReplicationExecutionNotProvided struct{}

func (*ErrReplicationExecutionNotProvided) Error

Error returns the error message.

type ErrReplicationExecutionReplicationIDMismatch

type ErrReplicationExecutionReplicationIDMismatch struct{}

func (*ErrReplicationExecutionReplicationIDMismatch) Error

Error returns the error message.

type ErrReplicationIDNotExists

type ErrReplicationIDNotExists struct{}

ErrReplicationIDNotExists describes an error when no proper replication ID is found.

func (*ErrReplicationIDNotExists) Error

func (e *ErrReplicationIDNotExists) Error() string

Error returns the error message.

type ErrReplicationIllegalIDFormat

type ErrReplicationIllegalIDFormat struct{}

ErrReplicationIllegalIDFormat describes an illegal request format.

func (*ErrReplicationIllegalIDFormat) Error

Error returns the error message.

type ErrReplicationInternalErrors

type ErrReplicationInternalErrors struct{}

ErrReplicationInternalErrors describes server-side apiclient errors.

func (*ErrReplicationInternalErrors) Error

Error returns the error message.

type ErrReplicationMismatch

type ErrReplicationMismatch struct{}

ErrReplicationMismatch describes a failed lookup of a replication with name/id pair.

func (*ErrReplicationMismatch) Error

func (e *ErrReplicationMismatch) Error() string

Error returns the error message.

type ErrReplicationNameAlreadyExists

type ErrReplicationNameAlreadyExists struct{}

ErrReplicationNameAlreadyExists describes a duplicate replication name error.

func (*ErrReplicationNameAlreadyExists) Error

Error returns the error message.

type ErrReplicationNoPermission

type ErrReplicationNoPermission struct{}

ErrReplicationNoPermission describes a request error without permission.

func (*ErrReplicationNoPermission) Error

Error returns the error message.

type ErrReplicationNotFound

type ErrReplicationNotFound struct{}

ErrReplicationNotFound describes an error when a specific replication is not found.

func (*ErrReplicationNotFound) Error

func (e *ErrReplicationNotFound) Error() string

Error returns the error message.

type ErrReplicationNotProvided

type ErrReplicationNotProvided struct{}

func (*ErrReplicationNotProvided) Error

func (e *ErrReplicationNotProvided) Error() string

Error returns the error message.

type ErrReplicationUnauthorized

type ErrReplicationUnauthorized struct{}

ErrReplicationUnauthorized describes an unauthorized request.

func (*ErrReplicationUnauthorized) Error

Error returns the error message.

type RESTClient

type RESTClient struct {
	// Options contains optional configuration when making API calls.
	Options *config.Options

	// The new client of the harbor v2 API
	V2Client *v2client.Harbor

	// AuthInfo contains the auth information that is provided on API calls.
	AuthInfo runtime.ClientAuthInfoWriter
}

RESTClient is a subclient for handling replication related actions.

func NewClient

func NewClient(v2Client *v2client.Harbor, opts *config.Options, authInfo runtime.ClientAuthInfoWriter) *RESTClient

func (*RESTClient) DeleteReplicationPolicyByID

func (c *RESTClient) DeleteReplicationPolicyByID(ctx context.Context, id int64) error

DeleteReplicationPolicyByID deletes a replication policy identified by id.

func (*RESTClient) GetReplicationExecutionByID

func (c *RESTClient) GetReplicationExecutionByID(ctx context.Context, id int64) (*model.ReplicationExecution, error)

GetReplicationExecutionByID returns a replication execution specified by ID.

func (*RESTClient) GetReplicationPolicyByID

func (c *RESTClient) GetReplicationPolicyByID(ctx context.Context, id int64) (*model.ReplicationPolicy, error)

GetReplicationPolicyByID returns a replication identified by id.

func (*RESTClient) GetReplicationPolicyByName

func (c *RESTClient) GetReplicationPolicyByName(ctx context.Context, name string) (*model.ReplicationPolicy, error)

GetReplicationPolicyByName returns a replication identified by name.

func (*RESTClient) ListReplicationExecutions

func (c *RESTClient) ListReplicationExecutions(ctx context.Context, policyID *int64, status, trigger *string) ([]*model.ReplicationExecution, error)

ListReplicationExecutions lists replication executions specified by execution ID, status or trigger. Specifying the property "policy_id" will return executions of the specified policy.

func (*RESTClient) ListReplicationPolicies

func (c *RESTClient) ListReplicationPolicies(ctx context.Context) ([]*model.ReplicationPolicy, error)

func (*RESTClient) NewReplicationPolicy

func (c *RESTClient) NewReplicationPolicy(ctx context.Context, destRegistry, srcRegistry *model.Registry,
	replicateDeletion, override, enablePolicy bool,
	filters []*model.ReplicationFilter, trigger *model.ReplicationTrigger,
	destNamespace, description, name string,
) error

NewReplicationPolicy creates a new replication policy with the given arguments.

func (*RESTClient) TriggerReplicationExecution

func (c *RESTClient) TriggerReplicationExecution(ctx context.Context, r *model.StartReplicationExecution) error

TriggerReplicationExecution triggers the execution of a replication 'r'.

func (*RESTClient) UpdateReplicationPolicy

func (c *RESTClient) UpdateReplicationPolicy(ctx context.Context, r *model.ReplicationPolicy, id int64) error

UpdateReplicationPolicy updates the replication policy identified by id with the provided policy 'r'.

Jump to

Keyboard shortcuts

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