cloud

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: 24 Imported by: 0

Documentation

Overview

Package cloud defines an API end point 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.

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, all 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 NewFacadeV7

func NewFacadeV7(context facade.Context) (*CloudAPI, error)

NewFacadeV7 is used for API registration.

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) DefaultCloud

func (*CloudAPI) DefaultCloud(_, _ struct{})

DefaultCloud is gone in V5.

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) RevokeCredentials

func (*CloudAPI) RevokeCredentials(_, _ struct{})

Mask out old methods from the new 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.

RevokeCredentials was dropped in V3, replaced with RevokeCredentialsCheckModel.

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) UpdateCredentials

func (*CloudAPI) UpdateCredentials(_, _ struct{})

Mask out old methods from the new 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. UpdateCredentials was dropped in V3, replaced with UpdateCredentialsCheckModels.

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 CloudAPIV1

type CloudAPIV1 struct {
	*CloudAPIV2
}

CloudAPIV1 provides a way to wrap the different calls between version 1 and version 2 of the cloud API.

func NewFacadeV1

func NewFacadeV1(context facade.Context) (*CloudAPIV1, error)

NewFacadeV1 is used for API registration.

type CloudAPIV2

type CloudAPIV2 struct {
	*CloudAPIV3
}

CloudAPIV2 provides a way to wrap the different calls between version 2 and version 3 of the cloud API.

func NewFacadeV2

func NewFacadeV2(context facade.Context) (*CloudAPIV2, error)

NewFacadeV2 is used for API registration.

func (*CloudAPIV2) CheckCredentialsModels

func (*CloudAPIV2) CheckCredentialsModels(_, _ struct{})

Mask out old methods from the new 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.

CheckCredentialsModels did not exist before V3.

func (*CloudAPIV2) RevokeCredentials

func (api *CloudAPIV2) RevokeCredentials(args params.Entities) (params.ErrorResults, error)

UpdateCredentials updates a set of cloud credentials' content.

func (*CloudAPIV2) RevokeCredentialsCheckModels

func (*CloudAPIV2) RevokeCredentialsCheckModels(_, _ struct{})

Mask out old methods from the new 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.

RevokeCredentialsCheckModels did not exist before V3.

func (*CloudAPIV2) UpdateCredentials

func (api *CloudAPIV2) UpdateCredentials(args params.TaggedCredentials) (params.ErrorResults, error)

UpdateCredentials updates a set of cloud credentials' content.

type CloudAPIV3

type CloudAPIV3 struct {
	*CloudAPIV4
}

CloudAPIV3 provides a way to wrap the different calls between version 3 and version 4 of the cloud API.

func NewFacadeV3

func NewFacadeV3(context facade.Context) (*CloudAPIV3, error)

NewFacadeV3 is used for API registration.

func (*CloudAPIV3) UpdateCloud

func (*CloudAPIV3) UpdateCloud(_, _ struct{})

Mask out new methods from the new older 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.

UpdateCloud did not exist before V4.

type CloudAPIV4

type CloudAPIV4 struct {
	*CloudAPIV5
}

CloudAPIV4 provides a way to wrap the different calls between version 4 and version 5 of the cloud API.

func NewFacadeV4

func NewFacadeV4(context facade.Context) (*CloudAPIV4, error)

NewFacadeV4 is used for API registration.

func (*CloudAPIV4) DefaultCloud

func (api *CloudAPIV4) DefaultCloud() (params.StringResult, error)

DefaultCloud returns the tag of the cloud that models will be created in by default.

type CloudAPIV5

type CloudAPIV5 struct {
	*CloudAPIV6
}

CloudAPIV5 provides a way to wrap the different calls between version 5 and version 6 of the cloud API.

func NewFacadeV5

func NewFacadeV5(context facade.Context) (*CloudAPIV5, error)

NewFacadeV5 is used for API registration.

func (*CloudAPIV5) CredentialContents

func (api *CloudAPIV5) 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.

type CloudAPIV6

type CloudAPIV6 struct {
	*CloudAPI
}

CloudAPIV6 provides a way to wrap the different calls between version 6 and version 7 of the cloud API.

func NewFacadeV6

func NewFacadeV6(context facade.Context) (*CloudAPIV6, error)

NewFacadeV6 is used for API registration.

func (*CloudAPIV6) UpdateCredentialsCheckModels

func (api *CloudAPIV6) 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. Controller admins can 'force' an update of the credential regardless of whether it is deemed valid or not.

type CloudV1

type CloudV1 interface {
	Cloud(args params.Entities) (params.CloudResults, error)
	Clouds() (params.CloudsResult, error)
	Credential(args params.Entities) (params.CloudCredentialResults, error)
	DefaultCloud() (params.StringResult, error)
	RevokeCredentials(args params.Entities) (params.ErrorResults, error)
	UpdateCredentials(args params.TaggedCredentials) (params.ErrorResults, error)
	UserCredentials(args params.UserClouds) (params.StringsResults, error)
}

CloudV1 defines the methods on the cloud API facade, version 1.

type CloudV2

type CloudV2 interface {
	AddCloud(cloudArgs params.AddCloudArgs) error
	AddCredentials(args params.TaggedCredentials) (params.ErrorResults, 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)
	DefaultCloud() (params.StringResult, error)
	RemoveClouds(args params.Entities) (params.ErrorResults, error)
	RevokeCredentials(args params.Entities) (params.ErrorResults, error)
	UpdateCredentials(args params.TaggedCredentials) (params.ErrorResults, error)
	UserCredentials(args params.UserClouds) (params.StringsResults, error)
}

CloudV2 defines the methods on the cloud API facade, version 2.

type CloudV3

type CloudV3 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)
	DefaultCloud() (params.StringResult, 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)
}

CloudV3 defines the methods on the cloud API facade, version 3.

type CloudV4

type CloudV4 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)
	DefaultCloud() (params.StringResult, 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)
}

CloudV4 defines the methods on the cloud API facade, version 4.

type CloudV5

type CloudV5 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)
}

CloudV5 defines the methods on the cloud API facade, version 5.

type CloudV6

type CloudV6 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)
}

CloudV6 defines the methods on the cloud API facade, version 6.

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
}

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
}

Jump to

Keyboard shortcuts

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