cloud

package
v0.0.0-...-2f78cd6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: AGPL-3.0 Imports: 26 Imported by: 1

Documentation

Overview

Package cloud defines an API endpoint for functions dealing with the controller's cloud definition, and cloud credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeCloudAccess

func ChangeCloudAccess(backend Backend, cloud string, targetUserTag names.UserTag, action params.CloudAction, access permission.Access) error

ChangeCloudAccess performs the requested access grant or revoke action for the specified user on the cloud.

func Register

func Register(registry facade.FacadeRegistry)

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

Types

type Backend

type Backend interface {
	state.CloudAccessor

	ControllerTag() names.ControllerTag
	Model() (Model, error)
	ModelConfig() (*config.Config, error)
	User(tag names.UserTag) (User, error)

	CloudCredentials(user names.UserTag, cloudName string) (map[string]state.Credential, error)
	UpdateCloudCredential(names.CloudCredentialTag, cloud.Credential) error
	RemoveCloudCredential(names.CloudCredentialTag) error
	AddCloud(cloud.Cloud, string) error
	UpdateCloud(cloud.Cloud) error
	RemoveCloud(string) error
	AllCloudCredentials(user names.UserTag) ([]state.Credential, error)
	CredentialModelsAndOwnerAccess(tag names.CloudCredentialTag) ([]state.CredentialOwnerModelAccess, error)
	CredentialModels(tag names.CloudCredentialTag) (map[string]string, error)
	RemoveModelsCredential(tag names.CloudCredentialTag) error

	ControllerConfig() (controller.Config, error)
	ControllerInfo() (*state.ControllerInfo, error)
	GetCloudAccess(cloud string, user names.UserTag) (permission.Access, error)
	GetCloudUsers(cloud string) (map[string]permission.Access, error)
	CreateCloudAccess(cloud string, user names.UserTag, access permission.Access) error
	UpdateCloudAccess(cloud string, user names.UserTag, access permission.Access) error
	RemoveCloudAccess(cloud string, user names.UserTag) error
	CloudsForUser(user names.UserTag, isSuperuser bool) ([]state.CloudInfo, error)
}

func NewStateBackend

func NewStateBackend(st *state.State) Backend

type CloudAPI

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

CloudAPI implements the cloud interface and is the concrete implementation of the api end point.

func NewCloudAPI

func NewCloudAPI(backend, ctlrBackend Backend, pool ModelPoolBackend, authorizer facade.Authorizer) (*CloudAPI, error)

NewCloudAPI creates a new API server endpoint for managing the controller's cloud definition and cloud credentials.

func (*CloudAPI) AddCloud

func (api *CloudAPI) AddCloud(cloudArgs params.AddCloudArgs) error

AddCloud adds a new cloud, different from the one managed by the controller.

func (*CloudAPI) AddCredentials

func (api *CloudAPI) AddCredentials(args params.TaggedCredentials) (params.ErrorResults, error)

AddCredentials adds new credentials. In contrast to UpdateCredentials() below, the new credentials can be for a cloud that the controller does not manage (this is required for CAAS models)

func (*CloudAPI) CheckCredentialsModels

func (api *CloudAPI) CheckCredentialsModels(args params.TaggedCredentials) (params.UpdateCredentialResults, error)

CheckCredentialsModels validates supplied cloud credentials' content against models that currently use these credentials. If there are any models that are using a credential and these models or their cloud instances are not going to be accessible with corresponding credential, there will be detailed validation errors per model. There's no Juju API client which uses this, but JAAS does,

func (*CloudAPI) Cloud

func (api *CloudAPI) Cloud(args params.Entities) (params.CloudResults, error)

Cloud returns the cloud definitions for the specified clouds.

func (*CloudAPI) CloudInfo

func (api *CloudAPI) CloudInfo(args params.Entities) (params.CloudInfoResults, error)

CloudInfo returns information about the specified clouds.

func (*CloudAPI) Clouds

func (api *CloudAPI) Clouds() (params.CloudsResult, error)

Clouds returns the definitions of all clouds supported by the controller that the logged in user can see.

func (*CloudAPI) Credential

func (api *CloudAPI) Credential(args params.Entities) (params.CloudCredentialResults, error)

Credential returns the specified cloud credential for each tag, minus secrets.

func (*CloudAPI) CredentialContents

func (api *CloudAPI) CredentialContents(args params.CloudCredentialArgs) (params.CredentialContentResults, error)

CredentialContents returns the specified cloud credentials, including the secrets if requested. If no specific credential name/cloud was passed in, all credentials for this user are returned. Only credential owner can see its contents as well as what models use it. Controller admin has no special superpowers here and is treated the same as all other users.

func (*CloudAPI) InstanceTypes

InstanceTypes returns instance type information for the cloud and region in which the current model is deployed.

func (*CloudAPI) ListCloudInfo

ListCloudInfo returns clouds that the specified user has access to. Controller admins (superuser) can list clouds for any user. Other users can only ask about their own clouds.

func (*CloudAPI) ModifyCloudAccess

func (c *CloudAPI) ModifyCloudAccess(args params.ModifyCloudAccessRequest) (params.ErrorResults, error)

ModifyCloudAccess changes the model access granted to users.

func (*CloudAPI) RemoveClouds

func (api *CloudAPI) RemoveClouds(args params.Entities) (params.ErrorResults, error)

RemoveClouds removes the specified clouds from the controller. If a cloud is in use (has models deployed to it), the removal will fail.

func (*CloudAPI) RevokeCredentialsCheckModels

func (api *CloudAPI) RevokeCredentialsCheckModels(args params.RevokeCredentialArgs) (params.ErrorResults, error)

RevokeCredentialsCheckModels revokes a set of cloud credentials. If the credentials are used by any of the models, the credential deletion will be aborted. If credential-in-use needs to be revoked nonetheless, this method allows the use of force.

func (*CloudAPI) UpdateCloud

func (api *CloudAPI) UpdateCloud(cloudArgs params.UpdateCloudArgs) (params.ErrorResults, error)

UpdateCloud updates an existing cloud that the controller knows about.

func (*CloudAPI) UpdateCredentialsCheckModels

func (api *CloudAPI) UpdateCredentialsCheckModels(args params.UpdateCredentialArgs) (params.UpdateCredentialResults, error)

UpdateCredentialsCheckModels updates a set of cloud credentials' content. If there are any models that are using a credential and these models are not going to be visible with updated credential content, there will be detailed validation errors per model. Such model errors are returned separately and do not contribute to the overall method error status. Controller admins can 'force' an update of the credential regardless of whether it is deemed valid or not.

func (*CloudAPI) UserCredentials

func (api *CloudAPI) UserCredentials(args params.UserClouds) (params.StringsResults, error)

UserCredentials returns the cloud credentials for a set of users.

type CloudV7

type CloudV7 interface {
	AddCloud(cloudArgs params.AddCloudArgs) error
	AddCredentials(args params.TaggedCredentials) (params.ErrorResults, error)
	CheckCredentialsModels(args params.TaggedCredentials) (params.UpdateCredentialResults, error)
	Cloud(args params.Entities) (params.CloudResults, error)
	Clouds() (params.CloudsResult, error)
	Credential(args params.Entities) (params.CloudCredentialResults, error)
	CredentialContents(credentialArgs params.CloudCredentialArgs) (params.CredentialContentResults, error)
	ModifyCloudAccess(args params.ModifyCloudAccessRequest) (params.ErrorResults, error)
	RevokeCredentialsCheckModels(args params.RevokeCredentialArgs) (params.ErrorResults, error)
	UpdateCredentialsCheckModels(args params.UpdateCredentialArgs) (params.UpdateCredentialResults, error)
	UserCredentials(args params.UserClouds) (params.StringsResults, error)
	UpdateCloud(cloudArgs params.UpdateCloudArgs) (params.ErrorResults, error)
}

CloudV7 defines the methods on the cloud API facade, version 7.

type Model

type Model interface {
	UUID() string
	CloudName() string
	Cloud() (cloud.Cloud, error)
	CloudCredential() (state.Credential, bool, error)
	CloudRegion() string
}

type ModelPoolBackend

type ModelPoolBackend interface {
	// GetModelCallContext gets everything that is needed to make cloud calls on behalf of the given model.
	GetModelCallContext(modelUUID string) (credentialcommon.PersistentBackend, context.ProviderCallContext, error)

	// SystemState allows access to an underlying controller state.
	SystemState() (*state.State, error)
}

ModelPoolBackend defines a pool of models.

func NewModelPoolBackend

func NewModelPoolBackend(st *state.StatePool) ModelPoolBackend

NewModelPoolBackend creates a model pool backend based on state.StatePool.

type User

type User interface {
	DisplayName() string
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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