repository

package
v0.0.0-...-fd22a64 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const LocalRepoMimeType string = "application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json"

LocalRepoMimeType is the mimetype for a local repo

View Source
const RemoteRepoMimeType string = "application/vnd.org.jfrog.artifactory.repositories.RemoteRepositoryConfiguration+json"

RemoteRepoMimeType is the mimetype for a remote repo

View Source
const VERSION = "6.12.2"

VERSION : Artifactory version

View Source
const VirtualRepoMimeType string = "application/vnd.org.jfrog.artifactory.repositories.VirtualRepositoryConfiguration+json"

VirtualRepoMimeType is the mimetype for a virtual repo

Variables

View Source
var Code int
View Source
var Status string

Functions

func Delete

func Delete(c *Client, path string) (int, string, error)

Delete performs an http DELETE to artifactory

func GenerateRandomPassword

func GenerateRandomPassword() string

GenerateRandomPassword : Generates a Random password for internal user

func Get

func Get(c *Client, path string, options map[string]string) ([]byte, int, string, error)

Get performs an http GET to artifactory

func Put

func Put(c *Client, path string, data []byte, options map[string]string) ([]byte, int, string, error)

Put performs an http PUT to artifactory

Types

type Client

type Client struct {
	Client    *http.Client
	Config    *ClientConfig
	Transport *http.Transport
	// contains filtered or unexported fields
}

Client is a client for interacting with REPOSITORY

func NewClient

func NewClient(config *ClientConfig) Client

NewClient returns a new REPOSITORY Client with the provided ClientConfig

func NewRepositoryClient

func NewRepositoryClient() *Client

NewRepositoryClient : Create new repository client from environment variable

func (*Client) CleanupRepository

func (c *Client) CleanupRepository(reqName string, repoType string, namespace string) error

CleanupRepository : It clean-up everything related to repositories

func (*Client) CreatePermission

func (c *Client) CreatePermission(reqName string, repoType string, namespace string, users []string, repositories []string) error

CreatePermission : Create permission object

func (*Client) CreateRepositories

func (c *Client) CreateRepositories(repoName string, repoType string, namespace string, statusCode int) (int, string, error)

CreateRepositories : Function creates all the required repositories

func (*Client) CreateRepositoryUser

func (c *Client) CreateRepositoryUser(reqName string) (string, int, string, error)

CreateRepositoryUser : Create repository user

type ClientConfig

type ClientConfig struct {
	BaseURL    string
	Username   string
	Password   string
	Token      string
	AuthMethod string
	VerifySSL  bool
	Client     *http.Client
	Transport  *http.Transport
}

ClientConfig is the configuration for an REPOSITORY Client

type ErrorJSON

type ErrorJSON struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

ErrorJSON : Struct

type ErrorsJSON

type ErrorsJSON struct {
	Errors []ErrorJSON `json:"errors,omitempty"`
	Error  string      `json:"error,omitempty"`
}

ErrorsJSON : Struct

type GenericRepoConfig

type GenericRepoConfig struct {
	Key                          string   `json:"key,omitempty"`
	RClass                       string   `json:"rclass"`
	PackageType                  string   `json:"packageType,omitempty"`
	Description                  string   `json:"description,omitempty"`
	Notes                        string   `json:"notes,omitempty"`
	IncludesPattern              string   `json:"includesPattern,omitempty"`
	ExcludesPattern              string   `json:"excludesPattern,omitempty"`
	LayoutRef                    string   `json:"repoLayoutRef,omitempty"`
	HandleReleases               *bool    `json:"handleReleases,omitempty"`
	HandleSnapshots              *bool    `json:"handleSnapshots,omitempty"`
	MaxUniqueSnapshots           int      `json:"maxUniqueSnapshots,omitempty"`
	SuppressPomConsistencyChecks bool     `json:"suppressPomConsistencyChecks,omitempty"`
	BlackedOut                   bool     `json:"blackedOut,omitempty"`
	PropertySets                 []string `json:"propertySets,omitempty"`
}

GenericRepoConfig represents the common json of a repo response from artifactory

func (GenericRepoConfig) MimeType

func (r GenericRepoConfig) MimeType() string

MimeType returns the MimeType of a GenericRepoConfig

type LocalRepoConfig

type LocalRepoConfig struct {
	GenericRepoConfig

	DebianTrivialLayout     bool   `json:"debianTrivialLayout,omitempty"`
	ChecksumPolicyType      string `json:"checksumPolicyType,omitempty"`
	MaxUniqueTags           int    `json:"maxUniqueTags,omitempty"`
	SnapshotVersionBehavior string `json:"snapshotVersionBehavior,omitempty"`
	ArchiveBrowsingEnabled  bool   `json:"archiveBrowsingEnabled,omitempty"`
	CalculateYumMetadata    bool   `json:"calculateYumMetadata,omitempty"`
	YumRootDepth            int    `json:"yumRootDepth,omitempty"`
	DockerAPIVersion        string `json:"dockerApiVersion,omitempty"`
	EnableFileListsIndexing bool   `json:"enableFileListsIndexing,omitempty"`
	XrayIndex               bool   `json:"xrayIndex,omitempty"`
}

LocalRepoConfig represents a local repo type in artifactory

func (LocalRepoConfig) MimeType

func (r LocalRepoConfig) MimeType() string

MimeType returns the MimeType for a local repo in artifactory

type PermissionTarget

type PermissionTarget struct {
	Name string `json:"name"`
	URI  string `json:"uri"`
}

PermissionTarget represents the json returned by Artifactory for a permission target

type PermissionTargetDetails

type PermissionTargetDetails struct {
	Name            string     `json:"name,omitempty"`
	IncludesPattern string     `json:"includesPattern,omitempty"`
	ExcludesPattern string     `json:"excludesPattern,omitempty"`
	Repositories    []string   `json:"repositories,omitempty"`
	Principals      Principals `json:"principals,omitempty"`
}

PermissionTargetDetails represents the json returned by Artifactory for permission target details

type Principals

type Principals struct {
	Users  map[string][]string `json:"users"`
	Groups map[string][]string `json:"groups"`
}

Principals represents the json response for principals in Artifactory

type RTFactory

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

func (RTFactory) CreatePermissionTarget

func (R RTFactory) CreatePermissionTarget(c *Client, key string, p PermissionTargetDetails, q map[string]string) (int, string, error)

CreatePermissionTarget creates the named permission target

func (RTFactory) CreateRepo

func (R RTFactory) CreateRepo(c *Client, key string, r RepositoryConfig, q map[string]string) (int, string, error)

CreateRepo creates the named repo

func (RTFactory) CreateUser

func (R RTFactory) CreateUser(c *Client, key string, u UserDetails, q map[string]string) (int, string, error)

CreateUser creates a user with the specified details

func (RTFactory) DeletePermissionTarget

func (R RTFactory) DeletePermissionTarget(c *Client, key string) (int, string, error)

DeletePermissionTarget : Delete permission target

func (RTFactory) DeleteRepo

func (R RTFactory) DeleteRepo(c *Client, key string) (int, string, error)

DeleteRepo creates the named repo

func (RTFactory) DeleteUser

func (R RTFactory) DeleteUser(c *Client, key string) (int, string, error)

DeleteUser deletes a user

func (RTFactory) GetLocalRepo

func (R RTFactory) GetLocalRepo(c *Client, key string, q map[string]string) (RepositoryConfig, int, string, error)

GetLocalRepo returns the named local repo

func (RTFactory) GetPermissionTargetDetails

func (R RTFactory) GetPermissionTargetDetails(c *Client, key string, q map[string]string) (PermissionTargetDetails, int, string, error)

GetPermissionTargetDetails : get details about the permission target

func (RTFactory) GetRemoteRepos

func (R RTFactory) GetRemoteRepos(c *Client, packageType string) ([]RemoteRepo, int, string, error)

GetRemoteRepos returns all repos of the provided type

func (RTFactory) GetUser

func (R RTFactory) GetUser(c *Client, key string, q map[string]string) (RepositoryUser, int, string, error)

GetUser : Get user

func (RTFactory) GetVirtualRepo

func (R RTFactory) GetVirtualRepo(c *Client, key string, q map[string]string) (RepositoryConfig, int, string, error)

GetLocalRepo returns the named local repo

type RemoteRepo

type RemoteRepo struct {
	Key         string `json:"key"`
	Rtype       string `json:"type"`
	URL         string `json:"url,omitempty"`
	PackageType string `json:"packagetype,omitempty"`
}

RemoteRepo : Repo represents the json response from Artifactory describing a repository

type RemoteRepoConfig

type RemoteRepoConfig struct {
	GenericRepoConfig

	URL                               string `json:"url"`
	Username                          string `json:"username,omitempty"`
	Password                          string `json:"password,omitempty"`
	Proxy                             string `json:"proxy,omitempty"`
	RemoteRepoChecksumPolicyType      string `json:"remoteRepoChecksumPolicyType,omitempty"`
	HardFail                          bool   `json:"hardFail,omitempty"`
	Offline                           bool   `json:"offline,omitempty"`
	StoreArtifactsLocally             bool   `json:"storeArtifactsLocally,omitempty"`
	SocketTimeoutMillis               int    `json:"socketTimeoutMillis,omitempty"`
	LocalAddress                      string `json:"localAddress,omitempty"`
	RetrivialCachePeriodSecs          int    `json:"retrievalCachePeriodSecs,omitempty"`
	FailedRetrievalCachePeriodSecs    int    `json:"failedRetrievalCachePeriodSecs,omitempty"`
	MissedRetrievalCachePeriodSecs    int    `json:"missedRetrievalCachePeriodSecs,omitempty"`
	UnusedArtifactsCleanupEnabled     bool   `json:"unusedArtifactCleanupEnabled,omitempty"`
	UnusedArtifactsCleanupPeriodHours int    `json:"unusedArtifactCleanupPeriodHours,omitempty"`
	FetchJarsEagerly                  bool   `json:"fetchJarsEagerly,omitempty"`
	FetchSourcesEagerly               bool   `json:"fetchSourcesEagerly,omitempty"`
	ShareConfiguration                bool   `json:"shareConfiguration,omitempty"`
	SynchronizeProperties             bool   `json:"synchronizeProperties,omitempty"`
	BlockMismatchingMimeTypes         bool   `json:"blockMismatchingMimeTypes,omitempty"`
	AllowAnyHostAuth                  bool   `json:"allowAnyHostAuth,omitempty"`
	EnableCookieManagement            bool   `json:"enableCookieManagement,omitempty"`
	BowerRegistryURL                  string `json:"bowerRegistryUrl,omitempty"`
	VcsType                           string `json:"vcsType,omitempty"`
	VcsGitProvider                    string `json:"vcsGitProvider,omitempty"`
	VcsGitDownloader                  string `json:"vcsGitDownloader,omitempty"`
	ClientTLSCertificate              string `json:"clientTlsCertificate,omitempty"`
}

RemoteRepoConfig represents a remote repo in artifactory

func (RemoteRepoConfig) MimeType

func (r RemoteRepoConfig) MimeType() string

MimeType returns the mimetype of a remote repo

type Repo

type Repo struct {
	Key         string `json:"key"`
	Rtype       string `json:"type"`
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
}

Repo represents the json response from Artifactory describing a repository

type RepositoryConfig

type RepositoryConfig interface {
	MimeType() string
}

RepositoryConfig represents a repo config

type RepositoryUser

type RepositoryUser struct {
	Name                     string    `json:"name"`
	Email                    string    `json:"email"`
	Admin                    bool      `json:"admin"`
	ProfileUpdatable         bool      `json:"profileUpdatable"`
	InternalPasswordDisabled bool      `json:"internalPasswordDisabled"`
	Groups                   []string  `json:"groups"`
	LastLoggedIn             time.Time `json:"lastLoggedIn"`
	LastLoggedInMillis       int       `json:"lastLoggedInMillis"`
	Realm                    string    `json:"realm"`
	OfflineMode              bool      `json:"offlineMode"`
	DisableUIAccess          bool      `json:"disableUIAccess"`
}

RepositoryUser struct

type Request

type Request struct {
	Verb        string
	Path        string
	ContentType string
	Accept      string
	QueryParams map[string]string
	Body        io.Reader
}

Request represents an artifactory http request

type User

type User struct {
	Name string `json:"name"`
	URI  string `json:"uri"`
}

User represents a user in artifactory

type UserAPIKey

type UserAPIKey struct {
	APIKey string `json:"apiKey"`
}

UserAPIKey represents the JSON returned for a user's API Key in Artifactory

type UserDetails

type UserDetails struct {
	Name                     string   `json:"name,omitempty"`
	Email                    string   `json:"email"`
	Password                 string   `json:"password"`
	Admin                    bool     `json:"admin,omitempty"`
	ProfileUpdatable         bool     `json:"profileUpdatable,omitempty"`
	DisableUIAccess          bool     `json:"disableUIAccess,omitempty"`
	InternalPasswordDisabled bool     `json:"internalPasswordDisabled,omitempty"`
	LastLoggedIn             string   `json:"lastLoggedIn,omitempty"`
	Realm                    string   `json:"realm,omitempty"`
	Groups                   []string `json:"groups,omitempty"`
}

UserDetails represents the details of a user in artifactory

type VirtualRepoConfig

type VirtualRepoConfig struct {
	GenericRepoConfig

	Repositories                                  []string `json:"repositories"`
	DebianTrivialLayout                           bool     `json:"debianTrivialLayout,omitempty"`
	ArtifactoryRequestsCanRetrieveRemoteArtifacts bool     `json:"artifactoryRequestsCanRetrieveRemoteArtifacts,omitempty"`
	KeyPair                                       string   `json:"keyPair,omitempty"`
	PomRepositoryReferencesCleanupPolicy          string   `json:"pomRepositoryReferencesCleanupPolicy,omitempty"`
	DefaultDeploymentRepo                         string   `json:"defaultDeploymentRepo,omitempty"`
}

VirtualRepoConfig represents a virtual repo in artifactory

func (VirtualRepoConfig) MimeType

func (r VirtualRepoConfig) MimeType() string

MimeType returns the mimetype for a virtual repo in artifactory

Jump to

Keyboard shortcuts

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