AddCharm adds the given charm URL (which must include revision) to
the model, if it does not exist yet. Local charms are not
supported, only charm store URLs. See also AddLocalCharm() in the
client-side API.

If the AddCharm API call fails because of an authorization error
when retrieving the charm from the charm store, an error
satisfying params.IsCodeUnauthorized will be returned.

AddCharmWithAuthorization is like AddCharm except it also provides
the given charmstore macaroon for the juju server to use when
obtaining the charm from the charm store. The macaroon is
conventionally obtained from the /delegatable-macaroon endpoint in
the charm store.

If the AddCharmWithAuthorization API call fails because of an
authorization error when retrieving the charm from the charm store,
an error satisfying params.IsCodeUnauthorized will be returned.

Close closes the Client's underlying State connection
Client is unique among the api.State facades in closing its own State
connection, but it is conventional to use a Client object without any access
to its underlying state connection.

type Connection interface {
// Close closes the connection.Close() error// Addr returns the address used to connect to the API server.Addr() string// IPAddr returns the IP address used to connect to the API server.IPAddr() string// APIHostPorts returns addresses that may be used to connect
// to the API server, including the address used to connect.
//
// The addresses are scoped (public, cloud-internal, etc.), so
// the client may choose which addresses to attempt. For the
// Juju CLI, all addresses must be attempted, as the CLI may
// be invoked both within and outside the model (think
// private clouds).APIHostPorts() [][]network.HostPort// Broken returns a channel which will be closed if the connection
// is detected to be broken, either because the underlying
// connection has closed or because API pings have failed.Broken() <-chan struct{}
// IsBroken returns whether the connection is broken. It checks
// the Broken channel and if that is open, attempts a connection
// ping.IsBroken() bool// PublicDNSName returns the host name for which an officially
// signed certificate will be used for TLS connection to the server.
// If empty, the private Juju CA certificate must be used to verify
// the connection.PublicDNSName() string// These are a bit off -- ServerVersion is apparently not known until after
// Login()? Maybe evidence of need for a separate AuthenticatedConnection..?Login(name names.Tag, password, nonce string, ms []macaroon.Slice) errorServerVersion() (version.Number, bool)
// APICaller provides the facility to make API calls directly.
// This should not be used outside the api/* packages or tests.base.APICaller// ControllerTag returns the tag of the controller.
// This could be defined on base.APICaller.ControllerTag() names.ControllerTag// Ping makes an API request which checks if the connection is
// still functioning.
// NOTE: This method is deprecated. Please use IsBroken or Broken instead.Ping() error// I think this is actually dead code. It's tested, at least, so I'm
// keeping it for now, but it's not apparently used anywhere else.AllFacadeVersions() map[string][]int// AuthTag returns the tag of the authorized user of the state API
// connection.AuthTag() names.Tag// ModelAccess returns the access level of authorized user to the model.ModelAccess() string// ControllerAccess returns the access level of authorized user to the controller.ControllerAccess() string// CookieURL returns the URL that HTTP cookies for the API will be
// associated with.CookieURL() *url.URL// These methods expose a bunch of worker-specific facades, and basically
// just should not exist; but removing them is too noisy for a single CL.
// Client in particular is intimately coupled with State -- and the others
// will be easy to remove, but until we're using them via manifolds it's
// prohibitively ugly to do so.Client() *ClientUniter() (*uniter.State, error)
Upgrader() *upgrader.StateReboot() (reboot.State, error)
InstancePoller() *instancepoller.APICharmRevisionUpdater() *charmrevisionupdater.StateCleaner() *cleaner.APIUnitAssigner() unitassigner.API
}

type DialOpts struct {
// DialAddressInterval is the amount of time to wait
// before starting to dial another address.DialAddressIntervaltime.Duration// DialTimeout is the amount of time to wait for the dial
// portion only of the api.Open to succeed. If this is zero,
// there is no dial timeout.DialTimeouttime.Duration// Timeout is the amount of time to wait for the entire
// api.Open to succeed. If this is zero, there is no timeout.Timeouttime.Duration// RetryDelay is the amount of time to wait between
// unsuccessful connection attempts. If this is
// zero, only one attempt will be made.RetryDelaytime.Duration// BakeryClient is the httpbakery Client, which
// is used to do the macaroon-based authorization.
// This and the *http.Client inside it are copied
// by Open, and any RoundTripper field
// the HTTP client is ignored.BakeryClient *httpbakery.Client// InsecureSkipVerify skips TLS certificate verification
// when connecting to the controller. This should only
// be used in tests, or when verification cannot be
// performed and the communication need not be secure.InsecureSkipVerifybool// DialWebsocket is used to make connections to API servers.
// It will be called with a websocket URL to connect to,
// and the TLS configuration to use to secure the connection.
// If ipAddr is non-empty, the actual net.Dial should use
// that IP address, regardless of the URL host.
//
// If DialWebsocket is nil, a default implementation using
// gorilla websockets will be used.DialWebsocket func(ctx context.Context, urlStr string, tlsConfig *tls.Config, ipAddr string) (jsoncodec.JSONConn, error)
// IPAddrResolver is used to resolve host names to IP addresses.
// If it is nil, net.DefaultResolver will be used.IPAddrResolverIPAddrResolver// DNSCache is consulted to find and store cached DNS lookups.
// If it is nil, no cache will be used or updated.DNSCacheDNSCache// Clock is used as a time source for retries.
// If it is nil, clock.WallClock will be used.Clockclock.Clock
}

DialOpts holds configuration parameters that control the
Dialing behavior when connecting to a controller.

type Info struct {
// Addrs holds the addresses of the controllers.Addrs []string// SNIHostName optionally holds the host name to use for
// server name indication (SNI) when connecting
// to the addresses in Addrs above. If CACert is non-empty,
// this field is ignored.SNIHostNamestring// CACert holds the CA certificate that will be used
// to validate the controller's certificate, in PEM format.
// If this is empty, the standard system root certificates
// will be used.CACertstring// ModelTag holds the model tag for the model we are
// trying to connect to. If this is empty, a controller-only
// login will be made.ModelTagnames.ModelTag// SkipLogin, if true, skips the Login call on connection. It is an
// error to set Tag, Password, or Macaroons if SkipLogin is true.SkipLoginbool `yaml:"-"`
// Tag holds the name of the entity that is connecting.
// If this is nil, and the password is empty, macaroon authentication
// will be used to log in unless SkipLogin is true.Tagnames.Tag// Password holds the password for the administrator or connecting entity.Passwordstring// Macaroons holds a slice of macaroon.Slice that may be used to
// authenticate with the API server.Macaroons []macaroon.Slice `yaml:",omitempty"`
// Nonce holds the nonce used when provisioning the machine. Used
// only by the machine agent.Noncestring `yaml:",omitempty"`
}

Info encapsulates information about a server holding juju state and
can be used to make a connection to it.