Skip to content

Commit bdf3867

Browse files
authored
feat(aws): Support AWS Account Contacts (#4734)
#### Summary <!-- Explain what problem this PR addresses --> <!--
1 parent 7507bae commit bdf3867

18 files changed

Lines changed: 455 additions & 0 deletions

plugins/source/aws/client/mocks/account.go

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/source/aws/client/services.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/source/aws/client/services/account.go

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/source/aws/codegen/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
func generateResources() ([]*recipes.Resource, error) {
1313
var resources []*recipes.Resource
1414
resources = append(resources, recipes.AccessAnalyzerResources()...)
15+
resources = append(resources, recipes.AccountResources()...)
1516
resources = append(resources, recipes.ACMResources()...)
1617
resources = append(resources, recipes.APIGatewayResources()...)
1718
resources = append(resources, recipes.APIGatewayV2Resources()...)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package recipes
2+
3+
import (
4+
"github.com/aws/aws-sdk-go-v2/service/account/types"
5+
"github.com/cloudquery/plugin-sdk/codegen"
6+
"github.com/cloudquery/plugin-sdk/schema"
7+
)
8+
9+
func AccountResources() []*Resource {
10+
resources := []*Resource{
11+
{
12+
SubService: "alternate_contacts",
13+
Struct: &types.AlternateContact{},
14+
Description: "https://docs.aws.amazon.com/accounts/latest/reference/API_AlternateContact.html",
15+
PKColumns: []string{"alternate_contact_type"},
16+
ExtraColumns: []codegen.ColumnDefinition{
17+
{
18+
Name: "account_id",
19+
Type: schema.TypeString,
20+
Resolver: "client.ResolveAWSAccount",
21+
Options: schema.ColumnCreationOptions{PrimaryKey: true},
22+
},
23+
},
24+
},
25+
{
26+
SubService: "contacts",
27+
Struct: &types.ContactInformation{},
28+
Description: "https://docs.aws.amazon.com/accounts/latest/reference/API_ContactInformation.html",
29+
ExtraColumns: []codegen.ColumnDefinition{
30+
{
31+
Name: "account_id",
32+
Type: schema.TypeString,
33+
Resolver: "client.ResolveAWSAccount",
34+
Options: schema.ColumnCreationOptions{PrimaryKey: true},
35+
},
36+
},
37+
},
38+
}
39+
40+
for _, r := range resources {
41+
r.Service = "account"
42+
r.Multiplex = `client.AccountMultiplex`
43+
44+
}
45+
return resources
46+
}

plugins/source/aws/codegen/services/clients.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package services
22

33
import (
44
"github.com/aws/aws-sdk-go-v2/service/accessanalyzer"
5+
"github.com/aws/aws-sdk-go-v2/service/account"
56
"github.com/aws/aws-sdk-go-v2/service/acm"
67
"github.com/aws/aws-sdk-go-v2/service/apigateway"
78
"github.com/aws/aws-sdk-go-v2/service/apigatewayv2"
@@ -94,6 +95,7 @@ import (
9495

9596
var clients = []interface{}{
9697
&accessanalyzer.Client{},
98+
&account.Client{},
9799
&acm.Client{},
98100
&apigateway.Client{},
99101
&apigatewayv2.Client{},

plugins/source/aws/docs/tables/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
| [aws_accessanalyzer_analyzers](aws_accessanalyzer_analyzers.md) |
66
|[aws_accessanalyzer_analyzer_findings](aws_accessanalyzer_analyzer_findings.md) |
77
|[aws_accessanalyzer_analyzer_archive_rules](aws_accessanalyzer_analyzer_archive_rules.md) |
8+
| [aws_account_alternate_contacts](aws_account_alternate_contacts.md) |
9+
| [aws_account_contacts](aws_account_contacts.md) |
810
| [aws_acm_certificates](aws_acm_certificates.md) |
911
| [aws_apigateway_api_keys](aws_apigateway_api_keys.md) |
1012
| [aws_apigateway_client_certificates](aws_apigateway_client_certificates.md) |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Table: aws_account_alternate_contacts
2+
3+
https://docs.aws.amazon.com/accounts/latest/reference/API_AlternateContact.html
4+
5+
The composite primary key for this table is (**account_id**, **alternate_contact_type**).
6+
7+
8+
## Columns
9+
| Name | Type |
10+
| ------------- | ------------- |
11+
|_cq_source_name|String|
12+
|_cq_sync_time|Timestamp|
13+
|_cq_id|UUID|
14+
|_cq_parent_id|UUID|
15+
|account_id (PK)|String|
16+
|alternate_contact_type (PK)|String|
17+
|email_address|String|
18+
|name|String|
19+
|phone_number|String|
20+
|title|String|
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Table: aws_account_contacts
2+
3+
https://docs.aws.amazon.com/accounts/latest/reference/API_ContactInformation.html
4+
5+
The primary key for this table is **account_id**.
6+
7+
8+
## Columns
9+
| Name | Type |
10+
| ------------- | ------------- |
11+
|_cq_source_name|String|
12+
|_cq_sync_time|Timestamp|
13+
|_cq_id|UUID|
14+
|_cq_parent_id|UUID|
15+
|account_id (PK)|String|
16+
|address_line1|String|
17+
|city|String|
18+
|country_code|String|
19+
|full_name|String|
20+
|phone_number|String|
21+
|postal_code|String|
22+
|address_line2|String|
23+
|address_line3|String|
24+
|company_name|String|
25+
|district_or_county|String|
26+
|state_or_region|String|
27+
|website_url|String|

plugins/source/aws/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/aws/aws-sdk-go-v2/credentials v1.13.1
99
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.40
1010
github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.17.2
11+
github.com/aws/aws-sdk-go-v2/service/account v1.7.11
1112
github.com/aws/aws-sdk-go-v2/service/acm v1.16.2
1213
github.com/aws/aws-sdk-go-v2/service/apigateway v1.15.24
1314
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.12.22

0 commit comments

Comments
 (0)