artifactory

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ExportSettingsMimeType string = "application/vnd.org.jfrog.artifactory.system.ExportSettings+json"

ExportSettingsMimeType is the mimetype for export settings

View Source
const GroupMimeType string = "application/vnd.org.jfrog.artifactory.security.Group+json"

GroupMimeType is the mimetype for a group

View Source
const ImportSettingsMimeType string = "application/vnd.org.jfrog.artifactory.system.ImportSettings+json"

ImportSettingsMimeType is the mimetype for import settings

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

LocalRepoMimeType is the mimetype for a local repo

View Source
const PermissionTargetMimeType string = "application/vnd.org.jfrog.artifactory.security.PermissionTarget+json"

PermissionTargetMimeType is the mimetype for a permission target

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

RemoteRepoMimeType is the mimetype for a remote repo

View Source
const SystemVersionMimeType string = "application/vnd.org.jfrog.artifactory.system.Version+json"

SystemVersionMimeType is the mimetype for system version

View Source
const UserMimeType string = "application/vnd.org.jfrog.artifactory.security.User+json"

UserMimeType is the mimetype for a user

View Source
const VERSION = "5.1"

VERSION represents the minimum version of the Artifactory API this library supports

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

VirtualRepoMimeType is the mimetype for a virtual repo

Variables

This section is empty.

Functions

This section is empty.

Types

type AQLFileInfo

type AQLFileInfo struct {
	Repo         string          `json:"repo,omitempty"`
	Path         string          `json:"path,omitempty"`
	Name         string          `json:"name,omitempty"`
	Type         string          `json:"type,omitempty"`
	Created      string          `json:"created,omitempty"`
	CreatedBy    string          `json:"created_by,omitempty"`
	Modified     string          `json:"modified,omitempty"`
	ModifiedBy   string          `json:"modified_by,omitempty"`
	Depth        int             `json:"depth,omitempty"`
	Size         int64           `json:"size,omitempty"`
	Properties   []AQLProperties `json:"properties,omitempty"`
	ActualMD5    string          `json:"actual_md5,omitempty"`
	ActualSHA1   string          `json:"actual_sha1,omitempty"`
	OriginalSHA1 string          `json:"original_sha1,omitempty"`
}

AQLFileInfo represents the json returned from artifactory for an individual file result in an AQL query

type AQLProperties

type AQLProperties struct {
	Key   string `json:"key"`
	Value string `json:"value,omitempty"`
}

AQLProperties represents the json used to compose an AQL query

type AQLResults

type AQLResults struct {
	Results []AQLFileInfo `json:"results"`
	Range   struct {
		StartPos int `json:"start_pos"`
		EndPos   int `json:"end_pos"`
		Total    int `json:"total"`
		Limit    int `json:"limit"`
	} `json:"range"`
}

AQLResults represents the json returned from artifactory for an AQL query

type Artifact

type Artifact struct {
	Info   FileInfo
	Client *Client
}

Artifact defines the structure of an artifact

func (*Artifact) Delete

func (c *Artifact) Delete() error

Delete deletes an artifact

func (*Artifact) Download

func (c *Artifact) Download() ([]byte, error)

Download downloads an artifact

type ArtifactChecksums

type ArtifactChecksums struct {
	MD5  string `json:"md5"`
	SHA1 string `json:"sha1"`
}

ArtifactChecksums represents the checksums for an artifact

type ArtifactProperties

type ArtifactProperties map[string][]string

ArtifactProperties represents a set of properties for an Artifact

type Client

type Client struct {
	Client    *http.Client
	Config    *ClientConfig
	Transport *http.Transport
}

Client is a client for interacting with Artifactory

func NewClient

func NewClient(config *ClientConfig) (c Client)

NewClient returns a new ArtifactoryClient with the provided ClientConfig

func NewClientFromEnv

func NewClientFromEnv() (c Client)

NewClientFromEnv returns a new ArtifactoryClient the is automatically configured from environment variables

func (*Client) CreateGroup

func (c *Client) CreateGroup(gname string, g GroupDetails) error

CreateGroup creates a group in artifactory

func (*Client) CreatePermissionTarget

func (c *Client) CreatePermissionTarget(u string, p PermissionTargetDetails, q map[string]string) error

CreatePermissionTarget creates the named permission target

func (*Client) CreateRepo

func (client *Client) CreateRepo(key string, r RepoConfig, q map[string]string) error

CreateRepo creates the named repo

func (*Client) CreateUser

func (c *Client) CreateUser(uname string, u UserDetails) error

CreateUser creates a user with the specified details

func (*Client) CreateUserAPIKey

func (c *Client) CreateUserAPIKey() (string, error)

CreateUserAPIKey creates an apikey for the current user

func (*Client) Delete

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

Delete performs an http DELETE to artifactory

func (*Client) DeleteArtifact

func (c *Client) DeleteArtifact(repo, path string) ([]byte, error)

DeleteArtifact deletes the named artifact from the provided repo

func (*Client) DeleteUser

func (c *Client) DeleteUser(uname string) error

DeleteUser deletes a user

func (*Client) DeployArtifact

func (c *Client) DeployArtifact(repoKey string, filename string, path string, properties map[string]string) (CreatedStorageItem, error)

DeployArtifact deploys the named artifact to the provided repo

func (*Client) DockerSearch

func (c *Client) DockerSearch(name string) (files []FileInfo, e error)

DockerSearch searches for docker images

func (*Client) GAVCSearch

func (c *Client) GAVCSearch(coords *GAVC) (files []FileInfo, e error)

GAVCSearch performs a search based on GAVC coordinates

func (*Client) Get

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

Get performs an http GET to artifactory

func (*Client) GetFileInfo

func (c *Client) GetFileInfo(path string) (a Artifact, err error)

GetFileInfo returns the details about an artifact

func (*Client) GetGeneralConfiguration

func (c *Client) GetGeneralConfiguration() (s string, e error)

GetGeneralConfiguration returns the general artifactory configuration

func (*Client) GetGroupDetails

func (c *Client) GetGroupDetails(u string) (GroupDetails, error)

GetGroupDetails returns details for a Group

func (*Client) GetGroups

func (c *Client) GetGroups() ([]Group, error)

GetGroups gets a list of groups from artifactory

func (*Client) GetLicenseInformation

func (c *Client) GetLicenseInformation() (LicenseInformation, error)

GetLicenseInformation returns license information from Artifactory

func (*Client) GetPermissionTargetDetails

func (c *Client) GetPermissionTargetDetails(u string) (PermissionTargetDetails, error)

GetPermissionTargetDetails returns the details of the provided permission target

func (*Client) GetPermissionTargets

func (c *Client) GetPermissionTargets() ([]PermissionTarget, error)

GetPermissionTargets returns all permission targets

func (*Client) GetRepo

func (client *Client) GetRepo(key string) (RepoConfig, error)

GetRepo returns the named repo

func (*Client) GetRepos

func (client *Client) GetRepos(rtype string) ([]Repo, error)

GetRepos returns all repos of the provided type

func (*Client) GetSystemSecurityConfiguration

func (c *Client) GetSystemSecurityConfiguration() (s string, e error)

GetSystemSecurityConfiguration returns the security configuration for the artifactory server

func (*Client) GetUserAPIKey

func (c *Client) GetUserAPIKey() (string, error)

GetUserAPIKey returns the current user's api key

func (*Client) GetUserDetails

func (c *Client) GetUserDetails(u string) (UserDetails, error)

GetUserDetails returns details for the named user

func (*Client) GetUserEncryptedPassword

func (c *Client) GetUserEncryptedPassword() (string, error)

GetUserEncryptedPassword returns the current user's encrypted password

func (*Client) GetUsers

func (c *Client) GetUsers() ([]User, error)

GetUsers returns all users

func (*Client) HTTPRequest

func (c *Client) HTTPRequest(ar Request) ([]byte, error)

HTTPRequest performs an HTTP request to artifactory

func (*Client) HTTPRequestWithResponse

func (c *Client) HTTPRequestWithResponse(ar Request) (*http.Response, error)

HTTPRequestWithResponse performs an HTTP request to artifactory and returns the http response

func (*Client) ListFiles

func (c *Client) ListFiles(repo string) (fileList FileList, err error)

ListFiles lists all files in the specified repo

func (*Client) Post

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

Post performs an http POST to artifactory

func (*Client) Put

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

Put performs an http PUT to artifactory

func (*Client) RetrieveArtifact

func (c *Client) RetrieveArtifact(repo string, path string) ([]byte, error)

RetrieveArtifact downloads the named artifact from the provided repo

func (*Client) UpdateRepo

func (client *Client) UpdateRepo(key string, r RepoConfig, q map[string]string) error

UpdateRepo updates the named repo

func (*Client) VagrantSearch

func (c *Client) VagrantSearch(name string) (files []AQLFileInfo, e error)

VagrantSearch searches for vagrant images

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 ArtifactoryClient

type CreatedStorageItem

type CreatedStorageItem struct {
	URI               string            `json:"uri"`
	DownloadURI       string            `json:"downloadUri"`
	Repo              string            `json:"repo"`
	Created           string            `json:"created"`
	CreatedBy         string            `json:"createdBy"`
	Size              string            `json:"size"`
	MimeType          string            `json:"mimeType"`
	Checksums         ArtifactChecksums `json:"checksums"`
	OriginalChecksums ArtifactChecksums `json:"originalChecksums"`
}

CreatedStorageItem represents a created storage item in artifactory

type ErrorJSON

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

ErrorJSON represents a single error message returned by the artifactory API

type ErrorsJSON

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

ErrorsJSON represents a group of error messages returned by the artifactory api

type FileInfo

type FileInfo struct {
	URI          string             `json:"uri"`
	DownloadURI  string             `json:"downloadUri"`
	Repo         string             `json:"repo"`
	Path         string             `json:"path"`
	RemoteURL    string             `json:"remoteUrl,omitempty"`
	Created      string             `json:"created"`
	CreatedBy    string             `json:"createdBy"`
	LastModified string             `json:"lastModified"`
	ModifiedBy   string             `json:"modifiedBy"`
	MimeType     string             `json:"mimeType"`
	Size         string             `json:"size"`
	Properties   ArtifactProperties `json:"properties"`
	Checksums    struct {
		SHA1 string `json:"sha1"`
		MD5  string `json:"md5"`
	} `json:"checksums"`
	OriginalChecksums struct {
		SHA1 string `json:"sha1"`
		MD5  string `json:"md5"`
	} `json:"originalChecksums,omitempty"`
}

FileInfo represents the json returned by the artifactory API for a file

type FileList

type FileList struct {
	URI     string         `json:"uri"`
	Created string         `json:"created"`
	Files   []FileListItem `json:"files"`
}

FileList represents a list of files

type FileListItem

type FileListItem struct {
	URI          string `json:"uri"`
	Size         int    `json:"size"`
	LastModified string `json:"lastModified"`
	Folder       bool   `json:"folder"`
	SHA1         string `json:"sha1"`
}

FileListItem is an item in a list of files

type GAVC

type GAVC struct {
	GroupID    string
	ArtifactID string
	Version    string
	Classifier string
	Repos      []string
}

GAVC represents a GAVC search

type GavcSearchResults

type GavcSearchResults struct {
	Results []FileInfo `json:"results"`
}

GavcSearchResults represents gavc search results

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"`
	HandleReleases               bool     `json:"handleReleases,omitempty"`
	HandleSnapshots              bool     `json:"handleSnapshots,omitempty"`
	MaxUniqueSnapshots           int      `json:"maxUniqueSnapshots,omitempty"`
	SuppressPomConsistencyChecks bool     `json:"supressPomConsistencyChecks,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 Group

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

Group represents the json response for a group in Artifactory

type GroupDetails

type GroupDetails struct {
	Name            string `json:"name,omitempty"`
	Description     string `json:"description,omitempty"`
	AutoJoin        bool   `json:"autoJoin,omitempty"`
	Realm           string `json:"realm,omitempty"`
	RealmAttributes string `json:"realmAttributes,omitempty"`
}

GroupDetails represents the json response for a group's details in artifactory

type LicenseInformation

type LicenseInformation struct {
	LicenseType  string `json:"type"`
	ValidThrough string `json:"validThrough"`
	LicensedTo   string `json:"licensedTo"`
}

LicenseInformation represents the json response from artifactory for license information

type LocalRepoConfig

type LocalRepoConfig struct {
	GenericRepoConfig

	LayoutRef               string `json:"repoLayoutRef,omitempty"`
	DebianTrivialLayout     bool   `json:"debianTrivialLayout,omitempty"`
	ChecksumPolicyType      string `json:"checksumPolicyType,omitempty"`
	SnapshotVersionBehavior string `json:"snapshotVersionBehavior,omitempty"`
	ArchiveBrowsingEnabled  bool   `json:"archiveBrowsingEnabled,omitempty"`
	CalculateYumMetadata    bool   `json:"calculateYumMetadata,omitempty"`
	YumRootDepth            int    `json:"yumRootDepth,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 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"`
	ShareConfiguration                bool   `json:"shareConfiguration,omitempty"`
	SynchronizeProperties             bool   `json:"synchronizeProperties,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"`
}

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 RepoConfig

type RepoConfig interface {
	MimeType() string
}

RepoConfig represents a repo config

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 URI

type URI struct {
	URI string `json:"uri,omitempty"`
}

URI is a URI in artifactory json

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"`
	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"`
	PomRepositoryReferenceCleanupPolicy           string   `json:"pomRepositoryReferenceCleanupPolicy,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