Documentation ¶
Index ¶
- Constants
- func Classify(err error) (castellum.OperationOutcome, error)
- type AssetManagerStatic
- func (m AssetManagerStatic) CheckResourceAllowed(_ context.Context, assetType db.AssetType, scopeUUID, configJSON string, ...) error
- func (m AssetManagerStatic) GetAssetStatus(_ context.Context, res db.Resource, assetUUID string, ...) (core.AssetStatus, error)
- func (m AssetManagerStatic) InfoForAssetType(assetType db.AssetType) *core.AssetTypeInfo
- func (m AssetManagerStatic) Init(provider core.ProviderClient) (err error)
- func (m AssetManagerStatic) ListAssets(_ context.Context, res db.Resource) ([]string, error)
- func (m AssetManagerStatic) PluginTypeID() string
- func (m AssetManagerStatic) SetAssetSize(_ context.Context, res db.Resource, assetUUID string, oldSize, newSize uint64) (castellum.OperationOutcome, error)
- type StaticAsset
- type UserError
Constants ¶
const ( // ServerDeletionTimeout is how long the "server-groups" asset manager will // wait for servers to be deleted before reporting an error. ServerDeletionTimeout = 3 * time.Minute // ServerCreationTimeout is how long the "server-groups" asset manager will // wait for new servers to go into state ACTIVE before reporting an error. ServerCreationTimeout = 5 * time.Minute // ServerPollInterval is how often servers are polled during state transitions // when the desired state has not been reached yet. ServerPollInterval = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetManagerStatic ¶
type AssetManagerStatic struct { AssetType db.AssetType Assets map[string]map[string]StaticAsset UsageMetrics []castellum.UsageMetric CheckResourceAllowedFails bool SetAssetSizeFails bool ExpectsConfiguration bool ConflictsWithAssetType db.AssetType }
AssetManagerStatic is a core.AssetManager for testing purposes. It just contains a static list of assets for a single asset type. No requests against OpenStack are ever made by it.
Attempts to resize assets will succeed if and only if `newSize > usage`.
func (AssetManagerStatic) CheckResourceAllowed ¶
func (m AssetManagerStatic) CheckResourceAllowed(_ context.Context, assetType db.AssetType, scopeUUID, configJSON string, existingResources map[db.AssetType]struct{}) error
CheckResourceAllowed implements the core.AssetManager interface.
func (AssetManagerStatic) GetAssetStatus ¶
func (m AssetManagerStatic) GetAssetStatus(_ context.Context, res db.Resource, assetUUID string, previousStatus *core.AssetStatus) (core.AssetStatus, error)
GetAssetStatus implements the core.AssetManager interface.
func (AssetManagerStatic) InfoForAssetType ¶
func (m AssetManagerStatic) InfoForAssetType(assetType db.AssetType) *core.AssetTypeInfo
InfoForAssetType implements the core.AssetManager interface.
func (AssetManagerStatic) Init ¶
func (m AssetManagerStatic) Init(provider core.ProviderClient) (err error)
Init implements the core.AssetManager interface.
func (AssetManagerStatic) ListAssets ¶
ListAssets implements the core.AssetManager interface.
func (AssetManagerStatic) PluginTypeID ¶
func (m AssetManagerStatic) PluginTypeID() string
PluginTypeID implements the core.AssetManager interface.
func (AssetManagerStatic) SetAssetSize ¶
func (m AssetManagerStatic) SetAssetSize(_ context.Context, res db.Resource, assetUUID string, oldSize, newSize uint64) (castellum.OperationOutcome, error)
SetAssetSize implements the core.AssetManager interface.
type StaticAsset ¶
type StaticAsset struct { Size uint64 Usage uint64 StrictMinimumSize *uint64 StrictMaximumSize *uint64 // When non-zero, these fields model a resize operation that will only be // reflected after GetAssetStatus() has been called for as many times as // indicated in the .RemainingDelay field. NewSize uint64 RemainingDelay uint // When true, return a bogus error from GetAssetStatus(). CannotGetAssetStatus bool // When true, return a core.AssetNotFoundError from GetAssetStatus(). CannotFindAsset bool }
StaticAsset represents an asset managed by AssetManagerStatic. It is only used in tests as a double for an actual asset.
type UserError ¶
type UserError struct {
Inner error
}
UserError is an error wrapper that allows to mark errors as "failed" instead of "errored" without having to carry a separate OperationOutcome value.
TODO upstream this into internal/core and remove OperationOutcome return values from the fallible methods on AssetManager