config

package
v2.34.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 37 Imported by: 49

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 ArtifactoryTokenRefreshPreRequestInterceptor added in v2.14.0

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

func CreateInitialRefreshableTokensIfNeeded

func CreateInitialRefreshableTokensIfNeeded(serverDetails *ServerDetails) (err error)

func Export

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

func GetAndRemoveConfiguration

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

func GetJfrogDependenciesPath

func GetJfrogDependenciesPath() (string, error)

func IsServerConfExists

func IsServerConfExists() (bool, error)

func SaveServersConf

func SaveServersConf(details []*ServerDetails) error

Types

type Config added in v2.14.0

type Config struct {
	ConfigV6
}

Config represents the CLI latest config version.

func (*Config) Clone added in v2.31.0

func (config *Config) Clone() (*Config, error)

type ConfigV0

type ConfigV0 struct {
	Artifactory    *ServerDetails         `json:"artifactory,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

type ConfigV4 struct {
	Artifactory    []*ServerDetails       `json:"artifactory"`
	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.

func (*ConfigV4) Convert

func (o *ConfigV4) Convert() *ConfigV5

type ConfigV5

type ConfigV5 struct {
	Servers []*ServerDetails `json:"servers"`
	Version string           `json:"version,omitempty"`
	Enc     bool             `json:"enc,omitempty"`
}

func (*ConfigV5) Convert added in v2.14.0

func (o *ConfigV5) Convert() *ConfigV6

type ConfigV6 added in v2.14.0

type ConfigV6 struct {
	ConfigV5
}

type MissionControlDetails

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

Deprecated

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"`
}

type ServerDetails

type ServerDetails struct {
	Url                             string `json:"url,omitempty"`
	SshUrl                          string `json:"-"`
	ArtifactoryUrl                  string `json:"artifactoryUrl,omitempty"`
	DistributionUrl                 string `json:"distributionUrl,omitempty"`
	XrayUrl                         string `json:"xrayUrl,omitempty"`
	MissionControlUrl               string `json:"missionControlUrl,omitempty"`
	PipelinesUrl                    string `json:"pipelinesUrl,omitempty"`
	AccessUrl                       string `json:"accessUrl,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"`
	ArtifactoryRefreshToken         string `json:"artifactoryRefreshToken,omitempty"`
	ArtifactoryTokenRefreshInterval 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:"-"`
}

func GetAllServersConfigs

func GetAllServersConfigs() ([]*ServerDetails, error)

func GetDefaultConfiguredConf

func GetDefaultConfiguredConf(configs []*ServerDetails) (*ServerDetails, error)

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

func GetDefaultServerConf

func GetDefaultServerConf() (*ServerDetails, error)

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

func GetSpecificConfig

func GetSpecificConfig(serverId string, defaultOrEmpty bool, excludeRefreshableTokens bool) (*ServerDetails, 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 Import

func Import(configTokenString string) (*ServerDetails, error)

func (*ServerDetails) CreateAccessAuthConfig added in v2.2.0

func (serverDetails *ServerDetails) CreateAccessAuthConfig() (auth.ServiceDetails, error)

func (*ServerDetails) CreateArtAuthConfig

func (serverDetails *ServerDetails) CreateArtAuthConfig() (auth.ServiceDetails, error)

func (*ServerDetails) CreateDistAuthConfig

func (serverDetails *ServerDetails) CreateDistAuthConfig() (auth.ServiceDetails, error)

func (*ServerDetails) CreatePipelinesAuthConfig

func (serverDetails *ServerDetails) CreatePipelinesAuthConfig() (auth.ServiceDetails, error)

func (*ServerDetails) CreateXrayAuthConfig

func (serverDetails *ServerDetails) CreateXrayAuthConfig() (auth.ServiceDetails, error)

func (*ServerDetails) GetAccessToken

func (serverDetails *ServerDetails) GetAccessToken() string

func (*ServerDetails) GetAccessUrl added in v2.2.0

func (serverDetails *ServerDetails) GetAccessUrl() string

func (*ServerDetails) GetArtifactoryUrl

func (serverDetails *ServerDetails) GetArtifactoryUrl() string

func (*ServerDetails) GetClientCertKeyPath

func (serverDetails *ServerDetails) GetClientCertKeyPath() string

func (*ServerDetails) GetClientCertPath

func (serverDetails *ServerDetails) GetClientCertPath() string

func (*ServerDetails) GetDistributionUrl

func (serverDetails *ServerDetails) GetDistributionUrl() string

func (*ServerDetails) GetMissionControlUrl

func (serverDetails *ServerDetails) GetMissionControlUrl() string

func (*ServerDetails) GetPassword

func (serverDetails *ServerDetails) GetPassword() string

func (*ServerDetails) GetPipelinesUrl

func (serverDetails *ServerDetails) GetPipelinesUrl() string

func (*ServerDetails) GetRefreshToken

func (serverDetails *ServerDetails) GetRefreshToken() string

func (*ServerDetails) GetUrl

func (serverDetails *ServerDetails) GetUrl() string

func (*ServerDetails) GetUser

func (serverDetails *ServerDetails) GetUser() string

func (*ServerDetails) GetXrayUrl

func (serverDetails *ServerDetails) GetXrayUrl() string

func (*ServerDetails) IsEmpty

func (serverDetails *ServerDetails) IsEmpty() bool

func (*ServerDetails) SetAccessToken

func (serverDetails *ServerDetails) SetAccessToken(accessToken string)

func (*ServerDetails) SetArtifactoryRefreshToken added in v2.14.0

func (serverDetails *ServerDetails) SetArtifactoryRefreshToken(refreshToken string)

func (*ServerDetails) SetClientCertKeyPath

func (serverDetails *ServerDetails) SetClientCertKeyPath(certificatePath string)

func (*ServerDetails) SetClientCertPath

func (serverDetails *ServerDetails) SetClientCertPath(certificatePath string)

func (*ServerDetails) SetPassword

func (serverDetails *ServerDetails) SetPassword(password string)

func (*ServerDetails) SetRefreshToken

func (serverDetails *ServerDetails) SetRefreshToken(refreshToken string)

func (*ServerDetails) SetSshPassphrase added in v2.2.0

func (serverDetails *ServerDetails) SetSshPassphrase(sshPassphrase string)

func (*ServerDetails) SetUser

func (serverDetails *ServerDetails) SetUser(username string)

type TokenType added in v2.14.0

type TokenType string
const (
	ArtifactoryToken TokenType = "artifactory"
	AccessToken      TokenType = "access"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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