Documentation
¶
Index ¶
- func AllowCloudType(ctx context.Context, db coredatabase.TxnRunner, version int, name string) error
- func CreateCloud(ctx context.Context, tx *sqlair.TX, ownerName user.Name, cloudUUID string, ...) error
- func GetCloudForUUID(ctx context.Context, st domain.Preparer, tx *sqlair.TX, uuid corecloud.UUID) (cloud.Cloud, error)
- func LoadClouds(ctx context.Context, st domain.Preparer, tx *sqlair.TX, name string) ([]cloud.Cloud, error)
- type State
- func (st *State) Cloud(ctx context.Context, name string) (*cloud.Cloud, error)
- func (st *State) CreateCloud(ctx context.Context, ownerName user.Name, cloudUUID string, cloud cloud.Cloud) error
- func (st *State) DeleteCloud(ctx context.Context, name string) error
- func (st *State) GetCloudForUUID(ctx context.Context, id corecloud.UUID) (cloud.Cloud, error)
- func (st *State) ListClouds(ctx context.Context) ([]cloud.Cloud, error)
- func (st *State) UpdateCloud(ctx context.Context, cloud cloud.Cloud) error
- func (st *State) WatchCloud(ctx context.Context, ...) (watcher.NotifyWatcher, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowCloudType ¶
AllowCloudType is responsible for applying the cloud type to the given database. If the unique constraint applies the error is masked and returned as NIL.
func CreateCloud ¶
func CreateCloud(ctx context.Context, tx *sqlair.TX, ownerName user.Name, cloudUUID string, cloud cloud.Cloud) error
CreateCloud saves the specified cloud and creates Admin permission on the cloud for the provided user. Exported for use in the related cloud bootstrap package. Should never be directly called outside of the cloud bootstrap package.
Types ¶
type State ¶
State is used to access the database.
func NewState ¶
func NewState(factory coredatabase.TxnRunnerFactory) *State
NewState creates a state to access the database.
func (*State) CreateCloud ¶
func (st *State) CreateCloud(ctx context.Context, ownerName user.Name, cloudUUID string, cloud cloud.Cloud) error
CreateCloud creates a cloud and provides admin permissions to the provided ownerName. This is the exported method for use with the cloud state.
func (*State) DeleteCloud ¶
DeleteCloud removes a cloud credential with the given name.
func (*State) GetCloudForUUID ¶
GetCloudForUUID returns the cloud associated with the provided uuid. If no cloud is found for the given uuid then a clouderrors.NotFound error is returned.
func (*State) ListClouds ¶
ListClouds lists the clouds with the specified filter, if any.
func (*State) UpdateCloud ¶
UpdateCloud updates the specified cloud.
func (*State) WatchCloud ¶
func (st *State) WatchCloud( ctx context.Context, getWatcher func(string, string, changestream.ChangeType) (watcher.NotifyWatcher, error), cloudName string, ) (watcher.NotifyWatcher, error)
WatchCloud returns a new NotifyWatcher watching for changes to the specified cloud.