Documentation ¶
Index ¶
- Constants
- func ToTagSelectorExtras(untagged bool) string
- type Client
- type ErrRetentionDoesNotExist
- type ErrRetentionInternalErrors
- type ErrRetentionNoPermission
- type ErrRetentionNotProvided
- type ErrRetentionUnauthorized
- type PolicyTemplate
- type RESTClient
- func (c *RESTClient) DeleteRetentionPolicyByID(ctx context.Context, id int64) error
- func (c *RESTClient) GetRetentionPolicyByID(ctx context.Context, id int64) (*modelv2.RetentionPolicy, error)
- func (c *RESTClient) GetRetentionPolicyByProject(ctx context.Context, projectNameOrID string) (*modelv2.RetentionPolicy, error)
- func (c *RESTClient) NewRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error
- func (c *RESTClient) UpdateRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error
- type ScopeSelector
- type TagSelector
Constants ¶
const ( // AlgorithmOr is the default algorithm when operating on harbor retention rules AlgorithmOr string = "or" // Key for defining matching repositories ScopeSelectorRepoMatches ScopeSelector = "repoMatches" // Key for defining excluded repositories ScopeSelectorRepoExcludes ScopeSelector = "repoExcludes" // Key for defining matching tag expressions TagSelectorMatches TagSelector = "matches" // Key for defining excluded tag expressions TagSelectorExcludes TagSelector = "excludes" // The kind of the retention selector, _always_ defaults to 'doublestar' SelectorTypeDefault string = "doublestar" // Retain the most recently pushed n artifacts - count PolicyTemplateLatestPushedArtifacts PolicyTemplate = "latestPushedK" // Retain the most recently pulled n artifacts - count PolicyTemplateLatestPulledArtifacts PolicyTemplate = "latestPulledN" // Retain the artifacts pushed within the last n days PolicyTemplateDaysSinceLastPush PolicyTemplate = "nDaysSinceLastPush" // Retain the artifacts pulled within the last n days PolicyTemplateDaysSinceLastPull PolicyTemplate = "nDaysSinceLastPull" // Retain always PolicyTemplateRetainAlways PolicyTemplate = "always" )
const ( // ErrRetentionNoPermissionMsg is the error message for ErrRetentionNoPermission error. ErrRetentionNoPermissionMsg = "user does not have permission to the retention" // ErrRetentionInternalErrorsMsg is the error message for ErrRetentionInternalErrors error. ErrRetentionInternalErrorsMsg = "unexpected internal errors" // ErrRetentionDoesNotExistMsg is the error message for ErrRetentionDoesNotExist error. ErrRetentionDoesNotExistMsg = "retention policy does not exist" // ErrRetentionNotProvidedMsg is the error message for ErrRetentionNotProvided error. ErrRetentionNotProvidedMsg = "no retention policy provided" )ErrRetentionUnauthorizedMsg = "unauthorized"
Variables ¶
This section is empty.
Functions ¶
func ToTagSelectorExtras ¶
ToTagSelectorExtras converts a boolean to the representative string value used by Harbor. Represents the functionality of the 'untagged artifacts' checkbox when editing tag retention rules in the Harbor UI.
Types ¶
type Client ¶
type Client interface { NewRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error GetRetentionPolicyByProject(ctx context.Context, projectNameOrID string) (*modelv2.RetentionPolicy, error) GetRetentionPolicyByID(ctx context.Context, id int64) (*modelv2.RetentionPolicy, error) DeleteRetentionPolicyByID(ctx context.Context, id int64) error UpdateRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error }
type ErrRetentionDoesNotExist ¶
type ErrRetentionDoesNotExist struct{}
ErrRetentionDoesNotExist describes the absence of a retention policy.
func (*ErrRetentionDoesNotExist) Error ¶
func (e *ErrRetentionDoesNotExist) Error() string
Error returns the error message.
type ErrRetentionInternalErrors ¶
type ErrRetentionInternalErrors struct{}
ErrRetentionInternalErrors describes server-side internal errors.
func (*ErrRetentionInternalErrors) Error ¶
func (e *ErrRetentionInternalErrors) Error() string
Error returns the error message.
type ErrRetentionNoPermission ¶
type ErrRetentionNoPermission struct{}
ErrRetentionNoPermission describes a request error without permission.
func (*ErrRetentionNoPermission) Error ¶
func (e *ErrRetentionNoPermission) Error() string
Error returns the error message.
type ErrRetentionNotProvided ¶
type ErrRetentionNotProvided struct{}
ErrRetentionNotProvided describes a missing retention instance
func (*ErrRetentionNotProvided) Error ¶
func (e *ErrRetentionNotProvided) Error() string
Error returns the error message.
type ErrRetentionUnauthorized ¶
type ErrRetentionUnauthorized struct{}
ErrRetentionUnauthorized describes an unauthorized request.
func (*ErrRetentionUnauthorized) Error ¶
func (e *ErrRetentionUnauthorized) Error() string
Error returns the error message.
type PolicyTemplate ¶
type PolicyTemplate string
PolicyTemplate defines the possible values used for the policy matching mechanism.
func (PolicyTemplate) String ¶
func (p PolicyTemplate) String() string
type RESTClient ¶
type RESTClient struct { // Options contains optional configuration when making API calls. Options *config.Options V2Client *v2client.Harbor // AuthInfo contains the auth information that is provided on API calls. AuthInfo runtime.ClientAuthInfoWriter }
RESTClient is a subclient for handling retention related actions.
func NewClient ¶
func NewClient(v2Client *v2client.Harbor, opts *config.Options, authInfo runtime.ClientAuthInfoWriter) *RESTClient
func (*RESTClient) DeleteRetentionPolicyByID ¶
func (c *RESTClient) DeleteRetentionPolicyByID(ctx context.Context, id int64) error
func (*RESTClient) GetRetentionPolicyByID ¶
func (c *RESTClient) GetRetentionPolicyByID(ctx context.Context, id int64) (*modelv2.RetentionPolicy, error)
GetRetentionPolicyByID returns a retention policy identified by its id.
func (*RESTClient) GetRetentionPolicyByProject ¶
func (c *RESTClient) GetRetentionPolicyByProject(ctx context.Context, projectNameOrID string) (*modelv2.RetentionPolicy, error)
GetRetentionPolicyByProject returns the retention policy associated to a project.
func (*RESTClient) NewRetentionPolicy ¶
func (c *RESTClient) NewRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error
NewRetentionPolicy creates a new tag retention policy for a project.
func (*RESTClient) UpdateRetentionPolicy ¶
func (c *RESTClient) UpdateRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error
UpdateRetentionPolicy updates the specified retention policy ret.
type ScopeSelector ¶
type ScopeSelector string
ScopeSelector is the retention selector decoration used for operations on retention objects.
func (ScopeSelector) String ¶
func (r ScopeSelector) String() string
type TagSelector ¶
type TagSelector string
TagSelector defines the possible values used for the tag matching mechanism. Valid values are: "matches, excludes".
func (TagSelector) String ¶
func (t TagSelector) String() string
String returns the string value of a TagSelector.