Documentation ¶
Index ¶
- Variables
- func BuiltInClouds() map[string]cloud.Cloud
- func CloudOrProvider(cloudName string, cloudByNameFunc func(string) (*cloud.Cloud, error)) (cloud *cloud.Cloud, err error)
- func ConformYAML(input interface{}) (interface{}, error)
- func FinalizeAuthorizedKeys(ctx *cmd.Context, attrs map[string]interface{}) error
- func FormatTime(t *time.Time, formatISO bool) string
- func GUIDataSourceBaseURL() string
- func LastConnection(connectionTime *time.Time, now time.Time, exact bool) string
- func ModelMachineInfoFromParams(machines []params.ModelMachineInfo) map[string]ModelMachineInfo
- func ModelUserInfoFromParams(users []params.ModelUserInfo, now time.Time) map[string]ModelUserInfo
- func OwnerQualifiedModelName(modelName string, owner, user names.UserTag) string
- func ParseConstraints(ctx *cmd.Context, cons string) (constraints.Value, error)
- func ReadAuthorizedKeys(ctx *cmd.Context, path string) (string, error)
- func ResolveCloudCredentialTag(user names.UserTag, cloud names.CloudTag, credentialName string) (names.CloudCredentialTag, error)
- func SetBootstrapEndpointAddress(store jujuclient.ControllerStore, controllerName string, ...) error
- func UserFriendlyDuration(when, now time.Time) string
- func WaitForAgentInitialisation(ctx *cmd.Context, c *modelcmd.ModelCommandBase, ...) error
- func WarnConstraintAliases(ctx *cmd.Context, aliases map[string]string)
- type ConfigFlag
- type ModelInfo
- type ModelMachineInfo
- type ModelStatus
- type ModelUserInfo
Constants ¶
This section is empty.
Variables ¶
var ErrNoAuthorizedKeys = errors.New("no public ssh keys found")
Functions ¶
func BuiltInClouds ¶
BuiltInClouds returns cloud information for those providers which are built in to Juju.
func CloudOrProvider ¶
func CloudOrProvider(cloudName string, cloudByNameFunc func(string) (*cloud.Cloud, error)) (cloud *cloud.Cloud, err error)
CloudOrProvider finds and returns cloud or provider.
func ConformYAML ¶
func ConformYAML(input interface{}) (interface{}, error)
ConformYAML ensures all keys of any nested maps are strings. This is necessary because YAML unmarshals map[interface{}]interface{} in nested maps, which cannot be serialized by bson. Also, handle []interface{}. cf. gopkg.in/juju/charm.v4/actions.go cleanse
func FinalizeAuthorizedKeys ¶
FinalizeAuthorizedKeys takes a set of configuration attributes and ensures that it has an authorized-keys setting, or returns ErrNoAuthorizedKeys if it cannot.
If the attributes contains a non-empty value for "authorized-keys", then it is left alone. If there is an "authorized-keys-path" setting, its contents will be loaded into "authorized-keys". Otherwise, the contents of standard public keys will be used: ~/.ssh/id_dsa.pub, ~/.ssh/id_rsa.pub, and ~/.ssh/identity.pub.
func FormatTime ¶
FormatTime returns a string with the local time formatted in an arbitrary format used for status or and localized tz or in UTC timezone and format RFC3339 if u is specified.
func GUIDataSourceBaseURL ¶
func GUIDataSourceBaseURL() string
GUIDataSourceBaseURL returns the default base URL to use for the Juju GUI simplestreams data source. The default value can be overridden by setting the JUJU_GUI_SIMPLESTREAMS_URL environment variable.
func LastConnection ¶
LastConnection turns the *time.Time returned from the API server into a user facing string with either exact time or a user friendly string based on the args.
func ModelMachineInfoFromParams ¶
func ModelMachineInfoFromParams(machines []params.ModelMachineInfo) map[string]ModelMachineInfo
ModelMachineInfoFromParams translates []params.ModelMachineInfo to a map of machine ids to ModelMachineInfo.
func ModelUserInfoFromParams ¶
func ModelUserInfoFromParams(users []params.ModelUserInfo, now time.Time) map[string]ModelUserInfo
ModelUserInfoFromParams translates []params.ModelUserInfo to a map of user names to ModelUserInfo.
func OwnerQualifiedModelName ¶
OwnerQualifiedModelName returns the model name qualified with the model owner if the owner is not the same as the given canonical user name. If the owner is a local user, we omit the domain.
func ParseConstraints ¶
ParseConstraints parses the given constraints and uses WarnConstraintAliases if any aliases were used.
func ReadAuthorizedKeys ¶
ReadAuthorizedKeys implements the standard juju behaviour for finding authorized_keys. It returns a set of keys in in authorized_keys format (see sshd(8) for a description). If path is non-empty, it names the file to use; otherwise the user's .ssh directory will be searched. Home directory expansion will be performed on the path if it starts with a ~; if the expanded path is relative, it will be interpreted relative to $HOME/.ssh.
The result of utils/ssh.PublicKeyFiles will always be prepended to the result. In practice, this means ReadAuthorizedKeys never returns an error when the call originates in the CLI.
If no SSH keys are found, ReadAuthorizedKeys returns ErrNoAuthorizedKeys.
func ResolveCloudCredentialTag ¶
func ResolveCloudCredentialTag(user names.UserTag, cloud names.CloudTag, credentialName string) (names.CloudCredentialTag, error)
ResolveCloudCredentialTag takes a string which is of either the format "<credential>" or "<user>/<credential>". If the string does not include a user, then the supplied user tag is implied.
func SetBootstrapEndpointAddress ¶
func SetBootstrapEndpointAddress( store jujuclient.ControllerStore, controllerName string, agentVersion version.Number, apiPort int, environ environs.Environ, ) error
SetBootstrapEndpointAddress writes the API endpoint address of the bootstrap server, plus the agent version, into the connection information. This should only be run once directly after Bootstrap. It assumes that there is just one instance in the environment - the bootstrap instance.
func UserFriendlyDuration ¶
UserFriendlyDuration translates a time in the past into a user friendly string representation relative to the "now" time argument.
func WaitForAgentInitialisation ¶
func WaitForAgentInitialisation(ctx *cmd.Context, c *modelcmd.ModelCommandBase, controllerName, hostedModelName string) error
WaitForAgentInitialisation polls the bootstrapped controller with a read-only command which will fail until the controller is fully initialised. TODO(wallyworld) - add a bespoke command to maybe the admin facade for this purpose.
Types ¶
type ConfigFlag ¶
type ConfigFlag struct {
// contains filtered or unexported fields
}
ConfigFlag records k=v attributes from command arguments and/or specified files containing key values.
func (*ConfigFlag) ReadAttrs ¶
func (f *ConfigFlag) ReadAttrs(ctx *cmd.Context) (map[string]interface{}, error)
ReadAttrs reads attributes from the specified files, and then overlays the results with the k=v attributes.
func (*ConfigFlag) String ¶
func (f *ConfigFlag) String() string
String implements gnuflag.Value.String.
type ModelInfo ¶
type ModelInfo struct { Name string `json:"name" yaml:"name"` UUID string `json:"model-uuid" yaml:"model-uuid"` ControllerUUID string `json:"controller-uuid" yaml:"controller-uuid"` ControllerName string `json:"controller-name" yaml:"controller-name"` Owner string `json:"owner" yaml:"owner"` Cloud string `json:"cloud" yaml:"cloud"` CloudRegion string `json:"region,omitempty" yaml:"region,omitempty"` ProviderType string `json:"type" yaml:"type"` Life string `json:"life" yaml:"life"` Status ModelStatus `json:"status" yaml:"status"` Users map[string]ModelUserInfo `json:"users" yaml:"users"` Machines map[string]ModelMachineInfo `json:"machines,omitempty" yaml:"machines,omitempty"` }
ModelInfo contains information about a model.
type ModelMachineInfo ¶
type ModelMachineInfo struct {
Cores uint64 `json:"cores" yaml:"cores"`
}
ModelMachineInfo contains information about a machine in a model. We currently only care about showing core count, but might in the future care about memory, disks, containers etc.
type ModelStatus ¶
type ModelStatus struct { Current status.Status `json:"current" yaml:"current"` Message string `json:"message,omitempty" yaml:"message,omitempty"` Since string `json:"since,omitempty" yaml:"since,omitempty"` }
ModelStatus contains the current status of a model.
type ModelUserInfo ¶
type ModelUserInfo struct { DisplayName string `yaml:"display-name,omitempty" json:"display-name,omitempty"` Access string `yaml:"access" json:"access"` LastConnection string `yaml:"last-connection" json:"last-connection"` }
ModelUserInfo defines the serialization behaviour of the model user information.