connector

package
v0.0.0-...-aeec03c Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: AGPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyControllerName = errors.New("empty controller name")

Functions

This section is empty.

Types

type ClientStoreConfig

type ClientStoreConfig struct {
	// Controller to connect to.  Required
	ControllerName string

	// Model to connect to.  Optional
	ModelUUID string

	// Defaults to the file client store
	ClientStore jujuclient.ClientStore

	// Defaults to the user for the controller
	AccountDetails *jujuclient.AccountDetails
}

ClientStoreConfig provides configuration for a Connector.

type ClientStoreConnector

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

A Connector can provie api.Connection instances based on a ClientStore

func NewClientStore

func NewClientStore(config ClientStoreConfig, dialOptions ...api.DialOption) (*ClientStoreConnector, error)

NewClientStore returns a new *ClientStoreConnector instance for the given config, or an error if there was a problem setting up the connector.

func (*ClientStoreConnector) Connect

func (c *ClientStoreConnector) Connect(dialOptions ...api.DialOption) (api.Connection, error)

Connect returns an api.Connection to the controller / model specified in c's config, or an error if there was a problem opening the connection.

type Connector

type Connector interface {
	Connect(...api.DialOption) (api.Connection, error)
}

A Connector is able to provide a Connection. This connection can be used to make API calls via the various packages in github.com/juju/juju/api.

type SimpleConfig

type SimpleConfig struct {

	// Addresses of controllers (at least one required, more than one for HA).
	ControllerAddresses []string

	// I don't know if that's required
	CACert string

	// UUID of model to connect to (optional)
	ModelUUID string

	// Either Username/Password or Macaroons is required to get authentication.
	Username  string
	Password  string
	Macaroons []macaroon.Slice

	// ClientID holds the client id part of client credentials used for authentication.
	ClientID string
	// ClientSecret holds the client secret part of client
	// credentials used for authentication.
	ClientSecret string
}

SimpleConfig aims to provide the same API surface as pilot juju for obtaining an api connection.

type SimpleConnector

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

A SimpleConnector can provide connections from a simple set of options.

func NewSimple

func NewSimple(opts SimpleConfig, dialOptions ...api.DialOption) (*SimpleConnector, error)

NewSimple returns an instance of *SimpleConnector configured to connect according to the specified options. If some options are invalid an error is returned.

func (*SimpleConnector) Connect

func (c *SimpleConnector) Connect(dialOptions ...api.DialOption) (api.Connection, error)

Connect returns a Connection according to c's configuration.

Jump to

Keyboard shortcuts

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