config

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0 Imports: 34 Imported by: 40

Documentation

Index

Constants

View Source
const DefaultServerId = "Default-Server"

This is the default server id. It is used when adding a server config without providing a server ID

Variables

This section is empty.

Functions

func AccessTokenRefreshPreRequestInterceptor

func AccessTokenRefreshPreRequestInterceptor(fields *auth.CommonConfigFields, httpClientDetails *httputils.HttpClientDetails) (err error)

func CreateInitialRefreshableTokensIfNeeded

func CreateInitialRefreshableTokensIfNeeded(artifactoryDetails *ArtifactoryDetails) (err error)

func Export

func Export(details *ArtifactoryDetails) (string, error)

func GetAndRemoveConfiguration

func GetAndRemoveConfiguration(serverName string, configs []*ArtifactoryDetails) (*ArtifactoryDetails, []*ArtifactoryDetails)

func GetJfrogDependenciesPath

func GetJfrogDependenciesPath() (string, error)

func IsArtifactoryConfExists

func IsArtifactoryConfExists() (bool, error)

func IsBintrayConfExists

func IsBintrayConfExists() (bool, error)

func IsMissionControlConfExists

func IsMissionControlConfExists() (bool, error)

func SaveArtifactoryConf

func SaveArtifactoryConf(details []*ArtifactoryDetails) error

func SaveBintrayConf

func SaveBintrayConf(details *BintrayDetails) error

func SaveMissionControlConf

func SaveMissionControlConf(details *MissionControlDetails) error

Types

type ArtifactoryDetails

type ArtifactoryDetails struct {
	Url                  string `json:"url,omitempty"`
	SshUrl               string `json:"-"`
	DistributionUrl      string `json:"distributionUrl,omitempty"`
	User                 string `json:"user,omitempty"`
	Password             string `json:"password,omitempty"`
	SshKeyPath           string `json:"sshKeyPath,omitempty"`
	SshPassphrase        string `json:"SshPassphrase,omitempty"`
	AccessToken          string `json:"accessToken,omitempty"`
	RefreshToken         string `json:"refreshToken,omitempty"`
	TokenRefreshInterval int    `json:"tokenRefreshInterval,omitempty"`
	ClientCertPath       string `json:"clientCertPath,omitempty"`
	ClientCertKeyPath    string `json:"clientCertKeyPath,omitempty"`
	ServerId             string `json:"serverId,omitempty"`
	IsDefault            bool   `json:"isDefault,omitempty"`
	InsecureTls          bool   `json:"-"`
	// Deprecated, use password option instead.
	ApiKey string `json:"apiKey,omitempty"`
}

func GetAllArtifactoryConfigs

func GetAllArtifactoryConfigs() ([]*ArtifactoryDetails, error)

func GetArtifactorySpecificConfig

func GetArtifactorySpecificConfig(serverId string, defaultOrEmpty bool, excludeRefreshableTokens bool) (*ArtifactoryDetails, error)

Returns the configured server or error if the server id was not found. If defaultOrEmpty: return empty details if no configurations found, or default conf for empty serverId. Exclude refreshable tokens when working with external tools (build tools, curl, etc) or when sending requests not via ArtifactoryHttpClient.

func GetDefaultArtifactoryConf

func GetDefaultArtifactoryConf() (*ArtifactoryDetails, error)

Returns default artifactory conf. Returns nil if default server doesn't exists.

func GetDefaultConfiguredArtifactoryConf

func GetDefaultConfiguredArtifactoryConf(configs []*ArtifactoryDetails) (*ArtifactoryDetails, error)

Returns the default server configuration or error if not found. Caller should perform the check error if required.

func Import

func Import(serverToken string) (*ArtifactoryDetails, error)

func (*ArtifactoryDetails) CreateArtAuthConfig

func (artifactoryDetails *ArtifactoryDetails) CreateArtAuthConfig() (auth.ServiceDetails, error)

func (*ArtifactoryDetails) CreateDistAuthConfig

func (artifactoryDetails *ArtifactoryDetails) CreateDistAuthConfig() (auth.ServiceDetails, error)

func (*ArtifactoryDetails) GetAccessToken

func (artifactoryDetails *ArtifactoryDetails) GetAccessToken() string

func (*ArtifactoryDetails) GetApiKey

func (artifactoryDetails *ArtifactoryDetails) GetApiKey() string

func (*ArtifactoryDetails) GetClientCertKeyPath

func (artifactoryDetails *ArtifactoryDetails) GetClientCertKeyPath() string

func (*ArtifactoryDetails) GetClientCertPath

func (artifactoryDetails *ArtifactoryDetails) GetClientCertPath() string

func (*ArtifactoryDetails) GetDistributionUrl

func (artifactoryDetails *ArtifactoryDetails) GetDistributionUrl() string

func (*ArtifactoryDetails) GetPassword

func (artifactoryDetails *ArtifactoryDetails) GetPassword() string

func (*ArtifactoryDetails) GetRefreshToken

func (artifactoryDetails *ArtifactoryDetails) GetRefreshToken() string

func (*ArtifactoryDetails) GetUrl

func (artifactoryDetails *ArtifactoryDetails) GetUrl() string

func (*ArtifactoryDetails) GetUser

func (artifactoryDetails *ArtifactoryDetails) GetUser() string

func (*ArtifactoryDetails) IsEmpty

func (artifactoryDetails *ArtifactoryDetails) IsEmpty() bool

func (*ArtifactoryDetails) SetAccessToken

func (artifactoryDetails *ArtifactoryDetails) SetAccessToken(accessToken string)

func (*ArtifactoryDetails) SetApiKey

func (artifactoryDetails *ArtifactoryDetails) SetApiKey(apiKey string)

func (*ArtifactoryDetails) SetClientCertKeyPath

func (artifactoryDetails *ArtifactoryDetails) SetClientCertKeyPath(certificatePath string)

func (*ArtifactoryDetails) SetClientCertPath

func (artifactoryDetails *ArtifactoryDetails) SetClientCertPath(certificatePath string)

func (*ArtifactoryDetails) SetPassword

func (artifactoryDetails *ArtifactoryDetails) SetPassword(password string)

func (*ArtifactoryDetails) SetRefreshToken

func (artifactoryDetails *ArtifactoryDetails) SetRefreshToken(refreshToken string)

func (*ArtifactoryDetails) SetUser

func (artifactoryDetails *ArtifactoryDetails) SetUser(username string)

type BintrayDetails

type BintrayDetails struct {
	ApiUrl            string `json:"-"`
	DownloadServerUrl string `json:"-"`
	User              string `json:"user,omitempty"`
	Key               string `json:"key,omitempty"`
	DefPackageLicense string `json:"defPackageLicense,omitempty"`
}

func ReadBintrayConf

func ReadBintrayConf() (*BintrayDetails, error)

type ConfigV0

type ConfigV0 struct {
	Artifactory    *ArtifactoryDetails    `json:"artifactory,omitempty"`
	Bintray        *BintrayDetails        `json:"bintray,omitempty"`
	MissionControl *MissionControlDetails `json:"MissionControl,omitempty"`
}

This struct was created before the version property was added to the config.

func (*ConfigV0) Convert

func (o *ConfigV0) Convert() *ConfigV4

type ConfigV4 added in v1.1.0

type ConfigV4 struct {
	Artifactory    []*ArtifactoryDetails  `json:"artifactory"`
	Bintray        *BintrayDetails        `json:"bintray,omitempty"`
	MissionControl *MissionControlDetails `json:"missionControl,omitempty"`
	Version        string                 `json:"version,omitempty"`
	Enc            bool                   `json:"enc,omitempty"`
}

This struct is suitable for versions 1, 2, 3 and 4.

type MissionControlDetails

type MissionControlDetails struct {
	Url         string `json:"url,omitempty"`
	AccessToken string `json:"accessToken,omitempty"`
}

func ReadMissionControlConf

func ReadMissionControlConf() (*MissionControlDetails, error)

func (*MissionControlDetails) GetAccessToken

func (missionControlDetails *MissionControlDetails) GetAccessToken() string

func (*MissionControlDetails) SetAccessToken

func (missionControlDetails *MissionControlDetails) SetAccessToken(accessToken string)

type SecurityConf

type SecurityConf struct {
	Version   string `yaml:"version,omitempty"`
	MasterKey string `yaml:"masterKey,omitempty"`
}

Jump to

Keyboard shortcuts

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