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

Feat/fix missing pks #118

Merged
merged 5 commits into from
Jul 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/tables/aws_ec2_image_block_device_mappings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describes a block device mapping.
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|image_id|uuid|Unique CloudQuery ID of aws_ec2_images table (FK)|
|image_cq_id|uuid|Unique CloudQuery ID of aws_ec2_images table (FK)|
|device_name|text|The device name (for example, /dev/sdh or xvdh).|
|ebs_delete_on_termination|boolean|Indicates whether the EBS volume is deleted on instance termination.|
|ebs_encrypted|boolean|Indicates whether the encryption state of an EBS volume is changed while being restored from a backing snapshot.|
Expand Down
4 changes: 2 additions & 2 deletions docs/tables/aws_efs_filesystems.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ A description of the file system.
|region|text|The AWS Region of the resource.|
|creation_time|timestamp without time zone|The time that the file system was created, in seconds (since 1970-01-01T00:00:00Z).|
|creation_token|text|The opaque string specified in the request.|
|file_system_id|text|The ID of the file system, assigned by Amazon EFS.|
|id|text|The ID of the file system, assigned by Amazon EFS.|
|life_cycle_state|text|The lifecycle phase of the file system.|
|number_of_mount_targets|integer|The current number of mount targets that the file system has.|
|owner_id|text|The AWS account that created the file system.|
|performance_mode|text|The performance mode of the file system.|
|size_in_bytes_value|bigint|The latest known metered size (in bytes) of data stored in the file system.|
|size_in_bytes_timestamp|timestamp without time zone|The time at which the size of data, returned in the Value field, was determined.|
|size_in_bytes_value_in_i_a|bigint|The latest known metered size (in bytes) of data stored in the Infrequent Access storage class.|
|size_in_bytes_value_in_ia|bigint|The latest known metered size (in bytes) of data stored in the Infrequent Access storage class.|
|size_in_bytes_value_in_standard|bigint|The latest known metered size (in bytes) of data stored in the Standard storage class.|
|tags|jsonb|The tags associated with the file system, presented as an array of Tag objects.|
|availability_zone_id|text|The unique and consistent identifier of the Availability Zone in which the file system's One Zone storage classes exist.|
Expand Down
2 changes: 1 addition & 1 deletion docs/tables/aws_eks_cluster_encryption_configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ The encryption configuration for the cluster.
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_id|uuid|Unique CloudQuery ID of aws_eks_clusters table (FK)|
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_eks_clusters table (FK)|
|provider_key_arn|text|Amazon Resource Name (ARN) or alias of the customer master key (CMK).|
|resources|text[]|Specifies the resources to be encrypted.|
2 changes: 1 addition & 1 deletion docs/tables/aws_eks_cluster_loggings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ An object representing the enabled or disabled Kubernetes control plane logs for
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_id|uuid|Unique CloudQuery ID of aws_eks_clusters table (FK)|
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_eks_clusters table (FK)|
|enabled|boolean|If a log type is enabled, that log type exports its control plane logs to CloudWatch Logs.|
|types|text[]|The available cluster control plane log types.|
2 changes: 1 addition & 1 deletion docs/tables/aws_rds_cluster_associated_roles.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describes an AWS Identity and Access Management (IAM) role that is associated wi
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|feature_name|text|The name of the feature associated with the AWS Identity and Access Management (IAM) role|
|role_arn|text|The Amazon Resource Name (ARN) of the IAM role that is associated with the DB cluster.|
|status|text|Describes the state of association between the IAM role and the DB cluster|
2 changes: 1 addition & 1 deletion docs/tables/aws_rds_cluster_db_cluster_members.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contains information about an instance that is part of a DB cluster.
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|db_cluster_parameter_group_status|text|Specifies the status of the DB cluster parameter group for this member of the DB cluster.|
|db_instance_identifier|text|Specifies the instance identifier for this member of the DB cluster.|
|is_cluster_writer|boolean|Value that is true if the cluster member is the primary instance for the DB cluster and false otherwise.|
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion docs/tables/aws_rds_cluster_domain_memberships.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ An Active Directory Domain membership record associated with the DB instance or
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|domain|text|The identifier of the Active Directory Domain.|
|fqdn|text|The fully qualified domain name of the Active Directory Domain.|
|iam_role_name|text|The name of the IAM role to be used when making API calls to the Directory Service.|
Expand Down
2 changes: 1 addition & 1 deletion docs/tables/aws_rds_cluster_vpc_security_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ This data type is used as a response element for queries on VPC security group m
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|cluster_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|cluster_cq_id|uuid|Unique CloudQuery ID of aws_rds_clusters table (FK)|
|status|text|The status of the VPC security group.|
|vpc_security_group_id|text|The name of the VPC security group.|
3 changes: 2 additions & 1 deletion docs/tables/aws_rds_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ Contains the details of an Amazon Aurora DB cluster
|db_cluster_arn|text|The Amazon Resource Name (ARN) for the DB cluster.|
|db_cluster_identifier|text|Contains a user-supplied DB cluster identifier|
|db_cluster_parameter_group|text|Specifies the name of the DB cluster parameter group for the DB cluster.|
|db_cluster_option_group_memberships|jsonb|Provides the map of option group memberships for this DB cluster.|
|db_subnet_group|text|Specifies information on the subnet group associated with the DB cluster, including the name, description, and subnets in the subnet group.|
|database_name|text|Contains the name of the initial database of this DB cluster that was provided at create time, if one was specified when the DB cluster was created|
|db_cluster_resource_id|text|The AWS Region-unique, immutable identifier for the DB cluster|
|id|text|The AWS Region-unique, immutable identifier for the DB cluster|
|deletion_protection|boolean|Indicates if the DB cluster has deletion protection enabled|
|earliest_backtrack_time|timestamp without time zone|The earliest time to which a DB cluster can be backtracked.|
|earliest_restorable_time|timestamp without time zone|The earliest time to which a database can be restored with point-in-time restore.|
Expand Down
2 changes: 1 addition & 1 deletion resources/ec2_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func Ec2Images() *schema.Table {
Resolver: fetchEc2ImageBlockDeviceMappings,
Columns: []schema.Column{
{
Name: "image_id",
Name: "image_cq_id",
Description: "Unique CloudQuery ID of aws_ec2_images table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
Expand Down
6 changes: 4 additions & 2 deletions resources/efs_filesystems.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func EfsFilesystems() *schema.Table {
Multiplex: client.AccountRegionMultiplex,
IgnoreError: client.IgnoreAccessDeniedServiceDisabled,
DeleteFilter: client.DeleteAccountRegionFilter,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"account_id", "id"}},
Columns: []schema.Column{
{
Name: "account_id",
Expand All @@ -42,9 +43,10 @@ func EfsFilesystems() *schema.Table {
Type: schema.TypeString,
},
{
Name: "file_system_id",
Name: "id",
Description: "The ID of the file system, assigned by Amazon EFS.",
Type: schema.TypeString,
Resolver: schema.PathResolver("FileSystemId"),
},
{
Name: "life_cycle_state",
Expand Down Expand Up @@ -79,7 +81,7 @@ func EfsFilesystems() *schema.Table {
Resolver: schema.PathResolver("SizeInBytes.Timestamp"),
},
{
Name: "size_in_bytes_value_in_i_a",
Name: "size_in_bytes_value_in_ia",
Description: "The latest known metered size (in bytes) of data stored in the Infrequent Access storage class.",
Type: schema.TypeBigInt,
Resolver: schema.PathResolver("SizeInBytes.ValueInIA"),
Expand Down
29 changes: 3 additions & 26 deletions resources/eks_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func EksClusters() *schema.Table {
Multiplex: client.AccountRegionMultiplex,
IgnoreError: client.IgnoreAccessDeniedServiceDisabled,
DeleteFilter: client.DeleteAccountRegionFilter,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"arn"}},
Columns: []schema.Column{
{
Name: "account_id",
Expand Down Expand Up @@ -148,7 +149,7 @@ func EksClusters() *schema.Table {
Resolver: fetchEksClusterEncryptionConfigs,
Columns: []schema.Column{
{
Name: "cluster_id",
Name: "cluster_cq_id",
Description: "Unique CloudQuery ID of aws_eks_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
Expand All @@ -172,31 +173,7 @@ func EksClusters() *schema.Table {
Resolver: fetchEksClusterLoggings,
Columns: []schema.Column{
{
Name: "cluster_id",
Description: "Unique CloudQuery ID of aws_eks_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
},
{
Name: "enabled",
Description: "If a log type is enabled, that log type exports its control plane logs to CloudWatch Logs.",
Type: schema.TypeBool,
},
{
Name: "types",
Description: "The available cluster control plane log types.",
Type: schema.TypeStringArray,
Resolver: resolveEksClusterLoggingTypes,
},
},
},
{
Name: "aws_eks_cluster_loggings",
Description: "An object representing the enabled or disabled Kubernetes control plane logs for your cluster.",
Resolver: fetchEksClusterLoggings,
Columns: []schema.Column{
{
Name: "cluster_id",
Name: "cluster_cq_id",
Description: "Unique CloudQuery ID of aws_eks_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
Expand Down
61 changes: 28 additions & 33 deletions resources/rds_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func RdsClusters() *schema.Table {
Multiplex: client.AccountRegionMultiplex,
IgnoreError: client.IgnoreAccessDeniedServiceDisabled,
DeleteFilter: client.DeleteAccountRegionFilter,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"account_id", "id"}},
Columns: []schema.Column{
{
Name: "account_id",
Expand Down Expand Up @@ -130,6 +131,12 @@ func RdsClusters() *schema.Table {
Type: schema.TypeString,
Resolver: schema.PathResolver("DBClusterParameterGroup"),
},
{
Name: "db_cluster_option_group_memberships",
Description: "Provides the map of option group memberships for this DB cluster.",
Type: schema.TypeJSON,
Resolver: resolveRdsClusterDbClusterOptionGroupMemberships,
},
{
Name: "db_subnet_group",
Description: "Specifies information on the subnet group associated with the DB cluster, including the name, description, and subnets in the subnet group.",
Expand All @@ -142,9 +149,10 @@ func RdsClusters() *schema.Table {
Type: schema.TypeString,
},
{
Name: "db_cluster_resource_id",
Name: "id",
Description: "The AWS Region-unique, immutable identifier for the DB cluster",
Type: schema.TypeString,
Resolver: schema.PathResolver("DbClusterResourceId"),
},
{
Name: "deletion_protection",
Expand Down Expand Up @@ -356,9 +364,10 @@ func RdsClusters() *schema.Table {
Name: "aws_rds_cluster_associated_roles",
Description: "Describes an AWS Identity and Access Management (IAM) role that is associated with a DB cluster. ",
Resolver: fetchRdsClusterAssociatedRoles,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"cluster_cq_id", "role_arn"}},
Columns: []schema.Column{
{
Name: "cluster_id",
Name: "cluster_cq_id",
Description: "Unique CloudQuery ID of aws_rds_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
Expand All @@ -384,9 +393,10 @@ func RdsClusters() *schema.Table {
Name: "aws_rds_cluster_db_cluster_members",
Description: "Contains information about an instance that is part of a DB cluster. ",
Resolver: fetchRdsClusterDbClusterMembers,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"cluster_cq_id", "db_instance_identifier"}},
Columns: []schema.Column{
{
Name: "cluster_id",
Name: "cluster_cq_id",
Description: "Unique CloudQuery ID of aws_rds_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
Expand Down Expand Up @@ -415,37 +425,14 @@ func RdsClusters() *schema.Table {
},
},
},
{
Name: "aws_rds_cluster_db_cluster_option_group_memberships",
Description: "Contains status information for a DB cluster option group. ",
Resolver: fetchRdsClusterDbClusterOptionGroupMemberships,
Columns: []schema.Column{
{
Name: "cluster_id",
Description: "Unique CloudQuery ID of aws_rds_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
},
{
Name: "db_cluster_option_group_name",
Description: "Specifies the name of the DB cluster option group.",
Type: schema.TypeString,
Resolver: schema.PathResolver("DBClusterOptionGroupName"),
},
{
Name: "status",
Description: "Specifies the status of the DB cluster option group.",
Type: schema.TypeString,
},
},
},
{
Name: "aws_rds_cluster_domain_memberships",
Description: "An Active Directory Domain membership record associated with the DB instance or cluster. ",
Resolver: fetchRdsClusterDomainMemberships,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"cluster_cq_id", "domain"}},
Columns: []schema.Column{
{
Name: "cluster_id",
Name: "cluster_cq_id",
Description: "Unique CloudQuery ID of aws_rds_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
Expand Down Expand Up @@ -478,9 +465,10 @@ func RdsClusters() *schema.Table {
Name: "aws_rds_cluster_vpc_security_groups",
Description: "This data type is used as a response element for queries on VPC security group membership. ",
Resolver: fetchRdsClusterVpcSecurityGroups,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"cluster_cq_id", "vpc_security_group_id"}},
Columns: []schema.Column{
{
Name: "cluster_id",
Name: "cluster_cq_id",
Description: "Unique CloudQuery ID of aws_rds_clusters table (FK)",
Type: schema.TypeUUID,
Resolver: schema.ParentIdResolver,
Expand Down Expand Up @@ -547,14 +535,21 @@ func fetchRdsClusterDbClusterMembers(ctx context.Context, meta schema.ClientMeta
res <- cluster.DBClusterMembers
return nil
}
func fetchRdsClusterDbClusterOptionGroupMemberships(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan interface{}) error {
cluster, ok := parent.Item.(types.DBCluster)
func resolveRdsClusterDbClusterOptionGroupMemberships(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {
cluster, ok := resource.Item.(types.DBCluster)
if !ok {
return fmt.Errorf("not db cluster")
}
res <- cluster.DBClusterOptionGroupMemberships
return nil
if cluster.DBClusterOptionGroupMemberships == nil {
return nil
}
memberships := make(map[string]interface{}, len(cluster.DBClusterOptionGroupMemberships))
for _, m := range cluster.DBClusterOptionGroupMemberships {
memberships[*m.DBClusterOptionGroupName] = m.Status
}
return resource.Set(c.Name, memberships)
}

func fetchRdsClusterDomainMemberships(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan interface{}) error {
cluster, ok := parent.Item.(types.DBCluster)
if !ok {
Expand Down