config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToolName            = "mongocli"      // ToolName of the CLI
	EnvPrefix           = "mcli"          // Prefix for ENV variables
	DefaultProfile      = "default"       // DefaultProfile default
	CloudService        = "cloud"         // CloudService setting when using Atlas API
	CloudManagerService = "cloud-manager" // CloudManagerService settings when using CLoud Manager API
	OpsManagerService   = "ops-manager"   // OpsManagerService settings when using Ops Manager API

)

Variables

This section is empty.

Functions

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() map[string]string

Get returns a map describing the configuration.

func GetString

func GetString(name string) 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 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 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

SkipVerify get configured ops manager CA certificate location

func OpsManagerURL

func OpsManagerURL() string

OpsManagerURL get configured ops manager base url

func OrgID

func OrgID() string

OrgID get configured organization ID

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 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, value string)

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 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 SetService

func SetService(v string)

SetService set configured service

func SortedKeys added in v1.2.0

func SortedKeys() []string

SortedKeys returns the properties of the profile sorted.

Types

type Config added in v0.5.0

type Config interface {
	Setter
	Getter
	Saver
	Service() string
	PublicAPIKey() string
	PrivateAPIKey() string
	OpsManagerURL() string
	OpsManagerCACertificate() string
	OpsManagerSkipVerify() string
}

func Default added in v1.0.0

func Default() Config

type Getter added in v1.0.0

type Getter interface {
	GetString(string) 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
}

type Setter added in v1.0.0

type Setter interface {
	Set(string, string)
}

Jump to

Keyboard shortcuts

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