applicationoffers

package
v0.0.0-...-8cbe82e Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: AGPL-3.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetApplicationOffers = func(backend interface{}) crossmodel.ApplicationOffers {
	switch st := backend.(type) {
	case *state.State:
		return state.NewApplicationOffers(st)
	case *stateShim:
		return state.NewApplicationOffers(st.st)
	}
	return nil
}
View Source
var GetStateAccess = func(st *state.State) Backend {
	return &stateShim{
		st:      st,
		Backend: commoncrossmodel.GetBackend(st),
	}
}
View Source
var GetStatePool = func(sp *state.StatePool) StatePool {
	return &statePoolShim{sp}

}

Functions

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type AccessService

type AccessService interface {
	// ReadUserAccessLevelForTarget returns the subject's (user) access level
	// for the given user on the given target.
	// If the access level of a user cannot be found then
	// [accesserrors.AccessNotFound] is returned.
	ReadUserAccessLevelForTarget(ctx context.Context, subject user.Name, target corepermission.ID) (corepermission.Access, error)
	// ReadAllUserAccessForTarget return a slice of user access for all users
	// with access to the given target.
	// If not user access can be found on the target it will return
	// [accesserrors.PermissionNotFound].
	ReadAllUserAccessForTarget(ctx context.Context, target corepermission.ID) ([]corepermission.UserAccess, error)
	// CreatePermission gives the user access per the provided spec.
	// If the user provided does not exist or is marked removed,
	// [accesserrors.PermissionNotFound] is returned.
	// If the user provided exists but is marked disabled,
	// [accesserrors.UserAuthenticationDisabled] is returned.
	// If a permission for the user and target key already exists,
	// [accesserrors.PermissionAlreadyExists] is returned.
	CreatePermission(ctx context.Context, spec corepermission.UserAccessSpec) (corepermission.UserAccess, error)
	// UpdatePermission updates the permission on the target for the given subject
	// (user). If the subject is an external user, and they do not exist, they are
	// created. Access can be granted or revoked. Revoking Read access will delete
	// the permission.
	UpdatePermission(ctx context.Context, args access.UpdatePermissionArgs) error
	// DeletePermission removes the given user's access to the given target.
	// A NotValid error is returned if the subject (user) string is empty, or
	// the target is not valid.
	DeletePermission(ctx context.Context, subject user.Name, target corepermission.ID) error
	// GetUserByName will retrieve the user specified by name from the database.
	// If the user does not exist an error that satisfies
	// accesserrors.UserNotFound will be returned.
	GetUserByName(ctx context.Context, name user.Name) (user.User, error)
}

AccessService provides information about users and permissions.

type ApplicationService

type ApplicationService interface {
	// GetCharmLocatorByApplicationName returns a CharmLocator by application name.
	// It returns an error if the charm can not be found by the name. This can also
	// be used as a cheap way to see if a charm exists without needing to load the
	// charm metadata.
	GetCharmLocatorByApplicationName(ctx context.Context, name string) (applicationcharm.CharmLocator, error)

	// GetCharmMetadataDescription returns the description for the charm using the
	// charm name, source and revision.
	GetCharmMetadataDescription(ctx context.Context, locator applicationcharm.CharmLocator) (string, error)
}

type Backend

type Backend interface {
	commoncrossmodel.Backend
	ApplicationOffer(name string) (*crossmodel.ApplicationOffer, error)
	Model() (Model, error)
	OfferConnections(string) ([]OfferConnection, error)
}

Backend provides selected methods off the state.State struct.

type BaseAPI

type BaseAPI struct {
	Authorizer           facade.Authorizer
	GetApplicationOffers func(interface{}) jujucrossmodel.ApplicationOffers
	ControllerModel      Backend
	StatePool            StatePool
	// contains filtered or unexported fields
}

BaseAPI provides various boilerplate methods used by the facade business logic.

type Model

type Model interface {
	UUID() string
	ModelTag() names.ModelTag
	Name() string
	Type() state.ModelType
	Owner() names.UserTag
}

type ModelDomainServices

type ModelDomainServices interface {
	Application() ApplicationService
}

ModelDomainServices is an interface that provides a way to get model scoped services.

type ModelDomainServicesGetter

type ModelDomainServicesGetter interface {
	DomainServicesForModel(ctx context.Context, modelUUID model.UUID) (ModelDomainServices, error)
}

ModelDomainServicesGetter is an interface that provides a way to get a ModelDomainServices based on a model UUID.

type OfferConnection

type OfferConnection interface {
	SourceModelUUID() string
	UserName() string
	RelationKey() string
	RelationId() int
}

type OffersAPIv5

type OffersAPIv5 struct {
	BaseAPI
	// contains filtered or unexported fields
}

OffersAPIv5 implements the cross model interface and is the concrete implementation of the api end point.

func (*OffersAPIv5) ApplicationOffers

func (api *OffersAPIv5) ApplicationOffers(ctx context.Context, urls params.OfferURLs) (params.ApplicationOffersResults, error)

ApplicationOffers gets details about remote applications that match given URLs.

func (*OffersAPIv5) DestroyOffers

DestroyOffers removes the offers specified by the given URLs, forcing if necessary.

func (*OffersAPIv5) FindApplicationOffers

func (api *OffersAPIv5) FindApplicationOffers(ctx context.Context, filters params.OfferFilters) (params.QueryApplicationOffersResultsV5, error)

FindApplicationOffers gets details about remote applications that match given filter.

func (*OffersAPIv5) GetConsumeDetails

GetConsumeDetails returns the details necessary to pass to another model to allow the specified args user to consume the offers represented by the args URLs.

func (*OffersAPIv5) ListApplicationOffers

func (api *OffersAPIv5) ListApplicationOffers(ctx context.Context, filters params.OfferFilters) (params.QueryApplicationOffersResultsV5, error)

ListApplicationOffers gets deployed details about application offers that match given filter. The results contain details about the deployed applications such as connection count.

func (*OffersAPIv5) ModifyOfferAccess

func (api *OffersAPIv5) ModifyOfferAccess(ctx context.Context, args params.ModifyOfferAccessRequest) (result params.ErrorResults, _ error)

ModifyOfferAccess changes the application offer access granted to users.

func (*OffersAPIv5) Offer

Offer makes application endpoints available for consumption at a specified URL.

func (*OffersAPIv5) RemoteApplicationInfo

func (api *OffersAPIv5) RemoteApplicationInfo(ctx context.Context, args params.OfferURLs) (params.RemoteApplicationInfoResults, error)

RemoteApplicationInfo returns information about the requested remote application. This call currently has no client side API, only there for the Dashboard at this stage.

type StatePool

type StatePool interface {
	// Get returns a State for a given model from the pool.
	Get(modelUUID string) (Backend, func(), error)

	// Get returns a Model from the pool.
	GetModel(modelUUID string) (Model, func(), error)
}

StatePool provides the subset of a state pool.

Jump to

Keyboard shortcuts

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