config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	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"
	OpsManagerURLField = "ops_manager_url"

	AtlasCLI                 = "atlascli"
	ContainerizedHostNameEnv = "MONGODB_ATLAS_IS_CONTAINERIZED"
	GitHubActionsHostNameEnv = "GITHUB_ACTIONS"
	AtlasActionHostNameEnv   = "ATLAS_GITHUB_ACTION"
	CLIUserTypeEnv           = "CLI_USER_TYPE" // CLIUserTypeEnv is used to separate MongoDB University users from default users
	DefaultUser              = "default"       // Users that do NOT use ATLAS CLI with MongoDB University
	NativeHostName           = "native"
	DockerContainerHostName  = "container"
	GitHubActionsHostName    = "all_github_actions"
	AtlasActionHostName      = "atlascli_github_action"
)

Variables

View Source
var (
	HostName    = getConfigHostnameFromEnvs()
	UserAgent   = fmt.Sprintf("%s/%s (%s;%s;%s)", AtlasCLI, version.Version, runtime.GOOS, runtime.GOARCH, HostName)
	CLIUserType = newCLIUserTypeFromEnvs()
)

Functions

func AccessToken

func AccessToken() string

AccessToken get configured access token.

func CLIConfigHome

func CLIConfigHome() (string, error)

CLIConfigHome retrieves configHome path.

func Get

func Get(name string) any

func GetString

func GetString(name string) string

func IsTrue

func IsTrue(s string) bool

func Name

func Name() string

func OpsManagerURL

func OpsManagerURL() string

OpsManagerURL get configured ops manager base url.

func OrgID

func OrgID() string

OrgID get configured organization ID.

func Output

func Output() string

Output get configured output format.

func PrivateAPIKey

func PrivateAPIKey() string

PrivateAPIKey get configured private api key.

func ProjectID

func ProjectID() string

ProjectID get configured project ID.

func PublicAPIKey

func PublicAPIKey() string

PublicAPIKey get configured public api key.

func RefreshToken

func RefreshToken() string

RefreshToken get configured refresh token.

func Service

func Service() string

Service get configured service.

func SetGlobal

func SetGlobal(name string, value any)

func Token

func Token() (*auth.Token, error)

Token gets configured auth.Token.

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 Profile

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

func Default

func Default() *Profile

func (*Profile) AccessToken

func (p *Profile) AccessToken() string

func (*Profile) AuthType

func (p *Profile) AuthType() AuthMechanism

func (*Profile) Get

func (p *Profile) Get(name string) any

func (*Profile) GetString

func (p *Profile) GetString(name string) string

func (*Profile) Name

func (p *Profile) Name() string

func (*Profile) OpsManagerURL

func (p *Profile) OpsManagerURL() string

func (*Profile) OrgID

func (p *Profile) OrgID() string

func (*Profile) Output

func (p *Profile) Output() string

func (*Profile) PrivateAPIKey

func (p *Profile) PrivateAPIKey() string

func (*Profile) ProjectID

func (p *Profile) ProjectID() string

func (*Profile) PublicAPIKey

func (p *Profile) PublicAPIKey() string

func (*Profile) RefreshToken

func (p *Profile) RefreshToken() string

func (*Profile) Service

func (p *Profile) Service() string

func (*Profile) SetGlobal

func (*Profile) SetGlobal(name string, value any)

func (*Profile) Token

func (p *Profile) Token() (*auth.Token, error)

Jump to

Keyboard shortcuts

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