Documentation ¶
Overview ¶
Package juju is a facade to make interacting with Juju clients simpler. It also acts as an insulating layer protecting the provider package from upstream changes. The long-term intention is for this package to be removed. Eventually, it would be nice for this package to be replaced with more granular clients in Juju itself. Note that much of this code is duplicated from Juju CLI commands.
In comments and in code we refer to integrations which are known in juju 2.x as relations. calls to the upstream juju client currently reference relations
Index ¶
- Constants
- Variables
- func ConfigEntryToString(input interface{}) string
- func EqualConfigEntries(a interface{}, b interface{}) bool
- func GetCloudCredentialTag(cloudName, currentUser, name string) (*names.CloudCredentialTag, error)
- func GetLocalControllerConfig() (map[string]string, error)
- func WaitForAppsAvailable(ctx context.Context, client *apiapplication.Client, appsName []string, ...) error
- type Application
- type ApplicationAPIClient
- type Client
- type ClientAPIClient
- type ConfigEntry
- type ConsumeRemoteOfferInput
- type ConsumeRemoteOfferResponse
- type ControllerConfiguration
- type CreateApplicationInput
- type CreateApplicationResponse
- type CreateCredentialInput
- type CreateCredentialResponse
- type CreateIntegrationResponse
- type CreateMachineInput
- type CreateMachineResponse
- type CreateModelInput
- type CreateModelResponse
- type CreateOfferInput
- type CreateOfferResponse
- type CreateSSHKeyInput
- type CreateUserInput
- type CreateUserResponse
- type DeleteSSHKeyInput
- type DestroyAccessModelInput
- type DestroyApplicationInput
- type DestroyCredentialInput
- type DestroyMachineInput
- type DestroyModelInput
- type DestroyOfferInput
- type DestroyUserInput
- type GrantModelInput
- type IntegrationInput
- type ModelConfigAPIClient
- type Offer
- type ReadApplicationInput
- type ReadApplicationResponse
- type ReadCredentialInput
- type ReadCredentialResponse
- type ReadIntegrationResponse
- type ReadMachineInput
- type ReadMachineResponse
- type ReadModelResponse
- type ReadModelUserResponse
- type ReadOfferInput
- type ReadOfferResponse
- type ReadSSHKeyInput
- type ReadSSHKeyOutput
- type ReadUserInput
- type ReadUserResponse
- type RemoveRemoteOfferInput
- type ResourceAPIClient
- type SharedClient
- type UpdateAccessModelInput
- type UpdateApplicationInput
- type UpdateCredentialInput
- type UpdateIntegrationInput
- type UpdateIntegrationResponse
- type UpdateModelInput
- type UpdateUserInput
Constants ¶
const ( PrefixCloud = "cloud-" PrefixModel = "model-" PrefixCharm = "charm-" PrefixUser = "user-" PrefixMachine = "machine-" UnspecifiedRevision = -1 )
const ( // IntegrationQueryTick defines the time to wait between ticks // when querying the API IntegrationApiTickWait = time.Second * 5 // IntegrationAppAvailableTimeout indicates the time to wait // for applications to be available before integrating them IntegrationAppAvailableTimeout = time.Second * 60 )
const ( // OfferAppAvailableTimeout is the time to wait for an app to be available // before creating an offer. OfferAppAvailableTimeout = time.Second * 60 // OfferApiTickWait is the time to wait between consecutive requests // to the API OfferApiTickWait = time.Second * 5 )
const LogJujuClient = "client"
module names for logging @module=juju.<subsystem> e.g.:
@module=juju.client
Variables ¶
var ApplicationNotFoundError = &applicationNotFoundError{}
var ModelNotFoundError = &modelNotFoundError{}
var NoIntegrationFoundError = &noIntegrationFoundError{}
Functions ¶
func ConfigEntryToString ¶ added in v0.5.0
func ConfigEntryToString(input interface{}) string
ConfigEntryToString returns the string representation based on the current value.
func EqualConfigEntries ¶ added in v0.5.0
func EqualConfigEntries(a interface{}, b interface{}) bool
EqualConfigEntries compare two juju configuration entries. If both entries share the same type, otherwise they are considered to be different.
func GetCloudCredentialTag ¶ added in v0.5.0
func GetLocalControllerConfig ¶ added in v0.4.0
GetLocalControllerConfig runs the locally installed juju command, if available, to get the current controller configuration.
func WaitForAppsAvailable ¶ added in v0.7.0
func WaitForAppsAvailable(ctx context.Context, client *apiapplication.Client, appsName []string, tickTime time.Duration) error
WaitForAppAvailable blocks the execution flow and waits until all the application names can be queried before the context is done. The tickTime param indicates the frequency used to query the API.
Types ¶
type Application ¶ added in v0.4.0
type ApplicationAPIClient ¶ added in v0.11.0
type ApplicationAPIClient interface { AddUnits(args apiapplication.AddUnitsParams) ([]string, error) ApplicationsInfo(applications []names.ApplicationTag) ([]params.ApplicationInfoResult, error) Deploy(args apiapplication.DeployArgs) error DestroyUnits(in apiapplication.DestroyUnitsParams) ([]params.DestroyUnitResult, error) DestroyApplications(in apiapplication.DestroyApplicationsParams) ([]params.DestroyApplicationResult, error) Expose(application string, exposedEndpoints map[string]params.ExposedEndpoint) error Get(branchName, application string) (*params.ApplicationGetResults, error) GetCharmURLOrigin(branchName, applicationName string) (*charm.URL, apicommoncharm.Origin, error) GetConstraints(applications ...string) ([]constraints.Value, error) MergeBindings(req params.ApplicationMergeBindingsArgs) error ScaleApplication(in apiapplication.ScaleApplicationParams) (params.ScaleApplicationResult, error) SetCharm(branchName string, cfg apiapplication.SetCharmConfig) error SetConfig(branchName, application, configYAML string, config map[string]string) error SetConstraints(application string, constraints constraints.Value) error Unexpose(application string, endpoints []string) error }
type Client ¶
type Client struct { Applications applicationsClient Machines machinesClient Credentials credentialsClient Integrations integrationsClient Models modelsClient Offers offersClient SSHKeys sshKeysClient Users usersClient }
type ClientAPIClient ¶ added in v0.11.0
type ClientAPIClient interface {
Status(args *apiclient.StatusArgs) (*params.FullStatus, error)
}
type ConfigEntry ¶ added in v0.5.0
type ConfigEntry struct { Value interface{} IsDefault bool }
ConfigEntry is an auxiliar struct to keep information about juju application config entries. Specially, we want to know if they have the default value.
func (*ConfigEntry) String ¶ added in v0.5.0
func (ce *ConfigEntry) String() string
type ConsumeRemoteOfferInput ¶ added in v0.4.0
type ConsumeRemoteOfferResponse ¶ added in v0.4.0
type ConsumeRemoteOfferResponse struct {
SAASName string
}
type ControllerConfiguration ¶ added in v0.9.0
type CreateApplicationInput ¶ added in v0.2.0
type CreateApplicationInput struct { ApplicationName string ModelName string CharmName string CharmChannel string CharmBase string CharmSeries string CharmRevision int Units int Trust bool Expose map[string]interface{} Config map[string]string Placement string Constraints constraints.Value EndpointBindings map[string]string Resources map[string]int }
type CreateApplicationResponse ¶ added in v0.2.0
type CreateApplicationResponse struct {
AppName string
}
type CreateCredentialInput ¶ added in v0.5.0
type CreateCredentialResponse ¶ added in v0.5.0
type CreateCredentialResponse struct { CloudCredential jujucloud.Credential CloudName string }
type CreateIntegrationResponse ¶ added in v0.4.0
type CreateIntegrationResponse struct {
Applications []Application
}
type CreateMachineInput ¶ added in v0.6.0
type CreateMachineInput struct { ModelName string Constraints string Disks string Base string Placement string Series string InstanceId string // SSHAddress is the host address of a machine for manual provisioning // Note that it has the user too, e.g. user@host SSHAddress string // PublicKey is the file path to read the public key from PublicKeyFile string // PrivateKey is the file path to read the private key from PrivateKeyFile string }
type CreateMachineResponse ¶ added in v0.6.0
type CreateModelInput ¶ added in v0.4.0
type CreateModelResponse ¶ added in v0.4.0
type CreateOfferInput ¶ added in v0.4.0
type CreateOfferResponse ¶ added in v0.4.0
type CreateSSHKeyInput ¶ added in v0.5.0
type CreateUserInput ¶ added in v0.5.0
type CreateUserResponse ¶ added in v0.5.0
type CreateUserResponse struct { UserTag names.UserTag Secret []byte }
type DeleteSSHKeyInput ¶ added in v0.5.0
type DestroyAccessModelInput ¶ added in v0.5.0
type DestroyApplicationInput ¶ added in v0.2.0
type DestroyCredentialInput ¶ added in v0.5.0
type DestroyMachineInput ¶ added in v0.6.0
type DestroyModelInput ¶ added in v0.4.0
type DestroyModelInput struct {
UUID string
}
type DestroyOfferInput ¶ added in v0.4.0
type DestroyOfferInput struct {
OfferURL string
}
type DestroyUserInput ¶ added in v0.5.0
type DestroyUserInput struct {
Name string
}
type GrantModelInput ¶ added in v0.5.0
type IntegrationInput ¶ added in v0.3.0
type ModelConfigAPIClient ¶ added in v0.11.0
type ReadApplicationInput ¶ added in v0.2.0
type ReadApplicationResponse ¶ added in v0.2.0
type ReadApplicationResponse struct { Name string Channel string Revision int Base string Series string Units int Trust bool Config map[string]ConfigEntry Constraints constraints.Value Expose map[string]interface{} Principal bool Placement string EndpointBindings map[string]string Resources map[string]int }
type ReadCredentialInput ¶ added in v0.5.0
type ReadCredentialResponse ¶ added in v0.5.0
type ReadCredentialResponse struct {
CloudCredential jujucloud.Credential
}
type ReadIntegrationResponse ¶ added in v0.4.0
type ReadIntegrationResponse struct {
Applications []Application
}
type ReadMachineInput ¶ added in v0.6.0
type ReadMachineResponse ¶ added in v0.6.0
type ReadModelResponse ¶ added in v0.4.0
type ReadModelResponse struct { ModelInfo params.ModelInfo ModelConfig map[string]interface{} ModelConstraints constraints.Value }
type ReadModelUserResponse ¶ added in v0.5.0
type ReadModelUserResponse struct {
ModelUserInfo []params.ModelUserInfo
}
type ReadOfferInput ¶ added in v0.4.0
type ReadOfferInput struct {
OfferURL string
}
type ReadOfferResponse ¶ added in v0.4.0
type ReadSSHKeyInput ¶ added in v0.5.0
type ReadSSHKeyOutput ¶ added in v0.5.0
type ReadUserInput ¶ added in v0.5.0
type ReadUserInput struct {
Name string
}
type ReadUserResponse ¶ added in v0.5.0
type RemoveRemoteOfferInput ¶ added in v0.4.0
type ResourceAPIClient ¶ added in v0.11.0
type ResourceAPIClient interface { AddPendingResources(args apiresources.AddPendingResourcesArgs) ([]string, error) ListResources(applications []string) ([]resources.ApplicationResources, error) }
type SharedClient ¶ added in v0.9.0
type SharedClient interface {}
type UpdateAccessModelInput ¶ added in v0.5.0
type UpdateApplicationInput ¶ added in v0.2.0
type UpdateApplicationInput struct { ModelName string ModelInfo *params.ModelInfo AppName string Units *int Revision *int Channel string Trust *bool Expose map[string]interface{} // Unexpose indicates what endpoints to unexpose Unexpose []string Config map[string]string //Series string // Unsupported today Placement map[string]interface{} Constraints *constraints.Value EndpointBindings map[string]string Resources map[string]int }
type UpdateCredentialInput ¶ added in v0.5.0
type UpdateIntegrationInput ¶ added in v0.3.0
type UpdateIntegrationResponse ¶ added in v0.4.0
type UpdateIntegrationResponse struct {
Applications []Application
}