Skip to content

Commit 8cad8e4

Browse files
authored
feat(aws): Add AWS Managed Service for Prometheus (#5875)
#### Summary Implements part of #5788. <!--
1 parent aae130b commit 8cad8e4

21 files changed

Lines changed: 750 additions & 0 deletions

File tree

plugins/source/aws/client/data/partition_service_region.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@
135135
"us-west-2": {}
136136
}
137137
},
138+
"amp": {
139+
"regions": {
140+
"ap-northeast-1": {},
141+
"ap-southeast-1": {},
142+
"ap-southeast-2": {},
143+
"eu-central-1": {},
144+
"eu-north-1": {},
145+
"eu-west-1": {},
146+
"eu-west-2": {},
147+
"us-east-1": {},
148+
"us-east-2": {},
149+
"us-west-2": {}
150+
}
151+
},
138152
"amplify": {
139153
"regions": {
140154
"ap-east-1": {},

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

Lines changed: 176 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/amp.go

Lines changed: 18 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
@@ -15,6 +15,7 @@ func generateResources() ([]*recipes.Resource, error) {
1515
resources = append(resources, recipes.AccessAnalyzerResources()...)
1616
resources = append(resources, recipes.AccountResources()...)
1717
resources = append(resources, recipes.ACMResources()...)
18+
resources = append(resources, recipes.AMPResources()...)
1819
resources = append(resources, recipes.APIGatewayResources()...)
1920
resources = append(resources, recipes.APIGatewayV2Resources()...)
2021
resources = append(resources, recipes.ApplicationAutoScalingResources()...)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package recipes
2+
3+
import (
4+
"github.com/aws/aws-sdk-go-v2/service/amp/types"
5+
"github.com/cloudquery/plugin-sdk/codegen"
6+
"github.com/cloudquery/plugin-sdk/schema"
7+
)
8+
9+
func AMPResources() []*Resource {
10+
return []*Resource{
11+
{
12+
Service: "amp",
13+
SubService: "workspaces",
14+
Struct: new(types.WorkspaceDescription),
15+
Description: "https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-APIReference.html#AMP-APIReference-WorkspaceDescription",
16+
Multiplex: `client.ServiceAccountRegionMultiplexer("amp")`,
17+
PreResourceResolver: "describeWorkspace",
18+
PKColumns: []string{"arn"},
19+
ExtraColumns: append(
20+
defaultRegionalColumns,
21+
codegen.ColumnDefinition{
22+
Name: "alert_manager_definition",
23+
Type: schema.TypeJSON,
24+
Resolver: `describeAlertManagerDefinition`,
25+
},
26+
codegen.ColumnDefinition{
27+
Name: "logging_configuration",
28+
Type: schema.TypeJSON,
29+
Resolver: `describeLoggingConfiguration`,
30+
},
31+
),
32+
Relations: []string{"RuleGroupsNamespaces()"},
33+
},
34+
{
35+
Service: "amp",
36+
SubService: "rule_groups_namespaces",
37+
Struct: new(types.RuleGroupsNamespaceDescription),
38+
Description: "https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-APIReference.html#AMP-APIReference-RuleGroupsNamespaceDescription",
39+
Multiplex: "", // relation for workspace
40+
PreResourceResolver: "describeRuleGroupsNamespace",
41+
PKColumns: []string{"arn"},
42+
ExtraColumns: append(
43+
defaultRegionalColumns,
44+
codegen.ColumnDefinition{
45+
Name: "workspace_arn",
46+
Type: schema.TypeString,
47+
Resolver: `schema.ParentColumnResolver("arn")`,
48+
},
49+
),
50+
},
51+
}
52+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/aws/aws-sdk-go-v2/service/accessanalyzer"
55
"github.com/aws/aws-sdk-go-v2/service/account"
66
"github.com/aws/aws-sdk-go-v2/service/acm"
7+
"github.com/aws/aws-sdk-go-v2/service/amp"
78
"github.com/aws/aws-sdk-go-v2/service/apigateway"
89
"github.com/aws/aws-sdk-go-v2/service/apigatewayv2"
910
"github.com/aws/aws-sdk-go-v2/service/applicationautoscaling"
@@ -100,6 +101,7 @@ var clients = []any{
100101
&accessanalyzer.Client{},
101102
&account.Client{},
102103
&acm.Client{},
104+
&amp.Client{},
103105
&apigateway.Client{},
104106
&apigatewayv2.Client{},
105107
&applicationautoscaling.Client{},

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
- [aws_account_alternate_contacts](aws_account_alternate_contacts.md)
99
- [aws_account_contacts](aws_account_contacts.md)
1010
- [aws_acm_certificates](aws_acm_certificates.md)
11+
- [aws_amp_workspaces](aws_amp_workspaces.md)
12+
- [aws_amp_rule_groups_namespaces](aws_amp_rule_groups_namespaces.md)
1113
- [aws_apigateway_api_keys](aws_apigateway_api_keys.md)
1214
- [aws_apigateway_client_certificates](aws_apigateway_client_certificates.md)
1315
- [aws_apigateway_domain_names](aws_apigateway_domain_names.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Table: aws_amp_rule_groups_namespaces
2+
3+
https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-APIReference.html#AMP-APIReference-RuleGroupsNamespaceDescription
4+
5+
The primary key for this table is **arn**.
6+
7+
## Relations
8+
9+
This table depends on [aws_amp_workspaces](aws_amp_workspaces.md).
10+
11+
## Columns
12+
13+
| Name | Type |
14+
| ------------- | ------------- |
15+
|_cq_source_name|String|
16+
|_cq_sync_time|Timestamp|
17+
|_cq_id|UUID|
18+
|_cq_parent_id|UUID|
19+
|account_id|String|
20+
|region|String|
21+
|workspace_arn|String|
22+
|arn (PK)|String|
23+
|created_at|Timestamp|
24+
|data|IntArray|
25+
|modified_at|Timestamp|
26+
|name|String|
27+
|status|JSON|
28+
|tags|JSON|
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Table: aws_amp_workspaces
2+
3+
https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-APIReference.html#AMP-APIReference-WorkspaceDescription
4+
5+
The primary key for this table is **arn**.
6+
7+
## Relations
8+
9+
The following tables depend on aws_amp_workspaces:
10+
- [aws_amp_rule_groups_namespaces](aws_amp_rule_groups_namespaces.md)
11+
12+
## Columns
13+
14+
| Name | Type |
15+
| ------------- | ------------- |
16+
|_cq_source_name|String|
17+
|_cq_sync_time|Timestamp|
18+
|_cq_id|UUID|
19+
|_cq_parent_id|UUID|
20+
|account_id|String|
21+
|region|String|
22+
|alert_manager_definition|JSON|
23+
|logging_configuration|JSON|
24+
|arn (PK)|String|
25+
|created_at|Timestamp|
26+
|status|JSON|
27+
|workspace_id|String|
28+
|alias|String|
29+
|prometheus_endpoint|String|
30+
|tags|JSON|

0 commit comments

Comments
 (0)