Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Global is the global locality. Global = GlobalLocality("global") )
Variables ¶
View Source
var ErrResourceNotFound = errors.New("store: resource not found")
ErrResourceNotFound is returned when a resource is not found.
Functions ¶
This section is empty.
Types ¶
type CockpitMetadata ¶
type CockpitMetadata struct {
// CanViewLogs is true if the logs associated with the resource can be viewed Scaleway Cockpit.
CanViewLogs bool
// ResourceName is the name of the resource in Scaleway Cockpit.
ResourceName string
// ResourceID is the ID of the resource in Scaleway Cockpit.
ResourceID string
// ResourceType is the type of the resource in Scaleway Cockpit.
ResourceType string
}
type GlobalLocality ¶
type GlobalLocality string
func (GlobalLocality) IsRegion ¶
func (g GlobalLocality) IsRegion() bool
func (GlobalLocality) IsZone ¶
func (g GlobalLocality) IsZone() bool
func (GlobalLocality) String ¶
func (g GlobalLocality) String() string
type Metadata ¶
type Metadata struct {
// Name is the name of the resource.
Name string `json:"name"`
// ID is the unique identifier of the resource.
ID string `json:"id"`
// ProjectID is the unique identifier of the project the resource belongs to.
ProjectID string `json:"project_id"`
// Status is the status of the resource.
// Maybe nil if not available.
Status *Status `json:"status"`
// Description is the description of the resource.
// May be empty.
Description *string `json:"description"`
// Tags is the list of tags associated with the resource.
Tags []string `json:"tags"`
// Type is the type of the resource.
Type Type `json:"type"`
// Locality is the locality of the resource.
Locality Locality `json:"locality,omitempty"`
}
type Resource ¶
type Resource interface {
// Metadata returns the metadatas of the resource.
Metadata() Metadata
// CockpitMetadata returns the metadatas of the resource for Scaleway Cockpit.
CockpitMetadata() CockpitMetadata
// Delete deletes the resource.
Delete(ctx context.Context, s Storer, client *scw.Client) error
}
type Storer ¶
type Storer interface {
// Store stores a resource.
Store(ctx context.Context, r Resource) error
// ListAllResources returns all resources.
ListAllResources(ctx context.Context) ([]Resource, error)
// ListResourcesByIDs returns all resources with the given IDs.
// Used in combination of the search API to get the resources that match a query.I
ListResourcesByIDs(ctx context.Context, ids []string) ([]Resource, error)
// FindTypedByPredicateInProject returns all resources of a given type in a project that match a predicate.
FindTypedByPredicateInProject(ctx context.Context, resourceType Type, projectID string, predicate Predicate) ([]Resource, error)
// DeleteResource deletes a resource.
DeleteResource(ctx context.Context, r Resource) error
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.