nexus

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HeaderAuthorization = "Authorization"
	HeaderContentType   = "Content-Type"
)
View Source
const (
	DefaultBlobNetdataDir = "nexus-netdata/"
)

Variables

View Source
var (
	ErrNotFound          = errors.New("not found")
	ErrMissingRepoFormat = errors.New("missing repo format")
)
View Source
var (
	LocalAuthenticatingRealm = Realm{ID: "NexusAuthenticatingRealm", Name: "Local Authenticating Realm"}
	LocalAuthorizingRealm    = Realm{ID: "NexusAuthorizingRealm", Name: "Local Authorizing Realm"}
	NpmBearerTokenRealm      = Realm{ID: "NpmToken", Name: "npm Bearer Token Realm"}
	ConanTokenRealm          = Realm{ID: "org.sonatype.repository.conan.internal.security.token.ConanTokenRealm", Name: "Conan Bearer Token Realm"}
	DefaultRoleRealm         = Realm{ID: "DefaultRole", Name: "Default Role Realm"}
	DockerTokenRealm         = Realm{ID: "DockerToken", Name: "Docker Bearer Token Realm"}
	LDAPRealm                = Realm{ID: "LdapRealm", Name: "LDAP Realm"}
	NuGetApiKeyRealm         = Realm{ID: "NuGetApiKey", Name: "NuGet API-Key Realm"}
	RutAuthRealm             = Realm{ID: "rutauth-realm", Name: "Rut Auth Realm"}
)
View Source
var (
	RepositoryFormatMaven  RepositoryFormat = "maven"
	RepositoryFormatNpm    RepositoryFormat = "npm"
	RepositoryFormatDocker RepositoryFormat = "docker"
	RepositoryFormatAny    RepositoryFormat = "*"

	RepositoryTypeHosted RepositoryType = "hosted"
	RepositoryTypeGroup  RepositoryType = "group"
	RepositoryTypeProxy  RepositoryType = "proxy"

	RepositoryMavenVersionPolicyRelease  RepositoryMavenVersionPolicy = "RELEASE"
	RepositoryMavenVersionPolicySnapshot RepositoryMavenVersionPolicy = "SNAPSHOT"
	RepositoryMavenVersionPolicyMixed    RepositoryMavenVersionPolicy = "MIXED"

	RepositoryMavenLayoutPolicyStrict     RepositoryMavenLayoutPolicy = "STRICT"
	RepositoryMavenLayoutPolicyPermissive RepositoryMavenLayoutPolicy = "PERMISSIVE"

	RepositoryStorageWritePolicyAllowRedploy    RepositoryStorageWritePolicy = "ALLOW"
	RepositoryStorageWritePolicyDisableRedeploy RepositoryStorageWritePolicy = "ALLOW_ONCE"
	RepositoryStorageWritePolicyReadOnly        RepositoryStorageWritePolicy = "DENY"

	RepositoryAuthenticationTypeUsername RepositoryAuthenticationType = "username"
	RepositoryAuthenticationTypeNTLM     RepositoryAuthenticationType = "ntlm" // windows ntlm
)

Functions

func ErrNotOK

func ErrNotOK(statusCode int, body string) error

func MakeDeploymentUserName

func MakeDeploymentUserName(repoName string) string

${repoName}-deployment

func MakeOrgPipelineCmsNs

func MakeOrgPipelineCmsNs(orgID uint64) string

org-${orgID}-nexus

func MakeOrgRepoName

func MakeOrgRepoName(format RepositoryFormat, _type RepositoryType, orgID uint64, suffix ...string) string

${format}-${type}-org-${orgID} example: npm-proxy-org-2

func MakeOrgThirdPartyRepoName

func MakeOrgThirdPartyRepoName(format RepositoryFormat, _type RepositoryType, orgID uint64, thirdPartyName string) string

${format}-${type}-org-${orgID}-thirdparty-${thirdpartyName}

func MakePlatformPipelineCmsNs

func MakePlatformPipelineCmsNs() string

platform-nexus

func MakePublisherPipelineCmNs

func MakePublisherPipelineCmNs(publisherID uint64) string

publisher-${publisherID}-nexus

func MakePublisherRepoName

func MakePublisherRepoName(format RepositoryFormat, _type RepositoryType, publisherID uint64) string

${format}-${type}-publisher-${publisherID} example: npm-proxy-publisher-1

func MakeReadonlyUserName

func MakeReadonlyUserName(repoName string) string

${repoName}-readonly

Types

type BaseRepositoryCreateRequest

type BaseRepositoryCreateRequest struct {
	// A unique identifier for this repository
	// pattern: ^[a-zA-Z0-9\-]{1}[a-zA-Z0-9_\-\.]*$
	// example: internal
	Name string `json:"name"`
	// Whether this repository accepts incoming requests
	Online  bool                          `json:"online"`
	Storage HostedRepositoryStorageConfig `json:"storage"`
	Cleanup *RepositoryCleanupConfig      `json:"cleanup"`
}

func (BaseRepositoryCreateRequest) GetCleanup

func (BaseRepositoryCreateRequest) GetName

func (r BaseRepositoryCreateRequest) GetName() string

func (BaseRepositoryCreateRequest) GetOnline

func (r BaseRepositoryCreateRequest) GetOnline() bool

func (BaseRepositoryCreateRequest) GetStorage

type BlobStore

type BlobStore struct {
	SoftQuota             *BlobStoreSoftQuota `json:"softQuota"`
	Name                  string              `json:"name"`
	Type                  BlobStoreType       `json:"type"`
	Path                  string              `json:"path"`
	BlobCount             int64               `json:"blobCount"`
	TotalSizeInBytes      int64               `json:"totalSizeInBytes"`
	AvailableSpaceInBytes int64               `json:"availableSpaceInBytes"`
}

type BlobStoreDeleteRequest

type BlobStoreDeleteRequest struct {
	BlobName string
}

type BlobStoreListRequest

type BlobStoreListRequest struct {
}

type BlobStoreSoftQuota

type BlobStoreSoftQuota struct {
	// The type to use such as spaceRemainingQuota, or spaceUsedQuota
	Type string `json:"type"`
	// The limit in MB.
	Limit int64 `json:"limit"`
}

type BlobStoreType

type BlobStoreType string
var (
	BlobStoreTypeFile BlobStoreType = "file"
	BlobStoreTypeS3   BlobStoreType = "s3"
)

type BlobUseNetdata

type BlobUseNetdata struct {
	UseNetdata bool `json:"useNetdata,omitempty"`
}

UseNetdata means if blob store in netdata.

type ContentSelector

type ContentSelector struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Expression  string `json:"expression"`
}

type ContentSelectorCreateRequest

type ContentSelectorCreateRequest struct {
	// The content selector name cannot be changed after creation.
	// pattern: ^[a-zA-Z0-9\-]{1}[a-zA-Z0-9_\-\.]*$
	Name string `json:"name"`
	// A human-readable description
	// allowEmptyValue: true
	Description string `json:"description"`
	// The expression used to identify content
	// example: format == "maven2" and path =^ "/org/sonatype/nexus"
	Expression string `json:"expression"`
}

type ContentSelectorDeleteRequest

type ContentSelectorDeleteRequest struct {
	ContentSelectorName string
}

type ContentSelectorGetRequest

type ContentSelectorGetRequest struct {
	ContentSelectorName string
}

type ContentSelectorListRequest

type ContentSelectorListRequest struct {
}

type ContentSelectorUpdateRequest

type ContentSelectorUpdateRequest struct {
	ContentSelectorName string `json:"-"`
	Description         string `json:"description"`
	Expression          string `json:"expression"`
}

type DockerHostedRepositoryCreateRequest

type DockerHostedRepositoryCreateRequest struct {
	HostedRepositoryCreateRequest
	Docker RepositoryDockerConfig `json:"docker,omitempty"`
	// contains filtered or unexported fields
}

hosted

func (DockerHostedRepositoryCreateRequest) GetFormat

func (d DockerHostedRepositoryCreateRequest) GetFormat() RepositoryFormat

type DockerHostedRepositoryUpdateRequest

type DockerHostedRepositoryUpdateRequest DockerHostedRepositoryCreateRequest

type DockerProxyRepositoryCreateRequest

type DockerProxyRepositoryCreateRequest struct {
	ProxyRepositoryCreateRequest
	Docker      RepositoryDockerConfig      `json:"docker,omitempty"`
	DockerProxy RepositoryDockerProxyConfig `json:"dockerProxy,omitempty"`
	// contains filtered or unexported fields
}

proxy

func (DockerProxyRepositoryCreateRequest) GetFormat

func (d DockerProxyRepositoryCreateRequest) GetFormat() RepositoryFormat

type DockerProxyRepositoryUpdateRequest

type DockerProxyRepositoryUpdateRequest DockerProxyRepositoryCreateRequest

type EnsureDeploymentUserRequest

type EnsureDeploymentUserRequest struct {
	RepoName   string
	RepoFormat RepositoryFormat
	Password   string
}

type EnsureUserRequest

type EnsureUserRequest struct {
	// +required
	UserName string
	// +required
	Password string
	// +required
	RepoPrivileges map[RepositoryFormat]map[string][]PrivilegeAction
	// +optional
	// whether update password when option is update, not create
	ForceUpdatePassword bool
}

type ExternalRoleID

type ExternalRoleID string

type FileBlobStoreCreateRequest

type FileBlobStoreCreateRequest struct {
	SoftQuota *BlobStoreSoftQuota `json:"softQuota"`
	// The path to the blobstore contents.
	// This can be an absolute path to anywhere on the system nxrm has access to or it can be a path relative to the sonatype-work directory.
	Path string `json:"path"`
	Name string `json:"name"`

	BlobUseNetdata
}

type FileBlobStoreGetRequest

type FileBlobStoreGetRequest struct {
	Name string
}

type FileBlobStoreUpdateRequest

type FileBlobStoreUpdateRequest struct {
	FileBlobStoreCreateRequest
}

type GroupRepositoryCreateRequest

type GroupRepositoryCreateRequest struct {
	BaseRepositoryCreateRequest
	Group RepositoryGroupConfig `json:"group"`
}

func (GroupRepositoryCreateRequest) GetGroup

func (GroupRepositoryCreateRequest) GetType

type HostedRepositoryCreateRequest

type HostedRepositoryCreateRequest struct{ BaseRepositoryCreateRequest }

func (HostedRepositoryCreateRequest) GetType

type HostedRepositoryStorageConfig

type HostedRepositoryStorageConfig struct {
	// Blob store used to store repository contents
	// example: default
	BlobStoreName string `json:"blobStoreName"`
	// Whether to validate uploaded content's MIME type appropriate for the repository format
	// example: true
	StrictContentTypeValidation bool `json:"strictContentTypeValidation"`
	// Controls if deployments of and updates to assets are allowed
	// example: allow_once
	WritePolicy RepositoryStorageWritePolicy `json:"writePolicy"`

	BlobUseNetdata
}

type MavenGroupRepositoryCreateRequest

type MavenGroupRepositoryCreateRequest struct {
	GroupRepositoryCreateRequest
	// contains filtered or unexported fields
}

group

func (MavenGroupRepositoryCreateRequest) GetFormat

func (m MavenGroupRepositoryCreateRequest) GetFormat() RepositoryFormat

type MavenGroupRepositoryUpdateRequest

type MavenGroupRepositoryUpdateRequest MavenGroupRepositoryCreateRequest

type MavenHostedRepositoryCreateRequest

type MavenHostedRepositoryCreateRequest struct {
	HostedRepositoryCreateRequest
	Maven RepositoryMavenConfig `json:"maven,omitempty"`
	// contains filtered or unexported fields
}

hosted

func (MavenHostedRepositoryCreateRequest) GetFormat

func (m MavenHostedRepositoryCreateRequest) GetFormat() RepositoryFormat

type MavenHostedRepositoryUpdateRequest

type MavenHostedRepositoryUpdateRequest MavenHostedRepositoryCreateRequest

type MavenProxyRepositoryCreateRequest

type MavenProxyRepositoryCreateRequest struct {
	ProxyRepositoryCreateRequest
	Maven RepositoryMavenConfig `json:"maven,omitempty"`
	// contains filtered or unexported fields
}

proxy

func (MavenProxyRepositoryCreateRequest) GetFormat

func (m MavenProxyRepositoryCreateRequest) GetFormat() RepositoryFormat

type MavenProxyRepositoryUpdateRequest

type MavenProxyRepositoryUpdateRequest MavenProxyRepositoryCreateRequest

type Nexus

type Nexus struct {
	Server
	// contains filtered or unexported fields
}

func New

func New(server Server, ops ...Option) *Nexus

func (*Nexus) ChangeUserPassword

func (n *Nexus) ChangeUserPassword(req UserChangePasswordRequest) error

func (*Nexus) ContentSelectorCreateRequest

func (n *Nexus) ContentSelectorCreateRequest(req ContentSelectorCreateRequest) error

func (*Nexus) ContentSelectorGetRequest

func (n *Nexus) ContentSelectorGetRequest(req ContentSelectorGetRequest) (*ContentSelector, error)

func (*Nexus) ContentSelectorListRequest

func (n *Nexus) ContentSelectorListRequest(req ContentSelectorListRequest) ([]ContentSelector, error)

func (*Nexus) CreateDockerHostedRepository

func (n *Nexus) CreateDockerHostedRepository(req DockerHostedRepositoryCreateRequest) error

func (*Nexus) CreateDockerProxyRepository

func (n *Nexus) CreateDockerProxyRepository(req DockerProxyRepositoryCreateRequest) error

func (*Nexus) CreateFileBlobStore

func (n *Nexus) CreateFileBlobStore(req FileBlobStoreCreateRequest) error

func (*Nexus) CreateMavenGroupRepository

func (n *Nexus) CreateMavenGroupRepository(req MavenGroupRepositoryCreateRequest) error

TODO 3.22 not provide maven group repository create rest api

func (*Nexus) CreateMavenHostedRepository

func (n *Nexus) CreateMavenHostedRepository(req MavenHostedRepositoryCreateRequest) error

func (*Nexus) CreateMavenProxyRepository

func (n *Nexus) CreateMavenProxyRepository(req MavenProxyRepositoryCreateRequest) error

func (*Nexus) CreateNpmGroupRepository

func (n *Nexus) CreateNpmGroupRepository(req NpmGroupRepositoryCreateRequest) error

func (*Nexus) CreateNpmHostedRepository

func (n *Nexus) CreateNpmHostedRepository(req NpmHostedRepositoryCreateRequest) error

func (*Nexus) CreateNpmProxyRepository

func (n *Nexus) CreateNpmProxyRepository(req NpmProxyRepositoryCreateRequest) error

TODO 3.22 not provide maven group repository create rest api

func (*Nexus) CreateRepository

func (n *Nexus) CreateRepository(req RepositoryCreator) error

func (*Nexus) CreateRepositoryContentSelectorPrivilege

func (n *Nexus) CreateRepositoryContentSelectorPrivilege(req RepositoryContentSelectorPrivilegeCreateRequest) error

func (*Nexus) CreateRole

func (n *Nexus) CreateRole(req RoleCreateRequest) error

func (*Nexus) CreateUser

func (n *Nexus) CreateUser(req UserCreateRequest) error

CreateUser create a new user in the default source.

func (*Nexus) DeleteBlobStore

func (n *Nexus) DeleteBlobStore(req BlobStoreDeleteRequest) error

func (*Nexus) DeleteContentSelector

func (n *Nexus) DeleteContentSelector(req ContentSelectorDeleteRequest) error

func (*Nexus) DeletePrivilege

func (n *Nexus) DeletePrivilege(req PrivilegeDeleteRequest) error

func (*Nexus) DeleteRepository

func (n *Nexus) DeleteRepository(req RepositoryDeleteRequest) error

func (*Nexus) DeleteRole

func (n *Nexus) DeleteRole(req RoleDeleteRequest) error

func (*Nexus) EnsureAddRealms

func (n *Nexus) EnsureAddRealms(req RealmEnsureAddRequest) error

EnsureAddRealms 保证在原有 realm 基础上增加请求里的 realm

func (*Nexus) EnsureFileBlobStore

func (n *Nexus) EnsureFileBlobStore(req FileBlobStoreCreateRequest) error

EnsureFileBlobStore create or update file blob store.

func (*Nexus) EnsureNpmHostedRepository

func (n *Nexus) EnsureNpmHostedRepository(req NpmHostedRepositoryCreateRequest) error

func (*Nexus) EnsureRepository

func (n *Nexus) EnsureRepository(req RepositoryCreator) error

EnsureRepository make sure repository exist, create or update according to request

func (*Nexus) EnsureRole

func (n *Nexus) EnsureRole(req RoleCreateRequest) error

func (*Nexus) EnsureUser

func (n *Nexus) EnsureUser(req EnsureUserRequest) (UserID, error)

EnsureUser won't update password if ForceUpdatePassword is false.

func (*Nexus) GetFileBlobStore

func (n *Nexus) GetFileBlobStore(req FileBlobStoreGetRequest) (*BlobStore, error)

func (*Nexus) GetPrivilege

func (n *Nexus) GetPrivilege(req PrivilegeGetRequest) (*Privilege, error)

func (*Nexus) GetRepository

func (n *Nexus) GetRepository(req RepositoryGetRequest) (*Repository, error)

func (*Nexus) GetRole

func (n *Nexus) GetRole(req RoleGetRequest) (*Role, error)

func (*Nexus) GetUser

func (n *Nexus) GetUser(userID UserID) (*User, error)

func (*Nexus) InvalidateRepositoryCache

func (n *Nexus) InvalidateRepositoryCache(req RepositoryInvalidateCacheRequest) error

func (*Nexus) ListActiveRealms

func (n *Nexus) ListActiveRealms(req RealmListActiveRequest) ([]RealmID, error)

func (*Nexus) ListAvailableRealms

func (n *Nexus) ListAvailableRealms(req RealmListAvailableRequest) ([]Realm, error)

func (*Nexus) ListBlobStore

func (n *Nexus) ListBlobStore(req BlobStoreListRequest) ([]BlobStore, error)

func (*Nexus) ListPrivileges

func (n *Nexus) ListPrivileges(req PrivilegeListRequest) ([]Privilege, error)

func (*Nexus) ListRepositories

func (n *Nexus) ListRepositories(req RepositoryListRequest) ([]Repository, error)

func (*Nexus) ListRoles

func (n *Nexus) ListRoles(req RoleListRequest) ([]Role, error)

func (*Nexus) ListUsers

func (n *Nexus) ListUsers(req UserListRequest) ([]User, error)

ListUsers Retrieve a list of users. Note if the source is not 'default' the response is limited to 100 users. curl -X GET "http://localhost:8081/service/rest/beta/security/users?userId=a&source=default" -H "accept: application/json"

func (*Nexus) RebuildRepositoryIndex

func (n *Nexus) RebuildRepositoryIndex(req RepositoryRebuildIndexRequest) error

func (*Nexus) SetActiveRealms

func (n *Nexus) SetActiveRealms(req RealmSetActivesRequest) error

func (*Nexus) UpdateContentSelector

func (n *Nexus) UpdateContentSelector(req ContentSelectorUpdateRequest) error

func (*Nexus) UpdateDockerHostedRepository

func (n *Nexus) UpdateDockerHostedRepository(req DockerHostedRepositoryUpdateRequest) error

func (*Nexus) UpdateDockerProxyRepository

func (n *Nexus) UpdateDockerProxyRepository(req DockerProxyRepositoryUpdateRequest) error

func (*Nexus) UpdateFileBlobStore

func (n *Nexus) UpdateFileBlobStore(req FileBlobStoreUpdateRequest) error

func (*Nexus) UpdateMavenHostedRepository

func (n *Nexus) UpdateMavenHostedRepository(req MavenHostedRepositoryUpdateRequest) error

func (*Nexus) UpdateMavenProxyRepository

func (n *Nexus) UpdateMavenProxyRepository(req MavenProxyRepositoryUpdateRequest) error

func (*Nexus) UpdateNpmGroupRepository

func (n *Nexus) UpdateNpmGroupRepository(req NpmGroupRepositoryUpdateRequest) error

func (*Nexus) UpdateNpmHostedRepository

func (n *Nexus) UpdateNpmHostedRepository(req NpmHostedRepositoryUpdateRequest) error

func (*Nexus) UpdateNpmProxyRepository

func (n *Nexus) UpdateNpmProxyRepository(req NpmProxyRepositoryUpdateRequest) error

func (*Nexus) UpdateRepository

func (n *Nexus) UpdateRepository(req RepositoryCreator) error

func (*Nexus) UpdateRepositoryContentSelectorPrivilege

func (n *Nexus) UpdateRepositoryContentSelectorPrivilege(req RepositoryContentSelectorPrivilegeUpdateRequest) error

func (*Nexus) UpdateRole

func (n *Nexus) UpdateRole(req RoleUpdateRequest) error

func (*Nexus) UpdateUser

func (n *Nexus) UpdateUser(req UserUpdateRequest) error

type NpmGroupRepositoryCreateRequest

type NpmGroupRepositoryCreateRequest struct {
	GroupRepositoryCreateRequest
	// contains filtered or unexported fields
}

group

func (NpmGroupRepositoryCreateRequest) GetFormat

func (n NpmGroupRepositoryCreateRequest) GetFormat() RepositoryFormat

type NpmGroupRepositoryUpdateRequest

type NpmGroupRepositoryUpdateRequest NpmGroupRepositoryCreateRequest

type NpmHostedRepositoryCreateRequest

type NpmHostedRepositoryCreateRequest struct {
	HostedRepositoryCreateRequest
	// contains filtered or unexported fields
}

hosted

func (NpmHostedRepositoryCreateRequest) GetFormat

func (n NpmHostedRepositoryCreateRequest) GetFormat() RepositoryFormat

type NpmHostedRepositoryUpdateRequest

type NpmHostedRepositoryUpdateRequest NpmHostedRepositoryCreateRequest

type NpmProxyRepositoryCreateRequest

type NpmProxyRepositoryCreateRequest struct {
	ProxyRepositoryCreateRequest
	// contains filtered or unexported fields
}

proxy

func (NpmProxyRepositoryCreateRequest) GetFormat

func (n NpmProxyRepositoryCreateRequest) GetFormat() RepositoryFormat

type NpmProxyRepositoryUpdateRequest

type NpmProxyRepositoryUpdateRequest NpmProxyRepositoryCreateRequest

type Option

type Option func(*Nexus)

func WithBlobNetdataDir

func WithBlobNetdataDir(dir string) Option

func WithHttpClient

func WithHttpClient(hc *httpclient.HTTPClient) Option

type Privilege

type Privilege struct {
	Type        string   `json:"type"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	ReadOnly    bool     `json:"readOnly"`
	Pattern     string   `json:"pattern,omitempty"`
	Actions     []string `json:"actions,omitempty"`
	Domain      string   `json:"domain,omitempty"`
}

type PrivilegeAction

type PrivilegeAction string
const (
	PrivilegeActionREAD         PrivilegeAction = "READ"
	PrivilegeActionBROWSE       PrivilegeAction = "BROWSE"
	PrivilegeActionEDIT         PrivilegeAction = "EDIT"
	PrivilegeActionADD          PrivilegeAction = "ADD"
	PrivilegeActionDELETE       PrivilegeAction = "DELETE"
	PrivilegeActionRUN          PrivilegeAction = "RUN"
	PrivilegeActionASSOCIATE    PrivilegeAction = "ASSOCIATE"
	PrivilegeActionDISASSOCIATE PrivilegeAction = "DISASSOCIATE"
	PrivilegeActionALL          PrivilegeAction = "ALL"
)

type PrivilegeDeleteRequest

type PrivilegeDeleteRequest struct {
	PrivilegeID string
}

type PrivilegeGetRequest

type PrivilegeGetRequest struct {
	PrivilegeID string
}

type PrivilegeID

type PrivilegeID string

func GetNxRepositoryPrivilege

func GetNxRepositoryPrivilege(privilegeType PrivilegeType, repoFormat RepositoryFormat, repoName string, actions ...PrivilegeAction) []PrivilegeID

func GetNxRepositoryViewPrivileges

func GetNxRepositoryViewPrivileges(repoName string, repoFormat RepositoryFormat, actions ...PrivilegeAction) []PrivilegeID

type PrivilegeListRequest

type PrivilegeListRequest struct {
}

type PrivilegeType

type PrivilegeType string
const (
	PrivilegeTypeRepositoryView  PrivilegeType = "nx-repository-view"
	PrivilegeTypeRepositoryAdmin PrivilegeType = "nx-repository-admin"
)

type ProxyRepositoryCreateRequest

type ProxyRepositoryCreateRequest struct {
	BaseRepositoryCreateRequest
	Proxy         RepositoryProxyConfig         `json:"proxy"`
	NegativeCache RepositoryNegativeCacheConfig `json:"negativeCache"`
	HttpClient    RepositoryHttpClientConfig    `json:"httpClient"`
	RoutingRule   string                        `json:"routingRule"`
}

func (ProxyRepositoryCreateRequest) GetHttpClient

func (ProxyRepositoryCreateRequest) GetNegativeCache

func (ProxyRepositoryCreateRequest) GetProxy

func (ProxyRepositoryCreateRequest) GetRoutingRule

func (r ProxyRepositoryCreateRequest) GetRoutingRule() string

func (ProxyRepositoryCreateRequest) GetType

type Realm

type Realm struct {
	ID   RealmID `json:"id"`
	Name string  `json:"name"`
}

type RealmEnsureAddRequest

type RealmEnsureAddRequest struct {
	Realms []RealmID
}

type RealmID

type RealmID string

type RealmListActiveRequest

type RealmListActiveRequest struct{}

List the active realm IDs in order

type RealmListAvailableRequest

type RealmListAvailableRequest struct{}

List the available realms

type RealmSetActivesRequest

type RealmSetActivesRequest struct {
	ActiveRealms []RealmID
}

Set the active security realms in the order they should be used

type Repository

type Repository struct {
	Name            string                         `json:"name"`
	Format          RepositoryFormat               `json:"format"`
	URL             string                         `json:"url"`
	Online          bool                           `json:"online"`
	Storage         HostedRepositoryStorageConfig  `json:"storage"`
	Group           *RepositoryGroupConfig         `json:"group"`
	Cleanup         *RepositoryCleanupConfig       `json:"cleanup"`
	Proxy           *RepositoryProxyConfig         `json:"proxy"`
	NegativeCache   *RepositoryNegativeCacheConfig `json:"negativeCache"`
	HttpClient      *RepositoryHttpClientConfig    `json:"httpClient"`
	RoutingRuleName *string                        `json:"routingRuleName"`
	Maven           *RepositoryMavenConfig         `json:"maven"`
	Type            RepositoryType                 `json:"type"`
	Extra           RepositoryExtra                `json:"extra"`
}

type RepositoryAuthenticationType

type RepositoryAuthenticationType string

type RepositoryCleanupConfig

type RepositoryCleanupConfig struct {
	// Components that match any of the applied policies will be deleted
	// example: weekly-cleanup
	PolicyNames []string `json:"policyNames"`
}

type RepositoryContentSelectorPrivilegeCreateRequest

type RepositoryContentSelectorPrivilegeCreateRequest struct {
	// The name of the privilege. This value cannot be changed.
	// pattern: ^[a-zA-Z0-9\-]{1}[a-zA-Z0-9_\-\.]*$
	Name        string `json:"name"`
	Description string `json:"description"`
	// A collection of actions to associate with the privilege, using BREAD syntax (browse,read,edit,add,delete,all) as well as 'run' for script privileges.
	Actions []PrivilegeAction `json:"actions"`
	// The repository format (i.e 'nuget', 'npm') this privilege will grant access to (or * for all).
	Format RepositoryFormat `json:"format"`
	// The name of the repository this privilege will grant access to (or * for all).
	Repository string `json:"repository"`
	// The name of a content selector that will be used to grant access to content via this privilege.
	ContentSelector string `json:"contentSelector"`
}

type RepositoryCreator

type RepositoryCreator interface {
	GetName() string
	GetOnline() bool
	GetStorage() HostedRepositoryStorageConfig
	GetCleanup() *RepositoryCleanupConfig
	GetFormat() RepositoryFormat // maven2 / npm / ...
	GetType() RepositoryType     // hosted / proxy / group
}

type RepositoryDeleteRequest

type RepositoryDeleteRequest struct{ RepositoryName string }

type RepositoryDockerConfig

type RepositoryDockerConfig struct {
	// Whether to allow clients to use the V1 API to interact with this repository
	// example: false
	V1Enabled bool `json:"v1Enabled"`
	// Whether to force authentication (Docker Bearer Token Realm required if false)
	// example: true
	ForceBasicAuth bool `json:"forceBasicAuth"`
	// Create an HTTP connector at specified port
	// +Optional
	// example: 8082
	HttpPort *int `json:"httpPort"`
	// Create an HTTPS connector at specified port
	// +Optional
	// example: 8083
	HttpsPort *int `json:"httpsPort"`
}

type RepositoryDockerProxyConfig

type RepositoryDockerProxyConfig struct {
	IndexType string `json:"indexType"`
	IndexUrl  string `json:"indexUrl"`
}

type RepositoryExtra

type RepositoryExtra struct {
	// ReverseProxyURL docker hosted or group repo will have
	ReverseProxyURL string `json:"reverseProxyURL,omitempty"`
}

type RepositoryFormat

type RepositoryFormat string

func (RepositoryFormat) Standard

func (format RepositoryFormat) Standard() string

Standard 返回 format 标准值 maven -> maven2

type RepositoryGetRequest

type RepositoryGetRequest struct{ RepositoryName string }

type RepositoryGroupConfig

type RepositoryGroupConfig struct {
	// Member repositories' names
	// example: maven-public
	MemberNames []string `json:"memberNames"`
}

type RepositoryGroupCreator

type RepositoryGroupCreator interface {
	RepositoryCreator
	GetGroup() RepositoryGroupConfig
}

type RepositoryHttpClientAuthentication

type RepositoryHttpClientAuthentication struct {
	// Authentication type
	Type     RepositoryAuthenticationType `json:"type"`
	Username string                       `json:"username"`
	Password string                       `json:"password"`
}

type RepositoryHttpClientConfig

type RepositoryHttpClientConfig struct {
	// Whether to block outbound connections on the repository
	Blocked bool `json:"blocked"`
	// Whether to auto-block outbound connections if remote peer is detected as unreachable/unresponsive
	AutoBlock  bool                            `json:"autoBlock"`
	Connection *RepositoryHttpClientConnection `json:"connection"`
	// TODO not take effect yet
	Authentication *RepositoryHttpClientAuthentication `json:"authentication"`
}

type RepositoryHttpClientConnection

type RepositoryHttpClientConnection struct {
	// Total retries if the initial connection attempt suffers a timeout
	// example: 0
	// minimum: 0
	// maximum: 10
	Retries *int64 `json:"retries"`
	// Custom fragment to append to User-Agent header in HTTP requests
	UserAgentSuffix *string `json:"userAgentSuffix"`
	// Seconds to wait for activity before stopping and retrying the connection
	// example: 60
	// minimum: 1
	// maximum: 3600
	Timeout *int64 `json:"timeout"`
	// Whether to enable redirects to the same location (may be required by some servers)
	EnableCircularRedirects bool `json:"enableCircularRedirects"`
	// Whether to allow cookies to be stored and used
	EnableCookies bool `json:"enableCookies"`
}

type RepositoryInvalidateCacheRequest

type RepositoryInvalidateCacheRequest struct{ RepositoryName string }

type RepositoryListRequest

type RepositoryListRequest struct{}

type RepositoryMavenConfig

type RepositoryMavenConfig struct {
	// What type of artifacts does this repository store?
	// example: mixed
	VersionPolicy RepositoryMavenVersionPolicy `json:"versionPolicy"`
	// Validate that all paths are maven artifact or metadata paths
	// example: strict
	LayoutPolicy RepositoryMavenLayoutPolicy `json:"layoutPolicy"`
}

type RepositoryMavenLayoutPolicy

type RepositoryMavenLayoutPolicy string

type RepositoryMavenVersionPolicy

type RepositoryMavenVersionPolicy string

type RepositoryNegativeCacheConfig

type RepositoryNegativeCacheConfig struct {
	// Whether to cache responses for content not present in the proxied repository
	// example: false
	NotFoundCacheEnabled bool `json:"enabled"`
	// How long to cache the fact that a file was not found in the repository (in minutes)
	// example: 1440
	NotFoundCacheTTL int64 `json:"timeToLive"`
}

type RepositoryProxyConfig

type RepositoryProxyConfig struct {
	// Location of the remote repository being proxied
	// example: https://registry.npmjs.org
	RemoteURL string `json:"remoteUrl"`
	// How long to cache artifacts before rechecking the remote repository (in minutes)
	// Release repositories should use -1.
	// example: 1440
	ContentMaxAge int64 `json:"contentMaxAge"`
	// How long to cache metadata before rechecking the remote repository (in minutes)
	// example: 1440
	MetadataMaxAge int64 `json:"metadataMaxAge"`
}

type RepositoryProxyCreator

type RepositoryProxyCreator interface {
	RepositoryCreator
	GetProxy() RepositoryProxyConfig
	GetNegativeCache() RepositoryNegativeCacheConfig
	GetHttpClient() RepositoryHttpClientConfig
	GetRoutingRule() string
}

type RepositoryRebuildIndexRequest

type RepositoryRebuildIndexRequest struct{ RepositoryName string }

type RepositoryStorageWritePolicy

type RepositoryStorageWritePolicy string

type RepositoryType

type RepositoryType string

type Role

type Role struct {
	ID          string        `json:"id"`
	Source      string        `json:"source"`
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Privileges  []PrivilegeID `json:"privileges"`
	Roles       []RoleID      `json:"roles"`
}

type RoleCreateRequest

type RoleCreateRequest struct {
	// Role-ID must be unique
	ID          RoleID `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	// The list of privileges assigned to this role.
	Privileges []PrivilegeID `json:"privileges"`
	// The list of roles assigned to this role.
	Roles []string `json:"roles"`
}

type RoleDeleteRequest

type RoleDeleteRequest struct {
	ID string
}

type RoleGetRequest

type RoleGetRequest struct {
	ID     RoleID
	Source UserSource
}

type RoleID

type RoleID string

type RoleListRequest

type RoleListRequest struct {
	// +optional
	Source string
}

type RoleUpdateRequest

type RoleUpdateRequest RoleCreateRequest

type Server

type Server struct {
	Addr     string
	Username string
	Password string
}

type User

type User struct {
	UserID        UserID           `json:"userId"`
	FirstName     string           `json:"firstName"`
	LastName      string           `json:"lastName"`
	EmailAddress  string           `json:"emailAddress"`
	Source        UserSource       `json:"source"`
	Status        string           `json:"status"`
	ReadOnly      bool             `json:"readOnly"`
	Roles         []RoleID         `json:"roles"`
	ExternalRoles []ExternalRoleID `json:"externalRoles"`
}
{
  "userId": "anonymous",
  "firstName": "Anonymous",
  "lastName": "User",
  "emailAddress": "anonymous@example.org",
  "source": "default",
  "status": "active",
  "readOnly": false,
  "roles": [
    "nx-anonymous"
  ],
  "externalRoles": []
},

type UserChangePasswordRequest

type UserChangePasswordRequest struct {
	UserID   UserID
	Password string
}

type UserCreateRequest

type UserCreateRequest struct {
	// The userid which is required for login. This value cannot be changed.
	// User-ID must be unique
	UserID UserID `json:"userId"`
	// The first name of the user.
	FirstName string `json:"firstName"`
	// The last name of the user.
	LastName string `json:"lastName"`
	// The email address associated with the user.
	EmailAddress string `json:"emailAddress"`
	// The password for the new user.
	Password string `json:"password"`
	// The user's status, e.g. active or disabled.
	Status UserStatus `json:"status"`
	// The roles which the user has been assigned within Nexus.
	// uniqueItems: true
	Roles []RoleID `json:"roles"`
}

type UserEnsureRequest

type UserEnsureRequest struct {
	UserCreateRequest
	ForceUpdatePassword bool
}

type UserID

type UserID string

type UserListRequest

type UserListRequest struct {
	// +optional
	UserIDPrefix string
	// +optional
	Source string
}

type UserSource

type UserSource string
var (
	UserSourceDefault UserSource = "default"
)

type UserStatus

type UserStatus string
var (
	UserStatusActive         UserStatus = "ACTIVE"
	UserStatusLocked         UserStatus = "LOCKED"
	UserStatusDisabled       UserStatus = "DISABLED"
	UserStatusChangePassword UserStatus = "CHANGEPASSWORD"
)

type UserUpdateRequest

type UserUpdateRequest struct {
	UserCreateRequest
	// The user source which is the origin of this user. This value cannot be changed.
	Source UserSource `json:"source"`
	// Indicates whether the user's properties could be modified by Nexus. When false only roles are considered during update.
	ReadOnly bool `json:"readOnly"`
	// The roles which the user has been assigned in an external source, e.g. LDAP group. These cannot be changed within Nexus.
	// uniqueItems: true
	ExternalRoles []ExternalRoleID `json:"externalRoles"`
}

UserUpdateRequest won't update password if field `Password` is empty

Jump to

Keyboard shortcuts

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