harbor_client

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 31 Imported by: 0

README

goharbor-client

Go调用Harbor接口的Client goharbor API.

This client library utilizes types generated by go-swagger.

Compatibility

This library includes separate clients supporting the v1.10 & v2.7 versions of goharbor.

Installation

Install the desired client library version using go get:

go get gitee.com/nanjo-fan/goharbor-client

Contributing

Before you make your changes, check to see if an issue already exists for the change you want to make.

When in doubt where to start when making changes to the client, please refer to the Contribution guide.

Documentation

For more specific documentation, please refer to the godoc of this library (which also contains usage examples).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RESTClient

type RESTClient struct {
	// contains filtered or unexported fields
}

RESTClient implements the Client interface as a REST client

func NewRESTClient

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

NewRESTClient constructs a new REST client containing each sub client.

func NewRESTClientForHost

func NewRESTClientForHost(u, username, password string, opts *config.Options) (*RESTClient, error)

NewRESTClientForHost constructs a new REST client containing a swagger API client using the defined host string and basePath, the additional Harbor v2 API suffix as well as basic auth info.

func NewRESTClientWithAuthFunc

func NewRESTClientWithAuthFunc(u string, authFunc runtime.ClientAuthInfoWriterFunc, opts *config.Options) (*RESTClient, error)

NewRESTClientWithAuthFunc constructs a new REST client containing a swagger API client using the defined host string and basePath, the additional Harbor v2 API suffix as well as a custom auth func, e.g. basic auth or token auth.

func (*RESTClient) AddArtifactLabel

func (c *RESTClient) AddArtifactLabel(ctx context.Context, projectName, repositoryName, reference string, label *modelv2.Label) error

func (*RESTClient) AddProjectMember

func (c *RESTClient) AddProjectMember(ctx context.Context, projectNameOrID string, m *modelv2.ProjectMember) error

func (*RESTClient) AddProjectMetadata

func (c *RESTClient) AddProjectMetadata(ctx context.Context, projectNameOrID string, key common.MetadataKey, value string) error

func (*RESTClient) AddProjectRobotV1

func (c *RESTClient) AddProjectRobotV1(ctx context.Context, projectNameOrID string, r *modelv2.RobotCreateV1) error

func (*RESTClient) AddProjectWebhookPolicy

func (c *RESTClient) AddProjectWebhookPolicy(ctx context.Context, projectID int, policy *modelv2.WebhookPolicy) error

func (*RESTClient) CopyArtifact

func (c *RESTClient) CopyArtifact(ctx context.Context, from *artifact.CopyReference, projectName, repositoryName string) error

func (*RESTClient) CreateLabel

func (c *RESTClient) CreateLabel(ctx context.Context, l *modelv2.Label) error

func (*RESTClient) CreatePurgeSchedule

func (c *RESTClient) CreatePurgeSchedule(ctx context.Context, schedule *modelv2.Schedule) error

func (*RESTClient) CreateTag

func (c *RESTClient) CreateTag(ctx context.Context, projectName, repositoryName, reference string, tag *modelv2.Tag) error

func (*RESTClient) DeleteArtifact

func (c *RESTClient) DeleteArtifact(ctx context.Context, projectName, repositoryName, reference string) error

func (*RESTClient) DeleteLabel

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

func (*RESTClient) DeleteProject

func (c *RESTClient) DeleteProject(ctx context.Context, nameOrID string) error

func (*RESTClient) DeleteProjectMember

func (c *RESTClient) DeleteProjectMember(ctx context.Context, projectNameOrID string, m *modelv2.ProjectMember) error

func (*RESTClient) DeleteProjectMetadataValue

func (c *RESTClient) DeleteProjectMetadataValue(ctx context.Context, projectNameOrID string, key common.MetadataKey) error

func (*RESTClient) DeleteProjectRobotV1

func (c *RESTClient) DeleteProjectRobotV1(ctx context.Context, projectNameOrID string, robotID int64) error

func (*RESTClient) DeleteProjectWebhookPolicy

func (c *RESTClient) DeleteProjectWebhookPolicy(ctx context.Context, projectID int, policyID int64) error

func (*RESTClient) DeleteRegistryByID

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

func (*RESTClient) DeleteReplicationPolicyByID

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

func (*RESTClient) DeleteRepository

func (c *RESTClient) DeleteRepository(ctx context.Context, projectName, repositoryName string) error

func (*RESTClient) DeleteRetentionPolicyByID

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

func (*RESTClient) DeleteRobotAccountByID

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

func (*RESTClient) DeleteRobotAccountByName

func (c *RESTClient) DeleteRobotAccountByName(ctx context.Context, name string) error

func (*RESTClient) DeleteTag

func (c *RESTClient) DeleteTag(ctx context.Context, projectName, repositoryName, reference, tagName string) error

func (*RESTClient) DeleteUser

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

func (*RESTClient) GetArtifact

func (c *RESTClient) GetArtifact(ctx context.Context, projectName, repositoryName, reference string) (*modelv2.Artifact, error)

func (*RESTClient) GetCurrentUserInfo

func (c *RESTClient) GetCurrentUserInfo(ctx context.Context) (*modelv2.UserResp, error)

func (*RESTClient) GetCurrentUserPermisisons

func (c *RESTClient) GetCurrentUserPermisisons(ctx context.Context, relative bool, scope string) ([]*modelv2.Permission, error)

func (*RESTClient) GetGarbageCollectionExecution

func (c *RESTClient) GetGarbageCollectionExecution(ctx context.Context, id int64) (*modelv2.GCHistory, error)

func (*RESTClient) GetGarbageCollectionSchedule

func (c *RESTClient) GetGarbageCollectionSchedule(ctx context.Context) (*modelv2.GCHistory, error)

func (*RESTClient) GetHealth

func (*RESTClient) GetLabelByID

func (c *RESTClient) GetLabelByID(ctx context.Context, id int64) (*modelv2.Label, error)

func (*RESTClient) GetPing

func (c *RESTClient) GetPing(ctx context.Context) (string, error)

func (*RESTClient) GetProject

func (c *RESTClient) GetProject(ctx context.Context, nameOrID string) (*modelv2.Project, error)

func (*RESTClient) GetProjectMetadataValue

func (c *RESTClient) GetProjectMetadataValue(ctx context.Context, projectNameOrID string, key common.MetadataKey) (string, error)

func (*RESTClient) GetPurgeJob

func (c *RESTClient) GetPurgeJob(ctx context.Context, id int64) (*modelv2.ExecHistory, error)

func (*RESTClient) GetPurgeJobLog

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

func (*RESTClient) GetPurgeSchedule

func (c *RESTClient) GetPurgeSchedule(ctx context.Context) (*modelv2.ExecHistory, error)

func (*RESTClient) GetQuotaByProjectID

func (c *RESTClient) GetQuotaByProjectID(ctx context.Context, projectID int64) (*modelv2.Quota, error)

func (*RESTClient) GetRegistryByID

func (c *RESTClient) GetRegistryByID(ctx context.Context, id int64) (*modelv2.Registry, error)

func (*RESTClient) GetRegistryByName

func (c *RESTClient) GetRegistryByName(ctx context.Context, name string) (*modelv2.Registry, error)

func (*RESTClient) GetReplicationExecutionByID

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

func (*RESTClient) GetReplicationPolicyByID

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

func (*RESTClient) GetReplicationPolicyByName

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

func (*RESTClient) GetRepository

func (c *RESTClient) GetRepository(ctx context.Context, projectName, repositoryName string) (*modelv2.Repository, error)

func (*RESTClient) GetRetentionPolicyByID

func (c *RESTClient) GetRetentionPolicyByID(ctx context.Context, id int64) (*modelv2.RetentionPolicy, error)

func (*RESTClient) GetRetentionPolicyByProject

func (c *RESTClient) GetRetentionPolicyByProject(ctx context.Context, projectNameOrID string) (*modelv2.RetentionPolicy, error)

func (*RESTClient) GetRobotAccountByID

func (c *RESTClient) GetRobotAccountByID(ctx context.Context, id int64) (*modelv2.Robot, error)

func (*RESTClient) GetRobotAccountByName

func (c *RESTClient) GetRobotAccountByName(ctx context.Context, name string) (*modelv2.Robot, error)

func (*RESTClient) GetSystemInfo

func (c *RESTClient) GetSystemInfo(ctx context.Context) (*modelv2.GeneralInfo, error)

func (*RESTClient) GetUserByID

func (c *RESTClient) GetUserByID(ctx context.Context, id int64) (*modelv2.UserResp, error)

func (*RESTClient) GetUserByName

func (c *RESTClient) GetUserByName(ctx context.Context, username string) (*modelv2.UserResp, error)

func (*RESTClient) ListAllRepositories

func (c *RESTClient) ListAllRepositories(ctx context.Context) ([]*modelv2.Repository, error)

func (*RESTClient) ListArtifacts

func (c *RESTClient) ListArtifacts(ctx context.Context, projectName, repositoryName string) ([]*modelv2.Artifact, error)

func (*RESTClient) ListAuditLogs

func (c *RESTClient) ListAuditLogs(ctx context.Context) ([]*modelv2.AuditLog, error)

func (*RESTClient) ListLabels

func (c *RESTClient) ListLabels(ctx context.Context, name string, projectID *int64) ([]*modelv2.Label, error)

func (*RESTClient) ListProjectMembers

func (c *RESTClient) ListProjectMembers(ctx context.Context, projectNameOrID, memberQuery string) ([]*modelv2.ProjectMemberEntity, error)

func (*RESTClient) ListProjectMetadata

func (c *RESTClient) ListProjectMetadata(ctx context.Context, projectNameOrID string) (map[string]string, error)

func (*RESTClient) ListProjectRobotsV1

func (c *RESTClient) ListProjectRobotsV1(ctx context.Context, projectNameOrID string) ([]*modelv2.Robot, error)

func (*RESTClient) ListProjectWebhookPolicies

func (c *RESTClient) ListProjectWebhookPolicies(ctx context.Context, projectID int) ([]*modelv2.WebhookPolicy, error)

func (*RESTClient) ListProjects

func (c *RESTClient) ListProjects(ctx context.Context, nameFilter string) ([]*modelv2.Project, error)

func (*RESTClient) ListProjectsByIDs added in v1.0.1

func (c *RESTClient) ListProjectsByIDs(ctx context.Context, ids []int32) ([]*modelv2.Project, error)

func (*RESTClient) ListPurgeHistory

func (c *RESTClient) ListPurgeHistory(ctx context.Context) ([]*modelv2.ExecHistory, error)

func (*RESTClient) ListQuotas

func (c *RESTClient) ListQuotas(ctx context.Context, referenceType, referenceID *string) ([]*modelv2.Quota, error)

func (*RESTClient) ListRegistries

func (c *RESTClient) ListRegistries(ctx context.Context) ([]*modelv2.Registry, error)

func (*RESTClient) ListReplicationExecutions

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

func (*RESTClient) ListReplicationPolicies

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

func (*RESTClient) ListRepositories

func (c *RESTClient) ListRepositories(ctx context.Context, projectName string) ([]*modelv2.Repository, error)

func (*RESTClient) ListRobotAccounts

func (c *RESTClient) ListRobotAccounts(ctx context.Context) ([]*modelv2.Robot, error)

func (*RESTClient) ListTags

func (c *RESTClient) ListTags(ctx context.Context, projectName, repositoryName, reference string) ([]*modelv2.Tag, error)

func (*RESTClient) ListUsers

func (c *RESTClient) ListUsers(ctx context.Context) ([]*modelv2.UserResp, error)

func (*RESTClient) NewGarbageCollection

func (c *RESTClient) NewGarbageCollection(ctx context.Context, gcSchedule *modelv2.Schedule) error

func (*RESTClient) NewProject

func (c *RESTClient) NewProject(ctx context.Context, projectRequest *modelv2.ProjectReq) error

func (*RESTClient) NewRegistry

func (c *RESTClient) NewRegistry(ctx context.Context, reg *modelv2.Registry) error

func (*RESTClient) NewReplicationPolicy

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

func (*RESTClient) NewRetentionPolicy

func (c *RESTClient) NewRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error

func (*RESTClient) NewRobotAccount

func (c *RESTClient) NewRobotAccount(ctx context.Context, r *modelv2.RobotCreate) (*modelv2.RobotCreated, error)

func (*RESTClient) NewUser

func (c *RESTClient) NewUser(ctx context.Context, username, email, realname, password, comments string) error

func (*RESTClient) ProjectExists

func (c *RESTClient) ProjectExists(ctx context.Context, nameOrID string) (bool, error)

func (*RESTClient) RefreshRobotAccountSecretByID

func (c *RESTClient) RefreshRobotAccountSecretByID(ctx context.Context, id int64, sec string) (*modelv2.RobotSec, error)

func (*RESTClient) RefreshRobotAccountSecretByName

func (c *RESTClient) RefreshRobotAccountSecretByName(ctx context.Context, name string, sec string) (*modelv2.RobotSec, error)

func (*RESTClient) RemoveLabel

func (c *RESTClient) RemoveLabel(ctx context.Context, projectName, repositoryName, reference string, id int64) error

func (*RESTClient) ResetGarbageCollection

func (c *RESTClient) ResetGarbageCollection(ctx context.Context) error

func (*RESTClient) RunPurge

func (c *RESTClient) RunPurge(ctx context.Context, dryRun bool) error

func (*RESTClient) SearchUsers

func (c *RESTClient) SearchUsers(ctx context.Context, name string) ([]*modelv2.UserSearchRespItem, error)

func (*RESTClient) SetUserSysAdmin

func (c *RESTClient) SetUserSysAdmin(ctx context.Context, id int64, admin bool) error

func (*RESTClient) StopPurge

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

func (*RESTClient) TriggerReplicationExecution

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

func (*RESTClient) UpdateGarbageCollection

func (c *RESTClient) UpdateGarbageCollection(ctx context.Context, newGCSchedule *modelv2.Schedule) error

func (*RESTClient) UpdateLabel

func (c *RESTClient) UpdateLabel(ctx context.Context, id int64, l *modelv2.Label) error

func (*RESTClient) UpdateProject

func (c *RESTClient) UpdateProject(ctx context.Context, p *modelv2.Project, storageLimit *int64) error

func (*RESTClient) UpdateProjectMember

func (c *RESTClient) UpdateProjectMember(ctx context.Context, projectNameOrID string, m *modelv2.ProjectMember) error

func (*RESTClient) UpdateProjectMetadata

func (c *RESTClient) UpdateProjectMetadata(ctx context.Context, projectNameOrID string, key common.MetadataKey, value string) error

func (*RESTClient) UpdateProjectRobotV1

func (c *RESTClient) UpdateProjectRobotV1(ctx context.Context, projectNameOrID string, robotID int64, r *modelv2.Robot) error

func (*RESTClient) UpdateProjectWebhookPolicy

func (c *RESTClient) UpdateProjectWebhookPolicy(ctx context.Context, projectID int, policy *modelv2.WebhookPolicy) error

func (*RESTClient) UpdatePurgeSchedule

func (c *RESTClient) UpdatePurgeSchedule(ctx context.Context, schedule *modelv2.Schedule) error

func (*RESTClient) UpdateRegistry

func (c *RESTClient) UpdateRegistry(ctx context.Context, u *modelv2.RegistryUpdate, id int64) error

func (*RESTClient) UpdateReplicationPolicy

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

func (*RESTClient) UpdateRepository

func (c *RESTClient) UpdateRepository(ctx context.Context, projectName, repositoryName string, update *modelv2.Repository) error

func (*RESTClient) UpdateRetentionPolicy

func (c *RESTClient) UpdateRetentionPolicy(ctx context.Context, ret *modelv2.RetentionPolicy) error

func (*RESTClient) UpdateRobotAccount

func (c *RESTClient) UpdateRobotAccount(ctx context.Context, r *modelv2.Robot) error

func (*RESTClient) UpdateStorageQuotaByProjectID

func (c *RESTClient) UpdateStorageQuotaByProjectID(ctx context.Context, projectID int64, storageLimit int64) error

func (*RESTClient) UpdateUserPassword

func (c *RESTClient) UpdateUserPassword(ctx context.Context, userID int64, passwordRequest *modelv2.PasswordReq) error

func (*RESTClient) UpdateUserProfile

func (c *RESTClient) UpdateUserProfile(ctx context.Context, id int64, profile *modelv2.UserProfile) error

func (*RESTClient) UserExists

func (c *RESTClient) UserExists(ctx context.Context, idOrName intstr.IntOrString) (bool, error)

Jump to

Keyboard shortcuts

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