Skip to content

Commit 15bb1a6

Browse files
authored
feat: Add cq-gen config for apigateway (#1541)
1 parent d63fc1d commit 15bb1a6

43 files changed

Lines changed: 1159 additions & 672 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

plugins/source/aws/client/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ func (c *Client) PartitionGlobalARN(service AWSService, idParts ...string) strin
334334
return makeARN(service, c.Partition, "", "", idParts...).String()
335335
}
336336

337+
// RegionGlobalARN builds an ARN tied to current client's partition and accountID
338+
func (c *Client) RegionGlobalARN(service AWSService, idParts ...string) string {
339+
return makeARN(service, c.Partition, "", c.Region, idParts...).String()
340+
}
341+
337342
func (c *Client) withPartitionAccountIDAndRegion(partition, accountID, region string) *Client {
338343
return &Client{
339344
Partition: partition,
File renamed without changes.

plugins/source/aws/client/services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type ApplicationAutoscalingClient interface {
9494
DescribeScalingPolicies(ctx context.Context, params *applicationautoscaling.DescribeScalingPoliciesInput, optFns ...func(*applicationautoscaling.Options)) (*applicationautoscaling.DescribeScalingPoliciesOutput, error)
9595
}
9696

97-
//go:generate mockgen -package=mocks -destination=./mocks/mock_apigateway.go . ApigatewayClient
97+
//go:generate mockgen -package=mocks -destination=./mocks/apigateway.go . ApigatewayClient
9898
type ApigatewayClient interface {
9999
GetApiKeys(ctx context.Context, params *apigateway.GetApiKeysInput, optFns ...func(*apigateway.Options)) (*apigateway.GetApiKeysOutput, error)
100100
GetAuthorizers(ctx context.Context, params *apigateway.GetAuthorizersInput, optFns ...func(*apigateway.Options)) (*apigateway.GetAuthorizersOutput, error)
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

22
# Table: aws_apigateway_api_keys
3-
A resource that can be distributed to callers for executing Method resources that require an API key.
3+
A resource that can be distributed to callers for executing Method resources that require an API key
44
## Columns
55
| Name | Type | Description |
66
| ------------- | ------------- | ----- |
7-
|account_id|text|The AWS Account ID of the resource.|
8-
|region|text|The AWS Region of the resource.|
9-
|arn|text|The Amazon Resource Name (ARN) for the resource.|
10-
|created_date|timestamp without time zone|The timestamp when the API Key was created.|
11-
|customer_id|text|An AWS Marketplace customer identifier , when integrating with the AWS SaaS Marketplace.|
12-
|description|text|The description of the API Key.|
13-
|enabled|boolean|Specifies whether the API Key can be used by callers.|
14-
|id|text|The identifier of the API Key.|
15-
|last_updated_date|timestamp without time zone|The timestamp when the API Key was last updated.|
16-
|name|text|The name of the API Key.|
17-
|stage_keys|text[]|A list of Stage resources that are associated with the ApiKey resource.|
18-
|tags|jsonb|The collection of tags. Each tag element is associated with a given resource.|
19-
|value|text|The value of the API Key.|
7+
|account_id|text|The AWS Account ID of the resource|
8+
|region|text|The AWS Region of the resource|
9+
|arn|text|The Amazon Resource Name (ARN) for the resource|
10+
|created_date|timestamp without time zone|The timestamp when the API Key was created|
11+
|customer_id|text|An AWS Marketplace customer identifier , when integrating with the AWS SaaS Marketplace|
12+
|description|text|The description of the API Key|
13+
|enabled|boolean|Specifies whether the API Key can be used by callers|
14+
|id|text|The identifier of the API Key|
15+
|last_updated_date|timestamp without time zone|The timestamp when the API Key was last updated|
16+
|name|text|The name of the API Key|
17+
|stage_keys|text[]|A list of Stage resources that are associated with the ApiKey resource|
18+
|tags|jsonb|The collection of tags|
19+
|value|text|The value of the API Key|
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22
# Table: aws_apigateway_client_certificates
3-
Represents a client certificate used to configure client-side SSL authentication while sending requests to the integration endpoint.
3+
Represents a client certificate used to configure client-side SSL authentication while sending requests to the integration endpoint
44
## Columns
55
| Name | Type | Description |
66
| ------------- | ------------- | ----- |
7-
|account_id|text|The AWS Account ID of the resource.|
8-
|region|text|The AWS Region of the resource.|
9-
|arn|text|The Amazon Resource Name (ARN) for the resource.|
10-
|id|text|The identifier of the client certificate.|
11-
|created_date|timestamp without time zone|The timestamp when the client certificate was created.|
12-
|description|text|The description of the client certificate.|
13-
|expiration_date|timestamp without time zone|The timestamp when the client certificate will expire.|
14-
|pem_encoded_certificate|text|The PEM-encoded public key of the client certificate, which can be used to configure certificate authentication in the integration endpoint .|
15-
|tags|jsonb|The collection of tags. Each tag element is associated with a given resource.|
7+
|account_id|text|The AWS Account ID of the resource|
8+
|region|text|The AWS Region of the resource|
9+
|arn|text|The Amazon Resource Name (ARN) for the resource|
10+
|id|text|The identifier of the client certificate|
11+
|created_date|timestamp without time zone|The timestamp when the client certificate was created|
12+
|description|text|The description of the client certificate|
13+
|expiration_date|timestamp without time zone|The timestamp when the client certificate will expire|
14+
|pem_encoded_certificate|text|The PEM-encoded public key of the client certificate, which can be used to configure certificate authentication in the integration endpoint|
15+
|tags|jsonb|The collection of tags|
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
# Table: aws_apigateway_domain_name_base_path_mappings
3-
Represents the base path that callers of the API must provide as part of the URL after the domain name.
3+
Represents the base path that callers of the API must provide as part of the URL after the domain name
44
## Columns
55
| Name | Type | Description |
66
| ------------- | ------------- | ----- |
77
|domain_name_cq_id|uuid|Unique CloudQuery ID of aws_apigateway_domain_names table (FK)|
8-
|arn|text|The Amazon Resource Name (ARN) for the resource.|
9-
|domain_name|text|The custom domain name as an API host name, for example, my-api.example.com.|
10-
|base_path|text|The base path name that callers of the API must provide as part of the URL after the domain name.|
11-
|rest_api_id|text|The string identifier of the associated RestApi.|
12-
|stage|text|The name of the associated stage.|
8+
|arn|text|The Amazon Resource Name (ARN) for the resource|
9+
|domain_name|text|The custom domain name as an API host name|
10+
|base_path|text|The base path name that callers of the API must provide as part of the URL after the domain name|
11+
|rest_api_id|text|The string identifier of the associated RestApi|
12+
|stage|text|The name of the associated stage|
Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11

22
# Table: aws_apigateway_domain_names
3-
Represents a custom domain name as a user-friendly host name of an API (RestApi).
3+
Represents a custom domain name as a user-friendly host name of an API (RestApi)
44
## Columns
55
| Name | Type | Description |
66
| ------------- | ------------- | ----- |
7-
|account_id|text|The AWS Account ID of the resource.|
8-
|region|text|The AWS Region of the resource.|
9-
|arn|text|The Amazon Resource Name (ARN) for the resource.|
10-
|certificate_arn|text|The reference to an AWS-managed certificate that will be used by edge-optimized endpoint for this domain name. AWS Certificate Manager is the only supported source.|
11-
|certificate_name|text|The name of the certificate that will be used by edge-optimized endpoint for this domain name.|
12-
|certificate_upload_date|timestamp without time zone|The timestamp when the certificate that was used by edge-optimized endpoint for this domain name was uploaded.|
13-
|distribution_domain_name|text|The domain name of the Amazon CloudFront distribution associated with this custom domain name for an edge-optimized endpoint. You set up this association when adding a DNS record pointing the custom domain name to this distribution name. For more information about CloudFront distributions, see the Amazon CloudFront documentation (https://aws.amazon.com/documentation/cloudfront/).|
14-
|distribution_hosted_zone_id|text|The region-agnostic Amazon Route 53 Hosted Zone ID of the edge-optimized endpoint. The valid value is Z2FDTNDATAQYW2 for all the regions. For more information, see Set up a Regional Custom Domain Name (https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-regional-api-custom-domain-create.html) and AWS Regions and Endpoints for API Gateway (https://docs.aws.amazon.com/general/latest/gr/rande.html#apigateway_region).|
15-
|domain_name|text|The custom domain name as an API host name, for example, my-api.example.com.|
16-
|domain_name_status|text|The status of the DomainName migration. The valid values are AVAILABLE and UPDATING. If the status is UPDATING, the domain cannot be modified further until the existing operation is complete. If it is AVAILABLE, the domain can be updated.|
17-
|domain_name_status_message|text|An optional text message containing detailed information about status of the DomainName migration.|
18-
|endpoint_configuration_types|text[]|A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE". For a regional API and its custom domain name, the endpoint type is REGIONAL. For a private API, the endpoint type is PRIVATE.|
19-
|endpoint_configuration_vpc_endpoint_ids|text[]|A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes. It is only supported for PRIVATE endpoint type.|
20-
|mutual_tls_authentication_truststore_uri|text|An Amazon S3 URL that specifies the truststore for mutual TLS authentication, for example s3://bucket-name/key-name. The truststore can contain certificates from public or private certificate authorities. To update the truststore, upload a new version to S3, and then update your custom domain name to use the new version. To update the truststore, you must have permissions to access the S3 object.|
21-
|mutual_tls_authentication_truststore_version|text|The version of the S3 object that contains your truststore. To specify a version, you must have versioning enabled for the S3 bucket.|
22-
|mutual_tls_authentication_truststore_warnings|text[]|A list of warnings that API Gateway returns while processing your truststore. Invalid certificates produce warnings. Mutual TLS is still enabled, but some clients might not be able to access your API. To resolve warnings, upload a new truststore to S3, and then update you domain name to use the new version.|
23-
|regional_certificate_arn|text|The reference to an AWS-managed certificate that will be used for validating the regional domain name. AWS Certificate Manager is the only supported source.|
24-
|regional_certificate_name|text|The name of the certificate that will be used for validating the regional domain name.|
25-
|regional_domain_name|text|The domain name associated with the regional endpoint for this custom domain name. You set up this association by adding a DNS record that points the custom domain name to this regional domain name. The regional domain name is returned by API Gateway when you create a regional endpoint.|
26-
|regional_hosted_zone_id|text|The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint. For more information, see Set up a Regional Custom Domain Name (https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-regional-api-custom-domain-create.html) and AWS Regions and Endpoints for API Gateway (https://docs.aws.amazon.com/general/latest/gr/rande.html#apigateway_region).|
27-
|security_policy|text|The Transport Layer Security (TLS) version + cipher suite for this DomainName. The valid values are TLS_1_0 and TLS_1_2.|
28-
|tags|jsonb|The collection of tags. Each tag element is associated with a given resource.|
7+
|account_id|text|The AWS Account ID of the resource|
8+
|region|text|The AWS Region of the resource|
9+
|arn|text|The Amazon Resource Name (ARN) for the resource|
10+
|certificate_arn|text|The reference to an AWS-managed certificate that will be used by edge-optimized endpoint for this domain name|
11+
|certificate_name|text|The name of the certificate that will be used by edge-optimized endpoint for this domain name|
12+
|certificate_upload_date|timestamp without time zone|The timestamp when the certificate that was used by edge-optimized endpoint for this domain name was uploaded|
13+
|distribution_domain_name|text|The domain name of the Amazon CloudFront distribution associated with this custom domain name for an edge-optimized endpoint|
14+
|distribution_hosted_zone_id|text|The region-agnostic Amazon Route 53 Hosted Zone ID of the edge-optimized endpoint|
15+
|domain_name|text|The custom domain name as an API host name, for example, my-api.example.com|
16+
|domain_name_status|text|The status of the DomainName migration|
17+
|domain_name_status_message|text|An optional text message containing detailed information about status of the DomainName migration|
18+
|endpoint_configuration_types|text[]|A list of endpoint types of an API (RestApi) or its custom domain name (DomainName)|
19+
|endpoint_configuration_vpc_endpoint_ids|text[]|A list of VpcEndpointIds of an API (RestApi) against which to create Route53 ALIASes|
20+
|mutual_tls_authentication_truststore_uri|text|An Amazon S3 URL that specifies the truststore for mutual TLS authentication, for example s3://bucket-name/key-name|
21+
|mutual_tls_authentication_truststore_version|text|The version of the S3 object that contains your truststore|
22+
|mutual_tls_authentication_truststore_warnings|text[]|A list of warnings that API Gateway returns while processing your truststore|
23+
|ownership_verification_certificate_arn|text|The ARN of the public certificate issued by ACM to validate ownership of your custom domain|
24+
|regional_certificate_arn|text|The reference to an AWS-managed certificate that will be used for validating the regional domain name|
25+
|regional_certificate_name|text|The name of the certificate that will be used for validating the regional domain name|
26+
|regional_domain_name|text|The domain name associated with the regional endpoint for this custom domain name|
27+
|regional_hosted_zone_id|text|The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint|
28+
|security_policy|text|The Transport Layer Security (TLS) version + cipher suite for this DomainName|
29+
|tags|jsonb|The collection of tags|
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

22
# Table: aws_apigateway_rest_api_authorizers
3-
Represents an authorization layer for methods.
3+
Represents an authorization layer for methods
44
## Columns
55
| Name | Type | Description |
66
| ------------- | ------------- | ----- |
77
|rest_api_cq_id|uuid|Unique CloudQuery ID of aws_apigateway_rest_apis table (FK)|
8-
|rest_api_id|text|The API's identifier. This identifier is unique across all of your APIs in API Gateway.|
9-
|arn|text|The Amazon Resource Name (ARN) for the resource.|
10-
|auth_type|text|Optional customer-defined field, used in OpenAPI imports and exports without functional impact.|
11-
|authorizer_credentials|text|Specifies the required credentials as an IAM role for API Gateway to invoke the authorizer. To specify an IAM role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To use resource-based permissions on the Lambda function, specify null.|
12-
|authorizer_result_ttl_in_seconds|integer|The TTL in seconds of cached authorizer results. If it equals 0, authorization caching is disabled. If it is greater than 0, API Gateway will cache authorizer responses. If this field is not set, the default value is 300. The maximum value is 3600, or 1 hour.|
13-
|authorizer_uri|text|Specifies the authorizer's Uniform Resource Identifier (URI). For TOKEN or REQUEST authorizers, this must be a well-formed Lambda function URI, for example, arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}/invocations. In general, the URI has this form arn:aws:apigateway:{region}:lambda:path/{service_api}, where {region} is the same as the region hosting the Lambda function, path indicates that the remaining substring in the URI should be treated as the path to the resource, including the initial /. For Lambda functions, this is usually of the form /2015-03-31/functions/[FunctionARN]/invocations.|
14-
|id|text|The identifier for the authorizer resource.|
15-
|identity_source|text|The identity source for which authorization is requested.|
16-
|identity_validation_expression|text|A validation expression for the incoming identity token. For TOKEN authorizers, this value is a regular expression. For COGNITO_USER_POOLS authorizers, API Gateway will match the aud field of the incoming token from the client against the specified regular expression. It will invoke the authorizer's Lambda function when there is a match. Otherwise, it will return a 401 Unauthorized response without calling the Lambda function. The validation expression does not apply to the REQUEST authorizer.|
17-
|name|text|[Required] The name of the authorizer.|
18-
|provider_arns|text[]|A list of the Amazon Cognito user pool ARNs for the COGNITO_USER_POOLS authorizer. Each element is of this format: arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}. For a TOKEN or REQUEST authorizer, this is not defined.|
19-
|type|text|The authorizer type. Valid values are TOKEN for a Lambda function using a single authorization token submitted in a custom header, REQUEST for a Lambda function using incoming request parameters, and COGNITO_USER_POOLS for using an Amazon Cognito user pool.|
8+
|rest_api_id|text|The API's identifier|
9+
|arn|text|The Amazon Resource Name (ARN) for the resource|
10+
|auth_type|text|Optional customer-defined field, used in OpenAPI imports and exports without functional impact|
11+
|authorizer_credentials|text|Specifies the required credentials as an IAM role for API Gateway to invoke the authorizer|
12+
|authorizer_result_ttl_in_seconds|bigint|The TTL in seconds of cached authorizer results|
13+
|authorizer_uri|text|Specifies the authorizer's Uniform Resource Identifier (URI)|
14+
|id|text|The identifier for the authorizer resource|
15+
|identity_source|text|The identity source for which authorization is requested|
16+
|identity_validation_expression|text|A validation expression for the incoming identity token|
17+
|name|text|The name of the authorizer|
18+
|provider_arns|text[]|A list of the Amazon Cognito user pool ARNs for the COGNITO_USER_POOLS authorizer|
19+
|type|text|The authorizer type|
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
# Table: aws_apigateway_rest_api_deployments
3-
An immutable representation of a RestApi resource that can be called by users using Stages.
3+
An immutable representation of a RestApi resource that can be called by users using Stages
44
## Columns
55
| Name | Type | Description |
66
| ------------- | ------------- | ----- |
77
|rest_api_cq_id|uuid|Unique CloudQuery ID of aws_apigateway_rest_apis table (FK)|
8-
|rest_api_id|text|The API's identifier. This identifier is unique across all of your APIs in API Gateway.|
9-
|arn|text|The Amazon Resource Name (ARN) for the resource.|
10-
|api_summary|jsonb|A summary of the RestApi at the date and time that the deployment resource was created.|
11-
|created_date|timestamp without time zone|The date and time that the deployment resource was created.|
12-
|description|text|The description for the deployment resource.|
13-
|id|text|The identifier for the deployment resource.|
8+
|rest_api_id|text|The API's identifier|
9+
|arn|text|The Amazon Resource Name (ARN) for the resource|
10+
|api_summary|jsonb|A summary of the RestApi at the date and time that the deployment resource was created|
11+
|created_date|timestamp without time zone|The date and time that the deployment resource was created|
12+
|description|text|The description for the deployment resource|
13+
|id|text|The identifier for the deployment resource|

0 commit comments

Comments
 (0)