crossmodel

package
v0.0.0-...-afba3a4 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: AGPL-3.0 Imports: 12 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeURL

func MakeURL(user, model, application, controller string) string

MakeURL constructs an offer URL from the specified components.

Types

type AddApplicationOfferArgs

type AddApplicationOfferArgs struct {
	// OfferName is the name of the offer.
	OfferName string

	// Owner is the user name who owns the offer.
	Owner string

	// HasRead are the user names who can see the offer exists.
	HasRead []string

	// ApplicationName is the name of the application to which the offer pertains.
	ApplicationName string

	// ApplicationDescription is a description of the application's functionality,
	// typically copied from the charm metadata.
	ApplicationDescription string

	// Endpoints is the collection of endpoint names offered (internal->published).
	// The map allows for advertised endpoint names to be aliased.
	Endpoints map[string]string

	// Icon is an icon to display when browsing the ApplicationOffers, which by default
	// comes from the charm.
	Icon []byte
}

AddApplicationOfferArgs contains parameters used to create an application offer.

type ApplicationOffer

type ApplicationOffer struct {
	// OfferUUID is the UUID of the offer.
	OfferUUID string

	// OfferName is the name of the offer.
	OfferName string

	// ApplicationName is the name of the application to which the offer pertains.
	ApplicationName string

	// ApplicationDescription is a description of the application's functionality,
	// typically copied from the charm metadata.
	ApplicationDescription string

	// Endpoints is the collection of endpoint names offered (internal->published).
	// The map allows for advertised endpoint names to be aliased.
	Endpoints map[string]charm.Relation
}

ApplicationOffer holds the details of an application offered by this model.

func (*ApplicationOffer) String

func (s *ApplicationOffer) String() string

String returns the offered application name.

type ApplicationOfferDetails

type ApplicationOfferDetails struct {
	// OfferName is the name of the offer
	OfferName string

	// ApplicationName is the application name to which the offer pertains.
	ApplicationName string

	// ApplicationDescription is the application description.
	ApplicationDescription string

	// OfferURL is the URL where the offer can be located.
	OfferURL string

	// CharmURL is the URL of the charm for the remote application.
	CharmURL string

	// Endpoints are the charm endpoints supported by the application.
	// TODO(wallyworld) - do not use charm.Relation here
	Endpoints []charm.Relation

	// Connects are the connections to the offer.
	Connections []OfferConnection

	// Users are the users able to access the offer.
	Users []OfferUserDetails
}

ApplicationOfferDetails represents the details about an application offer. Depending on the access permission of the user making the API call, and whether the call is "find" or "list", not all fields will be populated.

type ApplicationOfferFilter

type ApplicationOfferFilter struct {
	// OwnerName is the owner of the model hosting the offer.
	OwnerName string

	// ModelName is the name of the model hosting the offer.
	ModelName string

	// OfferName is the name of the offer.
	OfferName string

	// ApplicationName is the name of the application to which the offer pertains.
	ApplicationName string

	// ApplicationDescription is a description of the application's functionality,
	// typically copied from the charm metadata.
	ApplicationDescription string

	// Endpoint contains an endpoint filter criteria.
	Endpoints []EndpointFilterTerm

	// AllowedConsumers are the users allowed to consume the offer.
	AllowedConsumers []string

	// ConnectedUsers are the users currently related to the offer.
	ConnectedUsers []string
}

ApplicationOfferFilter is used to query applications offered by this model.

type ApplicationOffers

type ApplicationOffers interface {

	// AddOffer adds a new application offer to the directory.
	AddOffer(offer AddApplicationOfferArgs) (*ApplicationOffer, error)

	// UpdateOffer replaces an existing offer at the same URL.
	UpdateOffer(offer AddApplicationOfferArgs) (*ApplicationOffer, error)

	// ApplicationOffer returns the named application offer.
	ApplicationOffer(offerName string) (*ApplicationOffer, error)

	// ApplicationOfferForUUID returns the application offer with the UUID.
	ApplicationOfferForUUID(offerUUID string) (*ApplicationOffer, error)

	// ListOffers returns the offers satisfying the specified filter.
	ListOffers(filter ...ApplicationOfferFilter) ([]ApplicationOffer, error)

	// Remove removes the application offer at the specified URL.
	Remove(offerName string, force bool) error

	// AllApplicationOffers returns all application offers in the model.
	AllApplicationOffers() (offers []*ApplicationOffer, _ error)
}

An ApplicationOffers instance holds application offers from a model.

type ConsumeApplicationArgs

type ConsumeApplicationArgs struct {
	// Offer is the offer to be consumed.
	Offer params.ApplicationOfferDetailsV5

	// Macaroon is used for authentication.
	Macaroon *macaroon.Macaroon

	// ControllerInfo contains connection details to the controller
	// hosting the offer.
	ControllerInfo *ControllerInfo

	// ApplicationAlias is the name of the alias to use for the application name.
	ApplicationAlias string
}

ConsumeApplicationArgs contains parameters used to consume an offer.

type ControllerInfo

type ControllerInfo struct {
	// ControllerTag holds tag for the controller.
	ControllerTag names.ControllerTag

	// Alias holds a (human friendly) alias for the controller.
	Alias string

	// Addrs holds the addresses and ports of the controller's API servers.
	Addrs []string

	// CACert holds the CA certificate that will be used to validate
	// the API server's certificate, in PEM format.
	CACert string

	// ModelUUIDs holds the UUIDs of the models hosted on this controller.
	ModelUUIDs []string
}

ControllerInfo holds the details required to connect to a controller.

func (*ControllerInfo) Validate

func (info *ControllerInfo) Validate() error

Validate returns an error if the ControllerInfo contains bad data.

type EndpointFilterTerm

type EndpointFilterTerm struct {
	// Name is an endpoint name.
	Name string

	// Interface is an endpoint interface.
	Interface string

	// Role is an endpoint role.
	Role charm.RelationRole
}

EndpointFilterTerm represents a remote endpoint filter.

type OfferConnection

type OfferConnection struct {
	// SourceModelUUID is the UUID of the model hosting the offer.
	SourceModelUUID string

	// Username is the name of the user consuming the offer.
	Username string

	// RelationId is the id of the relation for this connection.
	RelationId int

	// Endpoint is the endpoint being connected to.
	Endpoint string

	// Status is the status of the offer connection.
	Status relation.Status

	// Message is the status message of the offer connection.
	Message string

	// Since is when the status value was last changed.
	Since *time.Time

	// IngressSubnets is the list of subnets from which traffic will originate.
	IngressSubnets []string
}

OfferConnection holds details about a connection to an offer.

type OfferURL

type OfferURL struct {
	// Source represents where the offer is hosted.
	// If empty, the model is another model in the same controller.
	Source string // "<controller-name>" or "<jaas>" or ""

	// User is the user whose namespace in which the offer is made.
	// Where a model is specified, the user is the model owner.
	User string

	// ModelName is the name of the model providing the exported endpoints.
	// It is only used for local URLs or for specifying models in the same
	// controller.
	ModelName string

	// ApplicationName is the name of the application providing the exported endpoints.
	ApplicationName string
}

OfferURL represents the location of an offered application and its associated exported endpoints.

func ParseOfferURL

func ParseOfferURL(urlStr string) (*OfferURL, error)

ParseOfferURL parses the specified URL string into an OfferURL. The URL string is of one of the forms:

<model-name>.<application-name>
<model-name>.<application-name>:<relation-name>
<user>/<model-name>.<application-name>
<user>/<model-name>.<application-name>:<relation-name>
<controller>:<user>/<model-name>.<application-name>
<controller>:<user>/<model-name>.<application-name>:<relation-name>

func (*OfferURL) AsLocal

func (u *OfferURL) AsLocal() *OfferURL

AsLocal returns a copy of the URL with an empty (local) source.

func (*OfferURL) HasEndpoint

func (u *OfferURL) HasEndpoint() bool

HasEndpoint returns whether this offer URL includes an endpoint name in the application name.

func (*OfferURL) Path

func (u *OfferURL) Path() string

Path returns the path component of the URL.

func (*OfferURL) String

func (u *OfferURL) String() string

type OfferURLParts

type OfferURLParts OfferURL

OfferURLParts contains various attributes of a URL.

func ParseOfferURLParts

func ParseOfferURLParts(urlStr string) (*OfferURLParts, error)

ParseOfferURLParts parses a partial URL, filling out what parts are supplied. This method is used to generate a filter used to query matching offer URLs.

type OfferUserDetails

type OfferUserDetails struct {
	// UserName is the username of the user.
	UserName string

	// DisplayName is the display name of the user.
	DisplayName string

	// Access is the level of access to the offer.
	Access permission.Access
}

OfferUserDetails holds the details about a user's access to an offer.

type RemoteApplication

type RemoteApplication struct {
	ApplicationOffer

	// ConnectedUsers are the users that are consuming the application.
	ConnectedUsers []string
}

RemoteApplication represents a remote application.

Jump to

Keyboard shortcuts

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