Documentation ¶
Index ¶
- Constants
- Variables
- func AccessToken() string
- func AccessTokenSubject() (string, error)
- func BooleanProperties() []string
- func CLIConfigHome() (string, error)
- func ClientID() string
- func Delete() error
- func Exists(name string) bool
- func Filename() string
- func Get(name string) interface{}
- func GetBool(name string) bool
- func GetString(name string) string
- func GlobalProperties() []string
- func IsAccessSet() bool
- func IsCloud() bool
- func IsTelemetryEnabledSet() bool
- func IsTrue(s string) bool
- func List() []string
- func LoadAtlasCLIConfig() error
- func Map() map[string]string
- func MongoCLIConfigHome() (string, error)
- func Name() string
- func OldMongoCLIConfigHome() (string, error)deprecated
- func OpsManagerURL() string
- func OrgID() string
- func Output() string
- func Path(f string) (string, error)
- func PrivateAPIKey() string
- func ProjectID() string
- func Properties() []string
- func PublicAPIKey() string
- func RefreshToken() string
- func Rename(newProfileName string) error
- func Save() error
- func Service() string
- func Set(name string, value interface{})
- func SetAccessToken(v string)
- func SetGlobal(name string, value interface{})
- func SetName(name string) error
- func SetOpsManagerURL(v string)
- func SetOrgID(v string)
- func SetOutput(v string)
- func SetPrivateAPIKey(v string)
- func SetProjectID(v string)
- func SetPublicAPIKey(v string)
- func SetRefreshToken(v string)
- func SetService(v string)
- func SetSkipUpdateCheck(v bool)
- func SetTelemetryEnabled(v bool)
- func SkipUpdateCheck() bool
- func SortedKeys() []string
- func TelemetryEnabled() bool
- func Token() (*auth.Token, error)
- type AuthMechanism
- type GlobalSetter
- type Profile
- func (p *Profile) AccessToken() string
- func (p *Profile) AccessTokenSubject() (string, error)
- func (p *Profile) AuthType() AuthMechanism
- func (p *Profile) ClientID() string
- func (p *Profile) Delete() error
- func (p *Profile) Filename() string
- func (p *Profile) Get(name string) interface{}
- func (p *Profile) GetBool(name string) bool
- func (p *Profile) GetBoolWithDefault(name string, defaultValue bool) bool
- func (p *Profile) GetString(name string) string
- func (p *Profile) IsAccessSet() bool
- func (*Profile) IsTelemetryEnabledSet() bool
- func (p *Profile) LoadAtlasCLIConfig(readEnvironmentVars bool) error
- func (p *Profile) Map() map[string]string
- func (p *Profile) Name() string
- func (p *Profile) OpsManagerURL() string
- func (p *Profile) OrgID() string
- func (p *Profile) Output() string
- func (p *Profile) PrivateAPIKey() string
- func (p *Profile) ProjectID() string
- func (p *Profile) PublicAPIKey() string
- func (p *Profile) RefreshToken() string
- func (p *Profile) Rename(newProfileName string) error
- func (p *Profile) Save() error
- func (p *Profile) Service() string
- func (p *Profile) Set(name string, value interface{})
- func (p *Profile) SetAccessToken(v string)
- func (*Profile) SetGlobal(name string, value interface{})
- func (p *Profile) SetName(name string) error
- func (p *Profile) SetOpsManagerURL(v string)
- func (p *Profile) SetOrgID(v string)
- func (p *Profile) SetOutput(v string)
- func (p *Profile) SetPrivateAPIKey(v string)
- func (p *Profile) SetProjectID(v string)
- func (p *Profile) SetPublicAPIKey(v string)
- func (p *Profile) SetRefreshToken(v string)
- func (p *Profile) SetService(v string)
- func (*Profile) SetSkipUpdateCheck(v bool)
- func (*Profile) SetTelemetryEnabled(v bool)
- func (p *Profile) SkipUpdateCheck() bool
- func (p *Profile) SortedKeys() []string
- func (p *Profile) TelemetryEnabled() bool
- func (p *Profile) Token() (*auth.Token, error)
- type Saver
- type SetSaver
- type Setter
Constants ¶
const ( MongoCLIEnvPrefix = "MCLI" // MongoCLIEnvPrefix prefix for MongoCLI ENV variables AtlasCLIEnvPrefix = "MONGODB_ATLAS" // AtlasCLIEnvPrefix prefix for AtlasCLI ENV variables DefaultProfile = "default" // DefaultProfile default CloudService = "cloud" // CloudService setting when using Atlas API CloudGovService = "cloudgov" // CloudGovService setting when using Atlas API for Government AccessTokenField = "access_token" RefreshTokenField = "refresh_token" ClientIDField = "client_id" OpsManagerURLField = "ops_manager_url" TelemetryEnabledProperty = "telemetry_enabled" AtlasCLI = "atlascli" ContainerizedHostNameEnv = "MONGODB_ATLAS_IS_CONTAINERIZED" GitHubActionsHostNameEnv = "GITHUB_ACTIONS" AtlasActionHostNameEnv = "ATLAS_GITHUB_ACTION" NativeHostName = "native" DockerContainerHostName = "container" GitHubActionsHostName = "all_github_actions" AtlasActionHostName = "atlascli_github_action" )
Variables ¶
var ( HostName = getConfigHostnameFromEnvs() UserAgent = fmt.Sprintf("%s/%s (%s;%s;%s)", AtlasCLI, version.Version, runtime.GOOS, runtime.GOARCH, HostName) )
var ErrProfileNameHasDots = errors.New("profile should not contain '.'")
Functions ¶
func AccessTokenSubject ¶
AccessTokenSubject will return the encoded subject in a JWT. This method won't verify the token signature, it's only safe to use to get the token claims.
func BooleanProperties ¶
func BooleanProperties() []string
func Delete ¶
func Delete() error
Delete deletes an existing configuration. The profiles are reloaded afterwards, as this edits the file directly.
func GlobalProperties ¶
func GlobalProperties() []string
func IsAccessSet ¶
func IsAccessSet() bool
IsAccessSet return true if API keys have been set up. For Ops Manager we also check for the base URL.
func IsTelemetryEnabledSet ¶
func IsTelemetryEnabledSet() bool
IsTelemetryEnabledSet return true if telemetry_enabled has been set.
func LoadAtlasCLIConfig ¶
func LoadAtlasCLIConfig() error
func MongoCLIConfigHome ¶
MongoCLIConfigHome retrieves configHome path based used by MongoCLI.
func OldMongoCLIConfigHome
deprecated
func Properties ¶
func Properties() []string
func Rename ¶
Rename replaces the Profile to a new Profile name, overwriting any Profile that existed before.
func SetOpsManagerURL ¶
func SetOpsManagerURL(v string)
SetOpsManagerURL set configured ops manager base url.
func SetPrivateAPIKey ¶
func SetPrivateAPIKey(v string)
SetPrivateAPIKey set configured private api key.
func SetSkipUpdateCheck ¶
func SetSkipUpdateCheck(v bool)
SetSkipUpdateCheck sets the global skip update check.
func SetTelemetryEnabled ¶
func SetTelemetryEnabled(v bool)
SetTelemetryEnabled sets the telemetry enabled value.
func SkipUpdateCheck ¶
func SkipUpdateCheck() bool
SkipUpdateCheck get the global skip update check.
func SortedKeys ¶
func SortedKeys() []string
SortedKeys returns the properties of the Profile sorted.
func TelemetryEnabled ¶
func TelemetryEnabled() bool
TelemetryEnabled get the configured telemetry enabled value.
Types ¶
type AuthMechanism ¶
type AuthMechanism int
const ( APIKeys AuthMechanism = iota OAuth NotLoggedIn )
func AuthType ¶
func AuthType() AuthMechanism
AuthType returns the type of authentication used in the profile.
type GlobalSetter ¶
type GlobalSetter interface {
SetGlobal(string, interface{})
}
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
func (*Profile) AccessToken ¶
func (*Profile) AccessTokenSubject ¶
func (*Profile) AuthType ¶
func (p *Profile) AuthType() AuthMechanism
func (*Profile) GetBoolWithDefault ¶
func (*Profile) IsAccessSet ¶
func (*Profile) IsTelemetryEnabledSet ¶
func (*Profile) LoadAtlasCLIConfig ¶
func (*Profile) OpsManagerURL ¶
func (*Profile) PrivateAPIKey ¶
func (*Profile) PublicAPIKey ¶
func (*Profile) RefreshToken ¶
func (*Profile) SetAccessToken ¶
func (*Profile) SetOpsManagerURL ¶
func (*Profile) SetPrivateAPIKey ¶
func (*Profile) SetProjectID ¶
func (*Profile) SetPublicAPIKey ¶
func (*Profile) SetRefreshToken ¶
func (*Profile) SetService ¶
func (*Profile) SetSkipUpdateCheck ¶
func (*Profile) SetTelemetryEnabled ¶
func (*Profile) SkipUpdateCheck ¶
func (*Profile) SortedKeys ¶
func (*Profile) TelemetryEnabled ¶
type SetSaver ¶
type SetSaver interface { Setter Saver GlobalSetter }