Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
feat: Add 'elasticache.clusters' resource (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
shimonp21 committed Aug 10, 2022
1 parent 2197701 commit d27b0d9
Show file tree
Hide file tree
Showing 14 changed files with 732 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/ecs"
"github.com/aws/aws-sdk-go-v2/service/efs"
"github.com/aws/aws-sdk-go-v2/service/eks"
"github.com/aws/aws-sdk-go-v2/service/elasticache"
"github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk"
elbv1 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing"
elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
Expand Down Expand Up @@ -147,6 +148,7 @@ type Services struct {
ECS EcsClient
EFS EfsClient
Eks EksClient
ElastiCache ElastiCache
ElasticBeanstalk ElasticbeanstalkClient
ElasticSearch ElasticSearch
ELBv1 ElbV1Client
Expand Down Expand Up @@ -646,6 +648,7 @@ func initServices(region string, c aws.Config) Services {
ECS: ecs.NewFromConfig(awsCfg),
EFS: efs.NewFromConfig(awsCfg),
Eks: eks.NewFromConfig(awsCfg),
ElastiCache: elasticache.NewFromConfig(awsCfg),
ElasticBeanstalk: elasticbeanstalk.NewFromConfig(awsCfg),
ElasticSearch: elasticsearchservice.NewFromConfig(awsCfg),
ELBv1: elbv1.NewFromConfig(awsCfg),
Expand Down
56 changes: 56 additions & 0 deletions client/mocks/mock_elasticache.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/ecs"
"github.com/aws/aws-sdk-go-v2/service/efs"
"github.com/aws/aws-sdk-go-v2/service/eks"
"github.com/aws/aws-sdk-go-v2/service/elasticache"
"github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk"
elbv1 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing"
elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
Expand Down Expand Up @@ -499,6 +500,11 @@ type ElasticSearch interface {
ListTags(ctx context.Context, params *elasticsearchservice.ListTagsInput, optFns ...func(*elasticsearchservice.Options)) (*elasticsearchservice.ListTagsOutput, error)
}

// go:generate mockgen -package=mocks -destination=./mocks/mock_elasticache.go . ElastiCache
type ElastiCache interface {
DescribeCacheClusters(ctx context.Context, params *elasticache.DescribeCacheClustersInput, optFns ...func(*elasticache.Options)) (*elasticache.DescribeCacheClustersOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/mock_eks.go . EksClient
type EksClient interface {
ListClusters(ctx context.Context, params *eks.ListClustersInput, optFns ...func(*eks.Options)) (*eks.ListClustersOutput, error)
Expand Down
16 changes: 16 additions & 0 deletions docs/tables/aws_elasticache_cluster_cache_nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# Table: aws_elasticache_cluster_cache_nodes
Represents an individual cache node within a cluster
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_elasticache_clusters table (FK)|
|create_time|timestamp without time zone|The date and time when the cache node was created.|
|id|text|The cache node identifier|
|status|text|The current state of this cache node, one of the following values: available, creating, rebooting, or deleting.|
|customer_availability_zone|text|The Availability Zone where this node was created and now resides.|
|customer_outpost_arn|text|The customer outpost ARN of the cache node.|
|endpoint_address|text|The DNS hostname of the cache node.|
|endpoint_port|bigint|The port number that the cache engine is listening on.|
|parameter_group_status|text|The status of the parameter group applied to this cache node.|
|source_cache_node_id|text|The ID of the primary node to which this read replica node is synchronized|
9 changes: 9 additions & 0 deletions docs/tables/aws_elasticache_cluster_cache_security_groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Table: aws_elasticache_cluster_cache_security_groups
Represents a cluster's status within a particular cache security group.
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_elasticache_clusters table (FK)|
|name|text|The name of the cache security group.|
|status|text|The membership status in the cache security group|
14 changes: 14 additions & 0 deletions docs/tables/aws_elasticache_cluster_log_delivery_configurations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Table: aws_elasticache_cluster_log_delivery_configurations
Returns the destination, format and type of the logs.
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_elasticache_clusters table (FK)|
|cloudwatch_destination_log_group|text|The log group of the CloudWatch Logs destination|
|kinesis_firehose_destination_delivery_stream|text|The Kinesis Data Firehose delivery stream of the Kinesis Data Firehose destination|
|destination_type|text|Returns the destination type, either cloudwatch-logs or kinesis-firehose.|
|log_format|text|Returns the log format, either JSON or TEXT.|
|log_type|text|Refers to slow-log (https://redis.io/commands/slowlog) or engine-log.|
|message|text|Returns an error message for the log delivery configuration.|
|status|text|Returns the log delivery configuration status|
9 changes: 9 additions & 0 deletions docs/tables/aws_elasticache_cluster_security_groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Table: aws_elasticache_cluster_security_groups
Represents a single cache security group and its status.
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_elasticache_clusters table (FK)|
|security_group_id|text|The identifier of the cache security group.|
|status|text|The status of the cache security group membership|
42 changes: 42 additions & 0 deletions docs/tables/aws_elasticache_clusters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

# Table: aws_elasticache_clusters
Contains all of the attributes of a specific cluster.
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|account_id|text|The AWS Account ID of the resource.|
|region|text|The AWS Region of the resource.|
|arn|text|The ARN (Amazon Resource Name) of the cache cluster.|
|at_rest_encryption_enabled|boolean|A flag that enables encryption at-rest when set to true|
|auth_token_enabled|boolean|A flag that enables using an AuthToken (password) when issuing Redis commands. Default: false|
|auth_token_last_modified_date|timestamp without time zone|The date the auth token was last modified|
|auto_minor_version_upgrade|boolean|Auto minor version upgrade|
|create_time|timestamp without time zone|The date and time when the cluster was created.|
|id|text|The user-supplied identifier of the cluster|
|status|text|The current state of this cluster, one of the following values: available, creating, deleted, deleting, incompatible-network, modifying, rebooting cluster nodes, restore-failed, or snapshotting.|
|cache_node_type|text|The name of the compute and memory capacity node type for the cluster|
|cache_parameter_group_cache_node_ids_to_reboot|text[]|A list of the cache node IDs which need to be rebooted for parameter changes to be applied|
|cache_parameter_group_name|text|The name of the cache parameter group.|
|cache_parameter_group_parameter_apply_status|text|The status of parameter updates.|
|cache_subnet_group_name|text|The name of the cache subnet group associated with the cluster.|
|client_download_landing_page|text|The URL of the web page where you can download the latest ElastiCache client library.|
|configuration_endpoint_address|text|The DNS hostname of the cache node.|
|configuration_endpoint_port|bigint|The port number that the cache engine is listening on.|
|engine|text|The name of the cache engine (memcached or redis) to be used for this cluster.|
|engine_version|text|The version of the cache engine that is used in this cluster.|
|notification_configuration_topic_arn|text|The arn of a notification topic used for publishing ElastiCache events to subscribers using Amazon Simple Notification Service (SNS)|
|notification_configuration_topic_status|text|The current state of a notification topic used for publishing ElastiCache events to subscribers using Amazon Simple Notification Service (SNS)|
|num_cache_nodes|bigint|The number of cache nodes in the cluster|
|pending_auth_token_status|text|Auth token status that is applied to the cluster in the future or is currently being applied|
|pending_cache_node_ids_to_remove|text[]|A list of cache node IDs that are being removed (or will be removed) from the cluster|
|pending_cache_node_type|text|The cache node type that this cluster or replication group is scaled to.|
|pending_engine_version|text|Cache engine version that is being applied to the cluster (or will be applied)|
|pending_num_cache_nodes|bigint|The new number of cache nodes for the cluster|
|preferred_availability_zone|text|The name of the Availability Zone in which the cluster is located or "Multiple" if the cache nodes are located in different Availability Zones.|
|preferred_maintenance_window|text|Specifies the weekly time range during which maintenance on the cluster is performed|
|preferred_outpost_arn|text|The outpost ARN in which the cache cluster is created.|
|replication_group_id|text|The replication group to which this cluster belongs|
|replication_group_log_delivery_enabled|boolean|A boolean value indicating whether log delivery is enabled for the replication group.|
|snapshot_retention_limit|bigint|The number of days for which ElastiCache retains automatic cluster snapshots before deleting them|
|snapshot_window|text|The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your cluster|
|transit_encryption_enabled|boolean|A flag that enables in-transit encryption when set to true|
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ecs v1.18.11
github.com/aws/aws-sdk-go-v2/service/efs v1.17.6
github.com/aws/aws-sdk-go-v2/service/eks v1.21.4
github.com/aws/aws-sdk-go-v2/service/elasticache v1.22.1
github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.14.8
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.14.7
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.18.7
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ github.com/aws/aws-sdk-go-v2/service/efs v1.17.6 h1:xLqD17d7IITbgpcwAowvpadKnlhd
github.com/aws/aws-sdk-go-v2/service/efs v1.17.6/go.mod h1:rbtsxZFwOmj0xOlKwlgQb22SDSbNbLxy/gMcbSup4r8=
github.com/aws/aws-sdk-go-v2/service/eks v1.21.4 h1:qmKWieiIiYwD46GRD6nxFc1KsyR0ChGRid8emb7rDEY=
github.com/aws/aws-sdk-go-v2/service/eks v1.21.4/go.mod h1:Th2+t6mwi0bZayXUOFOTuyWR2nwRUVcadDy4WGE8C2E=
github.com/aws/aws-sdk-go-v2/service/elasticache v1.22.1 h1:ctpT3Cl9LCSnzfDsulH5kECwXLL0jMXAnjukWeIdSZ4=
github.com/aws/aws-sdk-go-v2/service/elasticache v1.22.1/go.mod h1:1Yuus60M9YJNgRxEYkfcAZs8NIyK2QAutQX2uYFbA+s=
github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.14.8 h1:NaAcC6RHMqsLpXF63W6ReZowBUu/Q3Iew5fyzUSzXfM=
github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.14.8/go.mod h1:OxtRjhqiKW0MVldgF7m8n/7Osragp0Sy4IWDDwurt2k=
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.14.7 h1:nlby2V7Qa/p8aP18M7L3lWfYQ57Bm6HTB6MJR5q3oIk=
Expand Down
2 changes: 2 additions & 0 deletions resources/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/cloudquery/cq-provider-aws/resources/services/ecs"
"github.com/cloudquery/cq-provider-aws/resources/services/efs"
"github.com/cloudquery/cq-provider-aws/resources/services/eks"
"github.com/cloudquery/cq-provider-aws/resources/services/elasticache"
"github.com/cloudquery/cq-provider-aws/resources/services/elasticbeanstalk"
"github.com/cloudquery/cq-provider-aws/resources/services/elasticsearch"
"github.com/cloudquery/cq-provider-aws/resources/services/elbv1"
Expand Down Expand Up @@ -161,6 +162,7 @@ func Provider() *provider.Provider {
"ecs.task_definitions": ecs.EcsTaskDefinitions(),
"efs.filesystems": efs.EfsFilesystems(),
"eks.clusters": eks.EksClusters(),
"elasticache.clusters": elasticache.Clusters(),
"elasticbeanstalk.application_versions": elasticbeanstalk.ApplicationVersions(),
"elasticbeanstalk.applications": elasticbeanstalk.ElasticbeanstalkApplications(),
"elasticbeanstalk.environments": elasticbeanstalk.ElasticbeanstalkEnvironments(),
Expand Down
Loading

0 comments on commit d27b0d9

Please sign in to comment.