Documentation
¶
Overview ¶
Code generated by generate-cached. DO NOT EDIT.
Index ¶
- func ParseAttributes(resource types.ResourceDescription) (data map[string]interface{}, tags map[string]string, err error)
- func ParseTags(attrs map[string]interface{}) (map[string]string, error)
- type AwsClient
- type CloudControlRepository
- func (r *CloudControlRepository) DescribeResource(resourceType cfg.ResourceType, identifier *string) (*awscloudcontrol.GetResourceOutput, error)
- func (r *CloudControlRepository) FindResources(query *awscloudcontrol.ListResourcesInput) ([]types.ResourceDescription, error)
- func (r *CloudControlRepository) GetRegion() ptypes.AwsRegion
- func (r *CloudControlRepository) ListResourcesByInput(query *cc.ListResourcesInput, detailed bool) ([]Resource, error)
- func (r *CloudControlRepository) ListResourcesByType(resourceType cfg.ResourceType) ([]Resource, error)
- func (r *CloudControlRepository) ListResourcesByTypeDetailed(resourceType cfg.ResourceType) ([]Resource, error)
- func (r *CloudControlRepository) WithCache(dc *cache.DataCache) *CloudControlRepositoryCached
- type CloudControlRepositoryCached
- func (c *CloudControlRepositoryCached) ListResourcesByInput(query *awscloudcontrol.ListResourcesInput, detailed bool) ([]Resource, error)
- func (c *CloudControlRepositoryCached) ListResourcesByType(resourceType cfg.ResourceType) ([]Resource, error)
- func (c *CloudControlRepositoryCached) ListResourcesByTypeDetailed(resourceType cfg.ResourceType) ([]Resource, error)
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseAttributes ¶
Types ¶
type AwsClient ¶
type AwsClient interface {
GetRegion() ptypes.AwsRegion
GetAccountID() ptypes.AwsAccountID
}
type CloudControlRepository ¶
type CloudControlRepository struct {
// contains filtered or unexported fields
}
func NewCloudControlRepository ¶
func NewCloudControlRepository(ctx context.Context, client *v3.Client) *CloudControlRepository
func (*CloudControlRepository) DescribeResource ¶
func (r *CloudControlRepository) DescribeResource(resourceType cfg.ResourceType, identifier *string) (*awscloudcontrol.GetResourceOutput, error)
func (*CloudControlRepository) FindResources ¶
func (r *CloudControlRepository) FindResources(query *awscloudcontrol.ListResourcesInput) ([]types.ResourceDescription, error)
func (*CloudControlRepository) GetRegion ¶
func (r *CloudControlRepository) GetRegion() ptypes.AwsRegion
func (*CloudControlRepository) ListResourcesByInput ¶ added in v0.6.0
func (r *CloudControlRepository) ListResourcesByInput(query *cc.ListResourcesInput, detailed bool) ([]Resource, error)
ListResourcesByInput is the workhorse behind the two methods above. Passing the input directly gives callers ResourceModel (required to list nested types such as AWS::ApiGateway::Method) and MaxResults.
Neither a failed detail fetch nor unparsable properties drops the resource: both degrade to what was already known and log, because a silently shorter list is worse than a resource with missing attributes — the caller cannot tell the difference between "dropped" and "does not exist".
func (*CloudControlRepository) ListResourcesByType ¶ added in v0.6.0
func (r *CloudControlRepository) ListResourcesByType(resourceType cfg.ResourceType) ([]Resource, error)
ListResourcesByType lists every resource of resourceType through the Cloud Control API, using only the properties the LIST handler returns.
This is the generic path: it works for any AWS::*::* type whose Cloud Control registry entry implements LIST, with no per-type Go code. Types that only implement READ (or that need parent identifiers to be listed) come back as a Cloud Control error rather than an empty list — use ListResourcesByInput with a ResourceModel for the latter.
func (*CloudControlRepository) ListResourcesByTypeDetailed ¶ added in v0.6.0
func (r *CloudControlRepository) ListResourcesByTypeDetailed(resourceType cfg.ResourceType) ([]Resource, error)
ListResourcesByTypeDetailed is ListResourcesByType plus a GetResource per item, for types whose LIST handler returns only identifiers.
That is one extra API call per resource, so it is a separate method rather than the default: callers should reach for it only when they actually need full properties (S3 buckets need it, EC2 instances do not).
func (*CloudControlRepository) WithCache ¶ added in v0.4.0
func (r *CloudControlRepository) WithCache(dc *cache.DataCache) *CloudControlRepositoryCached
WithCache returns a CloudControlRepositoryCached that stores/retrieves results via the given DataCache. The cache namespace is set to "<accountID>:<region>:cloudcontrol".
The service name is part of the namespace because cache.Key renders a parameterless call as the bare method name, and several services expose the same one: ListClustersAll on ecs/eks/emr, ListTablesAll on dynamodb/glue. Sharing a namespace makes those repositories overwrite each other's entries, so every read decodes another service's payload, fails, and refetches from AWS.
type CloudControlRepositoryCached ¶ added in v0.4.0
type CloudControlRepositoryCached struct {
// contains filtered or unexported fields
}
CloudControlRepositoryCached wraps CloudControlRepository and caches results of Get*/List* calls.
func (*CloudControlRepositoryCached) ListResourcesByInput ¶ added in v0.6.0
func (c *CloudControlRepositoryCached) ListResourcesByInput(query *awscloudcontrol.ListResourcesInput, detailed bool) ([]Resource, error)
ListResourcesByInput returns cached results when available, otherwise delegates to the underlying repository.
func (*CloudControlRepositoryCached) ListResourcesByType ¶ added in v0.6.0
func (c *CloudControlRepositoryCached) ListResourcesByType(resourceType cfg.ResourceType) ([]Resource, error)
ListResourcesByType returns cached results when available, otherwise delegates to the underlying repository.
func (*CloudControlRepositoryCached) ListResourcesByTypeDetailed ¶ added in v0.6.0
func (c *CloudControlRepositoryCached) ListResourcesByTypeDetailed(resourceType cfg.ResourceType) ([]Resource, error)
ListResourcesByTypeDetailed returns cached results when available, otherwise delegates to the underlying repository.
type Resource ¶ added in v0.6.0
type Resource struct {
service.AbstractResource
cc.ResourceDescription
// Attributes is the parsed Properties JSON object. Nested objects and
// arrays are preserved as map[string]interface{} and []interface{}; both
// are gob-registered in this package so they survive the cache.
Attributes map[string]interface{}
// Tags is lifted out of Attributes when the type carries a CloudFormation
// style Tags list. Empty for types that do not.
Tags map[string]string
}
Resource is a schema-less AWS resource fetched through the Cloud Control API.
Unlike the typed entities in this package (Instance, Bucket, Volume) it embeds no service-specific SDK struct: the resource's own fields stay in Attributes, exactly as Cloud Control returned them. That is what lets one repository method serve any AWS::*::* type whose registry entry implements the LIST handler, with no per-type Go code — the point of the generic path.
Attributes and Tags are exported deliberately. The cache handlers serialize with encoding/gob, which silently ignores unexported fields, so an unexported map here would come back empty from a cache hit rather than erroring — the resource would look real and its properties would have vanished.
func NewResource ¶ added in v0.6.0
func NewResource( client AwsClient, resourceType cfg.ResourceType, resource cc.ResourceDescription, attributes map[string]interface{}, tags map[string]string, ) Resource
NewResource builds a generic resource from one Cloud Control list/get result. resourceType is passed in rather than derived because ResourceDescription does not carry the type it belongs to.
func (Resource) GetAttributes ¶ added in v0.6.0
GetAttributes exposes the parsed Cloud Control properties. Consumers that curate attributes per resource type (e.g. an MCP server's summary view) can type-assert for this method to get a generic fallback for free.
func (Resource) GetName ¶ added in v0.6.0
GetName resolves a display name without type-specific knowledge: the Name tag first (the convention most AWS consoles use), then a Name-ish property, then nothing. Callers still have GetId for identity — this is for humans.