Skip to content

Commit 7b18e5d

Browse files
erezrokahpull[bot]
authored andcommitted
feat(gcp-resources): Add AppEngine resources (#5972)
<!-- 🎉 Thank you for making CloudQuery awesome by submitting a PR 🎉 --> #### Summary Relevant API https://cloud.google.com/appengine/docs/admin-api/reference/rest. ### Notes: 1. `apps` - table auto generated and resolver + test manually since it's a `Get` function (looks like there's a top level app per project). 2. `services`, `versions` and `instances` - table and resolvers auto generated + test manually since due to relations 3. Everything else auto generated <!-- Use the following steps to ensure your PR is ready to be reviewed - [ ] Read the [contribution guidelines](../blob/main/CONTRIBUTING.md) 🧑‍🎓 - [ ] Test locally on your own infrastructure - [ ] Run `go fmt` to format your code 🖊 - [ ] Lint your changes via `golangci-lint run` 🚨 (install golangci-lint [here](https://golangci-lint.run/usage/install/#local-installation)) - [ ] Update or add tests 🧪 - [ ] Ensure the status checks below are successful ✅ --->
1 parent d496709 commit 7b18e5d

29 files changed

+1568
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package recipes
2+
3+
import (
4+
appengine "cloud.google.com/go/appengine/apiv1"
5+
pb "cloud.google.com/go/appengine/apiv1/appenginepb"
6+
)
7+
8+
func init() {
9+
resources := []*Resource{
10+
{
11+
SubService: "apps",
12+
Struct: &pb.Application{},
13+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
14+
NewFunction: appengine.NewApplicationsClient,
15+
ListFunction: (&appengine.ApplicationsClient{}).GetApplication,
16+
RegisterServer: pb.RegisterApplicationsServer,
17+
RequestStructFields: `Parent: "apps/" + c.ProjectId,`,
18+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application",
19+
SkipFetch: true,
20+
SkipMock: true,
21+
},
22+
{
23+
SubService: "services",
24+
Struct: &pb.Service{},
25+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
26+
NewFunction: appengine.NewServicesClient,
27+
RegisterServer: pb.RegisterServicesServer,
28+
RequestStructFields: `Parent: "apps/" + c.ProjectId,`,
29+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#Service",
30+
Relations: []string{"Versions()"},
31+
SkipMock: true,
32+
},
33+
{
34+
SubService: "versions",
35+
Struct: &pb.Version{},
36+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
37+
NewFunction: appengine.NewVersionsClient,
38+
RegisterServer: pb.RegisterVersionsServer,
39+
RequestStructFields: `Parent: parent.Item.(*pb.Service).Name,`,
40+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version",
41+
ChildTable: true,
42+
Relations: []string{"Instances()"},
43+
SkipMock: true,
44+
},
45+
{
46+
SubService: "instances",
47+
Struct: &pb.Instance{},
48+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
49+
NewFunction: appengine.NewInstancesClient,
50+
RegisterServer: pb.RegisterInstancesServer,
51+
RequestStructFields: `Parent: parent.Item.(*pb.Version).Name,`,
52+
ChildTable: true,
53+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions.instances#Instance",
54+
SkipMock: true,
55+
},
56+
{
57+
SubService: "authorized_certificates",
58+
Struct: &pb.AuthorizedCertificate{},
59+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
60+
NewFunction: appengine.NewAuthorizedCertificatesClient,
61+
RegisterServer: pb.RegisterAuthorizedCertificatesServer,
62+
RequestStructFields: `Parent: "apps/" + c.ProjectId,`,
63+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.authorizedCertificates#AuthorizedCertificate",
64+
},
65+
{
66+
SubService: "authorized_domains",
67+
Struct: &pb.AuthorizedDomain{},
68+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
69+
NewFunction: appengine.NewAuthorizedDomainsClient,
70+
RegisterServer: pb.RegisterAuthorizedDomainsServer,
71+
RequestStructFields: `Parent: "apps/" + c.ProjectId,`,
72+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.authorizedDomains#AuthorizedDomain",
73+
},
74+
{
75+
SubService: "domain_mappings",
76+
Struct: &pb.DomainMapping{},
77+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
78+
NewFunction: appengine.NewDomainMappingsClient,
79+
RegisterServer: pb.RegisterDomainMappingsServer,
80+
RequestStructFields: `Parent: "apps/" + c.ProjectId,`,
81+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.domainMappings#DomainMapping",
82+
},
83+
{
84+
SubService: "firewall_ingress_rules",
85+
Struct: &pb.FirewallRule{},
86+
PrimaryKeys: []string{ProjectIdColumn.Name, "name"},
87+
NewFunction: appengine.NewFirewallClient,
88+
RegisterServer: pb.RegisterFirewallServer,
89+
RequestStructFields: `Parent: "apps/" + c.ProjectId,`,
90+
Description: "https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.firewall.ingressRules#FirewallRule",
91+
},
92+
}
93+
94+
for _, resource := range resources {
95+
resource.Service = "appengine"
96+
resource.Template = "newapi_list"
97+
resource.MockTemplate = "newapi_list_grpc_mock"
98+
resource.ProtobufImport = "cloud.google.com/go/appengine/apiv1/appenginepb"
99+
resource.MockImports = []string{"cloud.google.com/go/appengine/apiv1"}
100+
}
101+
102+
Resources = append(Resources, resources...)
103+
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
- [gcp_apigateway_apis](gcp_apigateway_apis.md)
3636
- [gcp_apigateway_gateways](gcp_apigateway_gateways.md)
3737
- [gcp_apikeys_keys](gcp_apikeys_keys.md)
38+
- [gcp_appengine_apps](gcp_appengine_apps.md)
39+
- [gcp_appengine_services](gcp_appengine_services.md)
40+
- [gcp_appengine_versions](gcp_appengine_versions.md)
41+
- [gcp_appengine_instances](gcp_appengine_instances.md)
42+
- [gcp_appengine_authorized_certificates](gcp_appengine_authorized_certificates.md)
43+
- [gcp_appengine_authorized_domains](gcp_appengine_authorized_domains.md)
44+
- [gcp_appengine_domain_mappings](gcp_appengine_domain_mappings.md)
45+
- [gcp_appengine_firewall_ingress_rules](gcp_appengine_firewall_ingress_rules.md)
3846
- [gcp_bigquery_datasets](gcp_bigquery_datasets.md)
3947
- [gcp_bigquery_tables](gcp_bigquery_tables.md)
4048
- [gcp_billing_billing_accounts](gcp_billing_billing_accounts.md)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Table: gcp_appengine_apps
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps#Application
4+
5+
The composite primary key for this table is (**project_id**, **name**).
6+
7+
## Columns
8+
9+
| Name | Type |
10+
| ------------- | ------------- |
11+
|_cq_source_name|String|
12+
|_cq_sync_time|Timestamp|
13+
|_cq_id|UUID|
14+
|_cq_parent_id|UUID|
15+
|project_id (PK)|String|
16+
|name (PK)|String|
17+
|id|String|
18+
|dispatch_rules|JSON|
19+
|auth_domain|String|
20+
|location_id|String|
21+
|code_bucket|String|
22+
|default_cookie_expiration|Int|
23+
|serving_status|String|
24+
|default_hostname|String|
25+
|default_bucket|String|
26+
|service_account|String|
27+
|iap|JSON|
28+
|gcr_domain|String|
29+
|database_type|String|
30+
|feature_settings|JSON|
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Table: gcp_appengine_authorized_certificates
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.authorizedCertificates#AuthorizedCertificate
4+
5+
The composite primary key for this table is (**project_id**, **name**).
6+
7+
## Columns
8+
9+
| Name | Type |
10+
| ------------- | ------------- |
11+
|_cq_source_name|String|
12+
|_cq_sync_time|Timestamp|
13+
|_cq_id|UUID|
14+
|_cq_parent_id|UUID|
15+
|project_id (PK)|String|
16+
|name (PK)|String|
17+
|id|String|
18+
|display_name|String|
19+
|domain_names|StringArray|
20+
|expire_time|Timestamp|
21+
|certificate_raw_data|JSON|
22+
|managed_certificate|JSON|
23+
|visible_domain_mappings|StringArray|
24+
|domain_mappings_count|Int|
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Table: gcp_appengine_authorized_domains
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.authorizedDomains#AuthorizedDomain
4+
5+
The composite primary key for this table is (**project_id**, **name**).
6+
7+
## Columns
8+
9+
| Name | Type |
10+
| ------------- | ------------- |
11+
|_cq_source_name|String|
12+
|_cq_sync_time|Timestamp|
13+
|_cq_id|UUID|
14+
|_cq_parent_id|UUID|
15+
|project_id (PK)|String|
16+
|name (PK)|String|
17+
|id|String|
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Table: gcp_appengine_domain_mappings
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.domainMappings#DomainMapping
4+
5+
The composite primary key for this table is (**project_id**, **name**).
6+
7+
## Columns
8+
9+
| Name | Type |
10+
| ------------- | ------------- |
11+
|_cq_source_name|String|
12+
|_cq_sync_time|Timestamp|
13+
|_cq_id|UUID|
14+
|_cq_parent_id|UUID|
15+
|project_id (PK)|String|
16+
|name (PK)|String|
17+
|id|String|
18+
|ssl_settings|JSON|
19+
|resource_records|JSON|
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Table: gcp_appengine_firewall_ingress_rules
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.firewall.ingressRules#FirewallRule
4+
5+
The primary key for this table is **project_id**.
6+
7+
## Columns
8+
9+
| Name | Type |
10+
| ------------- | ------------- |
11+
|_cq_source_name|String|
12+
|_cq_sync_time|Timestamp|
13+
|_cq_id|UUID|
14+
|_cq_parent_id|UUID|
15+
|project_id (PK)|String|
16+
|priority|Int|
17+
|action|String|
18+
|source_range|String|
19+
|description|String|
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Table: gcp_appengine_instances
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions.instances#Instance
4+
5+
The composite primary key for this table is (**project_id**, **name**).
6+
7+
## Relations
8+
9+
This table depends on [gcp_appengine_versions](gcp_appengine_versions.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+
|project_id (PK)|String|
20+
|name (PK)|String|
21+
|id|String|
22+
|app_engine_release|String|
23+
|availability|String|
24+
|vm_name|String|
25+
|vm_zone_name|String|
26+
|vm_id|String|
27+
|start_time|Timestamp|
28+
|requests|Int|
29+
|errors|Int|
30+
|qps|Float|
31+
|average_latency|Int|
32+
|memory_usage|Int|
33+
|vm_status|String|
34+
|vm_debug_enabled|Bool|
35+
|vm_ip|String|
36+
|vm_liveness|String|
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Table: gcp_appengine_services
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services#Service
4+
5+
The composite primary key for this table is (**project_id**, **name**).
6+
7+
## Relations
8+
9+
The following tables depend on gcp_appengine_services:
10+
- [gcp_appengine_versions](gcp_appengine_versions.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+
|project_id (PK)|String|
21+
|name (PK)|String|
22+
|id|String|
23+
|split|JSON|
24+
|labels|JSON|
25+
|network_settings|JSON|
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Table: gcp_appengine_versions
2+
3+
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version
4+
5+
The composite primary key for this table is (**project_id**, **name**).
6+
7+
## Relations
8+
9+
This table depends on [gcp_appengine_services](gcp_appengine_services.md).
10+
11+
The following tables depend on gcp_appengine_versions:
12+
- [gcp_appengine_instances](gcp_appengine_instances.md)
13+
14+
## Columns
15+
16+
| Name | Type |
17+
| ------------- | ------------- |
18+
|_cq_source_name|String|
19+
|_cq_sync_time|Timestamp|
20+
|_cq_id|UUID|
21+
|_cq_parent_id|UUID|
22+
|project_id (PK)|String|
23+
|name (PK)|String|
24+
|id|String|
25+
|inbound_services|IntArray|
26+
|instance_class|String|
27+
|network|JSON|
28+
|zones|StringArray|
29+
|resources|JSON|
30+
|runtime|String|
31+
|runtime_channel|String|
32+
|threadsafe|Bool|
33+
|vm|Bool|
34+
|app_engine_apis|Bool|
35+
|beta_settings|JSON|
36+
|env|String|
37+
|serving_status|String|
38+
|created_by|String|
39+
|create_time|Timestamp|
40+
|disk_usage_bytes|Int|
41+
|runtime_api_version|String|
42+
|runtime_main_executable_path|String|
43+
|service_account|String|
44+
|handlers|JSON|
45+
|error_handlers|JSON|
46+
|libraries|JSON|
47+
|api_config|JSON|
48+
|env_variables|JSON|
49+
|build_env_variables|JSON|
50+
|default_expiration|Int|
51+
|health_check|JSON|
52+
|readiness_check|JSON|
53+
|liveness_check|JSON|
54+
|nobuild_files_regex|String|
55+
|deployment|JSON|
56+
|version_url|String|
57+
|endpoints_api_service|JSON|
58+
|entrypoint|JSON|
59+
|vpc_access_connector|JSON|

0 commit comments

Comments
 (0)