replication

package
v5.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

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

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

	// ErrReplicationInternalErrors describes server-side internal errors
	ErrReplicationInternalErrorsMsg = "unexpected internal errors"

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

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

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

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

	// ErrReplicationNotFound 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"
)

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) (*model.ReplicationPolicy, error)
	GetReplicationPolicy(ctx context.Context, name string) (*model.ReplicationPolicy, error)
	GetReplicationPolicyByID(ctx context.Context, id int64) (*model.ReplicationPolicy, error)
	DeleteReplicationPolicy(ctx context.Context, r *model.ReplicationPolicy) error
	UpdateReplicationPolicy(ctx context.Context, r *model.ReplicationPolicy) error

	TriggerReplicationExecution(ctx context.Context, r *model.ReplicationExecution) error
	GetReplicationExecutions(ctx context.Context, r *model.ReplicationExecution) ([]*model.ReplicationExecution, error)
	GetReplicationExecutionsByID(ctx context.Context,
		r *model.ReplicationExecution) (*model.ReplicationExecution, error)
}

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 internal 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 {
	// The swagger client
	Client *client.Harbor

	// AuthInfo contain auth information, which are provided on API calls.
	AuthInfo runtime.ClientAuthInfoWriter
}

RESTClient is a subclient for handling replication related actions.

func NewClient

func NewClient(cl *client.Harbor, authInfo runtime.ClientAuthInfoWriter) *RESTClient

func (*RESTClient) DeleteReplicationPolicy

func (c *RESTClient) DeleteReplicationPolicy(ctx context.Context,
	r *model.ReplicationPolicy) error

Delete deletes a replication. Returns an error when no matching replication is found or when having difficulties talking to the API.

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) GetReplicationExecutions

func (c *RESTClient) GetReplicationExecutions(ctx context.Context,
	r *model.ReplicationExecution) ([]*model.ReplicationExecution, error)

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

func (*RESTClient) GetReplicationPolicy

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

GetReplicationPolicy returns a replication identified by name. Returns an error if it cannot find a matching replication or when having difficulties talking to the API.

func (*RESTClient) GetReplicationPolicyByID

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

GetReplicationPolicyByID returns a replication identified by id. Returns an error if it cannot find a matching replication or when having difficulties talking to the API.

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) (*model.ReplicationPolicy, error)

NewReplication creates a new replication with the given arguments.

func (*RESTClient) TriggerReplicationExecution

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

TriggerReplicationExecution triggers the execution of a replication where only the property "policy_id" is needed.

func (*RESTClient) UpdateReplicationPolicy

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

Update updates a replication.

Jump to

Keyboard shortcuts

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