Documentation
¶
Index ¶
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" // 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 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 { // The swagger client LegacyClient *client.Harbor V2Client *v2client.Harbor // AuthInfo contains the auth information that is provided on API calls. AuthInfo runtime.ClientAuthInfoWriter }
RESTClient is a subclient forhandling retention related actions.
func NewClient ¶
func NewClient(legacyClient *client.Harbor, v2Client *v2client.Harbor, authInfo runtime.ClientAuthInfoWriter) *RESTClient
func (*RESTClient) GetRetentionPolicyByProject ¶
func (c *RESTClient) GetRetentionPolicyByProject(ctx context.Context, project *modelv2.Project) (*model.RetentionPolicy, error)
GetRetentionPolicyByProject returns a retention policy identified by the corresponding project resource. The retention ID is stored in a project's metadata.
func (*RESTClient) NewRetentionPolicy ¶
func (c *RESTClient) NewRetentionPolicy(ctx context.Context, rep *model.RetentionPolicy) error
NewRetentionPolicy creates a new tag retention policy for a project.
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.