Documentation
¶
Index ¶
- type DemoResourceUnmarshal
- type ResourceUnmarshaler
- type ScalewayResourceUnmarshal
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteResource(ctx context.Context, r resource.Resource) error
- func (s *Store) GetResource(ctx context.Context, resourceID string) (resource.Resource, error)
- func (s *Store) ListAllResources(ctx context.Context) ([]resource.Resource, error)
- func (s *Store) SetUnmarshaller(u ResourceUnmarshaler)
- func (s *Store) Store(ctx context.Context, r resource.Resource) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DemoResourceUnmarshal ¶
type DemoResourceUnmarshal struct{}
func (DemoResourceUnmarshal) UnmarshalResource ¶
func (d DemoResourceUnmarshal) UnmarshalResource(_ resource.Type, resourceData string) (resource.Resource, error)
UnmarshalResource implements ResourceUnmarshaler. The reason this has to be split for demo resources is that the demo resources can take on any type. Eg: a demo resource can be a scaleway.Project, a scaleway.Container, a scaleway.Function, etc.
type ResourceUnmarshaler ¶
type ScalewayResourceUnmarshal ¶
type ScalewayResourceUnmarshal struct{}
func (ScalewayResourceUnmarshal) UnmarshalResource ¶
func (s ScalewayResourceUnmarshal) UnmarshalResource(resourceType resource.Type, resourceData string) (resource.Resource, error)
UnmarshalResource implements ResourceUnmarshaler.
type Store ¶
func NewStore ¶
NewStore creates a new store. The store is used to save the resources in a database, to avoid querying the API every time. It also allows doing some analysis on the resources, like finding dangling resources.
func (*Store) DeleteResource ¶
DeleteResource implements resource.Storer.
func (*Store) GetResource ¶
GetResource implements resource.Storer.
func (*Store) ListAllResources ¶
ListAllResources implements resource.Storer.
func (*Store) SetUnmarshaller ¶
func (s *Store) SetUnmarshaller(u ResourceUnmarshaler)
SetUnmarshaller sets the unmarshaller used to unmarshal the resources. In demo mode, the unmarshaller is set to a demo unmarshaller that returns a demo resource.