cloud

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

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 19 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
	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)

	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, callCtx environscontext.ProviderCallContext) (*CloudAPI, error)

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

func NewFacadeV3

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

NewFacadeV3 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.

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 (api *CloudAPI) DefaultCloud() (params.StringResult, error)

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

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) 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. 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 {
	*CloudAPI
}

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 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 Model

type Model interface {
	Cloud() string
	CloudCredential() (names.CloudCredentialTag, bool)
	CloudRegion() string
}

type ModelPoolBackend

type ModelPoolBackend interface {
	// Get allows to retrieve a particular mode given a model UUID.
	Get(modelUUID string) (PooledModelBackend, 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 PooledModelBackend

type PooledModelBackend interface {
	// Model represents the model itself.
	Model() credentialcommon.PersistentBackend
	// Release returns a connection to the model back to the pool.
	Release() bool
}

PooledModelBackend defines a model retrieved from the model pool.

func NewPooledModelBackend

func NewPooledModelBackend(st *state.PooledState) PooledModelBackend

NewPooledModelBackend creates a pooled model backend based on state.PooledState.

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