config

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToolName            = "mongocli"      // ToolName of the CLI
	EnvPrefix           = "mcli"          // EnvPrefix prefix for ENV variables
	DefaultProfile      = "default"       // DefaultProfile default
	CloudService        = "cloud"         // CloudService setting when using Atlas API
	CloudGovService     = "cloudgov"      // CloudGovService setting when using Atlas API for Government
	CloudManagerService = "cloud-manager" // CloudManagerService settings when using CLoud Manager API
	OpsManagerService   = "ops-manager"   // OpsManagerService settings when using Ops Manager API
	JSON                = "json"          // JSON output format as json

)

Variables

View Source
var UserAgent = fmt.Sprintf("%s/%s (%s;%s)", ToolName, version.Version, runtime.GOOS, runtime.GOARCH)

Functions

func AuthToken added in v1.22.0

func AuthToken() string

AuthToken get configured public api key.

func BooleanProperties added in v1.20.0

func BooleanProperties() []string

func Delete added in v1.1.0

func Delete() error

Delete deletes an existing configuration. The profiles are reloaded afterwards, as this edits the file directly.

func Exists added in v1.1.0

func Exists(name string) bool

Exists returns true if there are any set settings for the profile name.

func Get added in v1.2.0

func Get(name string) interface{}

func GetBool added in v1.20.0

func GetBool(name string) bool

func GetString

func GetString(name string) string

func GlobalProperties added in v1.20.0

func GlobalProperties() []string

func IsAccessSet added in v1.1.0

func IsAccessSet() bool

IsAccessSet return true if API keys have been set up. For Ops Manager we also check for the base URL.

func IsCloud added in v1.20.0

func IsCloud() bool

func IsTrue added in v1.20.0

func IsTrue(s string) bool

func List added in v1.1.0

func List() []string

List returns the names of available profiles.

func Load

func Load() error

Load loads the configuration from disk.

func Map added in v1.3.0

func Map() map[string]string

Map returns a map describing the configuration.

func MongoShellPath added in v1.14.0

func MongoShellPath() string

MongoShellPath get the configured MongoDB Shell path.

func Name

func Name() string

func OpsManagerCACertificate added in v1.1.0

func OpsManagerCACertificate() string

OpsManagerCACertificate get configured ops manager CA certificate location.

func OpsManagerSkipVerify added in v1.1.0

func OpsManagerSkipVerify() string

OpsManagerSkipVerify get configured if transport should skip CA verification.

func OpsManagerURL

func OpsManagerURL() string

OpsManagerURL get configured ops manager base url.

func OpsManagerVersionManifestURL added in v1.7.0

func OpsManagerVersionManifestURL() string

OpsManagerVersionManifestURL get configured ops manager version manifest base url.

func OrgID

func OrgID() string

OrgID get configured organization ID.

func Output added in v1.3.0

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 Properties

func Properties() []string

func PublicAPIKey

func PublicAPIKey() string

PublicAPIKey get configured public api key.

func RefreshToken added in v1.22.0

func RefreshToken() string

RefreshToken get configured private api key.

func Rename added in v1.1.0

func Rename(newProfileName string) error

Rename replaces the Profile to a new Profile name, overwriting any Profile that existed before.

func Save

func Save() error

Save the configuration to disk.

func Service

func Service() string

Service get configured service.

func Set

func Set(name string, value interface{})

func SetAuthToken added in v1.22.0

func SetAuthToken(v string)

SetAuthToken set configured publicAPIKey.

func SetGlobal added in v1.14.0

func SetGlobal(name string, value interface{})

func SetMongoShellPath added in v1.14.0

func SetMongoShellPath(v string)

SetMongoShellPath sets the global MongoDB Shell path.

func SetName

func SetName(name string)

func SetOpsManagerURL

func SetOpsManagerURL(v string)

SetOpsManagerURL set configured ops manager base url.

func SetOrgID

func SetOrgID(v string)

SetOrgID sets the global organization ID.

func SetOutput added in v1.3.0

func SetOutput(v string)

SetOutput sets the global output format.

func SetPrivateAPIKey

func SetPrivateAPIKey(v string)

SetPrivateAPIKey set configured private api key.

func SetProjectID

func SetProjectID(v string)

SetProjectID sets the global project ID.

func SetPublicAPIKey

func SetPublicAPIKey(v string)

SetPublicAPIKey set configured publicAPIKey.

func SetRefreshToken added in v1.22.0

func SetRefreshToken(v string)

SetRefreshToken set configured private api key.

func SetService

func SetService(v string)

SetService set configured service.

func SetSkipUpdateCheck added in v1.20.0

func SetSkipUpdateCheck(v bool)

SetSkipUpdateCheck sets the global skip update check.

func SkipUpdateCheck added in v1.20.0

func SkipUpdateCheck() bool

SkipUpdateCheck get the global skip update check.

func SortedKeys added in v1.2.0

func SortedKeys() []string

SortedKeys returns the properties of the Profile sorted.

Types

type GlobalSetter added in v1.20.0

type GlobalSetter interface {
	SetGlobal(string, interface{})
}

type Profile

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

func Default added in v1.0.0

func Default() *Profile

func (*Profile) AuthToken added in v1.22.0

func (p *Profile) AuthToken() string

func (*Profile) Delete added in v1.3.0

func (p *Profile) Delete() error

func (*Profile) Filename added in v1.3.0

func (p *Profile) Filename() string

func (*Profile) Get added in v1.20.0

func (p *Profile) Get(name string) interface{}

func (*Profile) GetBool added in v1.20.0

func (p *Profile) GetBool(name string) bool

func (*Profile) GetString

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

func (*Profile) IsAccessSet added in v1.3.0

func (p *Profile) IsAccessSet() bool

func (*Profile) Load

func (p *Profile) Load(readEnvironmentVars bool) error

func (*Profile) Map added in v1.3.0

func (p *Profile) Map() map[string]string

func (*Profile) MongoShellPath added in v1.14.0

func (p *Profile) MongoShellPath() string

func (*Profile) Name added in v0.5.0

func (p *Profile) Name() string

func (*Profile) OpsManagerCACertificate added in v1.3.0

func (p *Profile) OpsManagerCACertificate() string

func (*Profile) OpsManagerSkipVerify added in v1.3.0

func (p *Profile) OpsManagerSkipVerify() string

func (*Profile) OpsManagerURL

func (p *Profile) OpsManagerURL() string

func (*Profile) OpsManagerVersionManifestURL added in v1.7.0

func (p *Profile) OpsManagerVersionManifestURL() string

func (*Profile) OrgID

func (p *Profile) OrgID() string

func (*Profile) Output added in v1.3.0

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 added in v1.22.0

func (p *Profile) RefreshToken() string

func (*Profile) Rename added in v1.3.0

func (p *Profile) Rename(newProfileName string) error

func (*Profile) Save

func (p *Profile) Save() error

func (*Profile) Service

func (p *Profile) Service() string

func (*Profile) Set

func (p *Profile) Set(name string, value interface{})

func (*Profile) SetAuthToken added in v1.22.0

func (p *Profile) SetAuthToken(v string)

func (*Profile) SetGlobal added in v1.14.0

func (p *Profile) SetGlobal(name string, value interface{})

func (*Profile) SetMongoShellPath added in v1.14.0

func (p *Profile) SetMongoShellPath(v string)

func (*Profile) SetName

func (p *Profile) SetName(name string)

func (*Profile) SetOpsManagerURL

func (p *Profile) SetOpsManagerURL(v string)

func (*Profile) SetOrgID

func (p *Profile) SetOrgID(v string)

func (*Profile) SetOutput added in v1.3.0

func (p *Profile) SetOutput(v string)

func (*Profile) SetPrivateAPIKey

func (p *Profile) SetPrivateAPIKey(v string)

func (*Profile) SetProjectID

func (p *Profile) SetProjectID(v string)

func (*Profile) SetPublicAPIKey

func (p *Profile) SetPublicAPIKey(v string)

func (*Profile) SetRefreshToken added in v1.22.0

func (p *Profile) SetRefreshToken(v string)

func (*Profile) SetService

func (p *Profile) SetService(v string)

func (*Profile) SetSkipUpdateCheck added in v1.20.0

func (p *Profile) SetSkipUpdateCheck(v bool)

func (*Profile) SkipUpdateCheck added in v1.20.0

func (p *Profile) SkipUpdateCheck() bool

func (*Profile) SortedKeys added in v1.3.0

func (p *Profile) SortedKeys() []string

type Saver added in v1.0.0

type Saver interface {
	Save() error
}

type SetSaver added in v1.0.0

type SetSaver interface {
	Setter
	Saver
	GlobalSetter
}

type Setter added in v1.0.0

type Setter interface {
	Set(string, interface{})
}

Jump to

Keyboard shortcuts

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