remoterelations

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	*common.ControllerConfigAPI
	// contains filtered or unexported fields
}

API provides access to the remote relations API facade.

func NewAPI

func NewAPI(ctx facade.Context) (*API, error)

NewAPI creates a new server-side API facade backed by global state.

func NewRemoteRelationsAPI

func NewRemoteRelationsAPI(
	st RemoteRelationsState,
	controllerCfgAPI *common.ControllerConfigAPI,
	resources facade.Resources,
	authorizer facade.Authorizer,
) (*API, error)

NewRemoteRelationsAPI returns a new server-side API facade.

func (*API) ConsumeRemoteRelationChanges

func (api *API) ConsumeRemoteRelationChanges(changes params.RemoteRelationsChanges) (params.ErrorResults, error)

ConsumeRemoteRelationChanges consumes changes to settings originating from the remote/offering side of relations.

func (*API) ExportEntities

func (api *API) ExportEntities(entities params.Entities) (params.TokenResults, error)

ExportEntities allocates unique, remote entity IDs for the given entities in the local model.

func (*API) GetTokens

func (api *API) GetTokens(args params.GetTokenArgs) (params.StringResults, error)

GetTokens returns the token associated with the entities with the given tags for the given models.

func (*API) ImportRemoteEntities

func (api *API) ImportRemoteEntities(args params.RemoteEntityTokenArgs) (params.ErrorResults, error)

ImportRemoteEntities adds entities to the remote entities collection with the specified opaque tokens.

func (*API) Relations

func (api *API) Relations(entities params.Entities) (params.RemoteRelationResults, error)

Relations returns information about the cross-model relations with the specified keys in the local model.

func (*API) RemoteApplications

func (api *API) RemoteApplications(entities params.Entities) (params.RemoteApplicationResults, error)

RemoteApplications returns the current state of the remote applications with the specified names in the local model.

func (*API) SaveMacaroons

func (api *API) SaveMacaroons(args params.EntityMacaroonArgs) (params.ErrorResults, error)

SaveMacaroons saves the macaroons for the given entities.

func (*API) SetRemoteApplicationsStatus

func (api *API) SetRemoteApplicationsStatus(args params.SetStatus) (params.ErrorResults, error)

SetRemoteApplicationsStatus sets the status for the specified remote applications.

func (*API) UpdateControllersForModels

func (api *API) UpdateControllersForModels(args params.UpdateControllersForModelsParams) (params.ErrorResults, error)

UpdateControllersForModels changes the external controller records for the associated model entities. This is used when the remote relations worker gets redirected following migration of an offering model.

func (*API) WatchLocalRelationChanges

func (api *API) WatchLocalRelationChanges(args params.Entities) (params.RemoteRelationWatchResults, error)

WatchLocalRelationChanges starts a RemoteRelationWatcher for each specified relation, returning the watcher IDs and initial values, or an error if the remote relations couldn't be watched.

func (*API) WatchRemoteApplicationRelations

func (api *API) WatchRemoteApplicationRelations(args params.Entities) (params.StringsWatchResults, error)

WatchRemoteApplicationRelations starts a StringsWatcher for watching the relations of each specified application in the local model, and returns the watcher IDs and initial values, or an error if the services' relations could not be watched.

func (*API) WatchRemoteApplications

func (api *API) WatchRemoteApplications() (params.StringsWatchResult, error)

WatchRemoteApplications starts a strings watcher that notifies of the addition, removal, and lifecycle changes of remote applications in the model; and returns the watcher ID and initial IDs of remote applications, or an error if watching failed.

func (*API) WatchRemoteRelations

func (api *API) WatchRemoteRelations() (params.StringsWatchResult, error)

WatchRemoteRelations starts a strings watcher that notifies of the addition, removal, and lifecycle changes of remote relations in the model; and returns the watcher ID and initial IDs of remote relations, or an error if watching failed.

type APIv1

type APIv1 struct {
	*API
}

API provides access to version 1 of the remote relations API facade.

func NewAPIv1

func NewAPIv1(ctx facade.Context) (*APIv1, error)

NewAPI creates a new server-side API facade backed by global state.

func (*APIv1) RelationUnitSettings

func (api *APIv1) RelationUnitSettings(relationUnits params.RelationUnits) (params.SettingsResults, error)

RelationUnitSettings returns the relation unit settings for the given relation units in the local model. (Removed in v2 of the API - the settings are included in the events from WatchLocalRelationChanges.)

func (*APIv1) UpdateControllersForModels

func (u *APIv1) UpdateControllersForModels(_, _ struct{})

UpdateControllersForModels is not available via the V1 API.

func (*APIv1) WatchLocalRelationChanges

func (api *APIv1) WatchLocalRelationChanges(_, _ struct{})

Mask out new methods from the old API versions. The API reflection code in rpc/rpcreflect/type.go:newMethod skips 2-argument methods, so this removes the method as far as the RPC machinery is concerned.

WatchLocalRelationChanges doesn't exist before the v2 API.

func (*APIv1) WatchLocalRelationUnits

func (api *APIv1) WatchLocalRelationUnits(args params.Entities) (params.RelationUnitsWatchResults, error)

WatchLocalRelationUnits starts a RelationUnitsWatcher for watching the local relation units involved in each specified relation in the local model, and returns the watcher IDs and initial values, or an error if the relation units could not be watched. WatchLocalRelationUnits is only supported on the v1 API - later versions provide WatchLocalRelationChanges instead.

type RemoteRelationsState

type RemoteRelationsState interface {
	common.Backend

	// WatchRemoteApplications returns a StringsWatcher that notifies of changes to
	// the lifecycles of the remote applications in the model.
	WatchRemoteApplications() state.StringsWatcher

	// WatchRemoteApplicationRelations returns a StringsWatcher that notifies of
	// changes to the life-cycles of relations involving the specified remote
	// application.
	WatchRemoteApplicationRelations(applicationName string) (state.StringsWatcher, error)

	// WatchRemoteRelations returns a StringsWatcher that notifies of changes to
	// the lifecycles of remote relations in the model.
	WatchRemoteRelations() state.StringsWatcher

	// RemoveRemoteEntity removes the specified entity from the remote entities collection.
	RemoveRemoteEntity(entity names.Tag) error

	// SaveMacaroon saves the given macaroon for the specified entity.
	SaveMacaroon(entity names.Tag, mac *macaroon.Macaroon) error

	// UpdateControllerForModel ensures that there is an external controller
	// record for the input info, associated with the input model ID.
	UpdateControllerForModel(controller crossmodel.ControllerInfo, modelUUID string) error
}

RemoteRelationState provides the subset of global state required by the remote relations facade.

Jump to

Keyboard shortcuts

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