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

Commit

Permalink
Implement ACM certificates resource (#313)
Browse files Browse the repository at this point in the history
* Implement ACM certificates resource
  • Loading branch information
irmatov authored Dec 1, 2021
1 parent 49bcd81 commit b05293c
Show file tree
Hide file tree
Showing 9 changed files with 488 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/aws/aws-sdk-go-v2/credentials/stscreds"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/service/accessanalyzer"
"github.com/aws/aws-sdk-go-v2/service/acm"
"github.com/aws/aws-sdk-go-v2/service/apigateway"
"github.com/aws/aws-sdk-go-v2/service/apigatewayv2"
"github.com/aws/aws-sdk-go-v2/service/autoscaling"
Expand Down Expand Up @@ -95,6 +96,7 @@ const (
)

type Services struct {
ACM ACMClient
Analyzer AnalyzerClient
Autoscaling AutoscalingClient
Cloudfront CloudfrontClient
Expand Down Expand Up @@ -356,6 +358,7 @@ func initServices(region string, c aws.Config) Services {
awsCfg := c.Copy()
awsCfg.Region = region
return Services{
ACM: acm.NewFromConfig(awsCfg),
Analyzer: accessanalyzer.NewFromConfig(awsCfg),
Apigateway: apigateway.NewFromConfig(awsCfg),
Apigatewayv2: apigatewayv2.NewFromConfig(awsCfg),
Expand Down
96 changes: 96 additions & 0 deletions client/mocks/mock_acm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/aws/aws-sdk-go-v2/service/accessanalyzer"
"github.com/aws/aws-sdk-go-v2/service/acm"
"github.com/aws/aws-sdk-go-v2/service/apigateway"
"github.com/aws/aws-sdk-go-v2/service/apigatewayv2"
"github.com/aws/aws-sdk-go-v2/service/autoscaling"
Expand Down Expand Up @@ -48,6 +49,13 @@ import (
"github.com/aws/aws-sdk-go-v2/service/wafv2"
)

//go:generate mockgen -package=mocks -destination=./mocks/mock_acm.go . ACMClient
type ACMClient interface {
DescribeCertificate(ctx context.Context, params *acm.DescribeCertificateInput, optFns ...func(*acm.Options)) (*acm.DescribeCertificateOutput, error)
ListCertificates(ctx context.Context, params *acm.ListCertificatesInput, optFns ...func(*acm.Options)) (*acm.ListCertificatesOutput, error)
ListTagsForCertificate(ctx context.Context, params *acm.ListTagsForCertificateInput, optFns ...func(*acm.Options)) (*acm.ListTagsForCertificateOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/mock_autoscaling.go . AutoscalingClient
type AutoscalingClient interface {
DescribeLaunchConfigurations(context.Context, *autoscaling.DescribeLaunchConfigurationsInput, ...func(*autoscaling.Options)) (*autoscaling.DescribeLaunchConfigurationsOutput, error)
Expand Down
38 changes: 38 additions & 0 deletions docs/tables/aws_acm_certificates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# Table: aws_acm_certificates
Contains metadata about an ACM certificate
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|account_id|text|The AWS Account ID of the resource.|
|region|text|The AWS Region of the resource.|
|arn|text|The Amazon Resource Name (ARN) of the certificate|
|certificate_authority_arn|text|The Amazon Resource Name (ARN) of the ACM PCA private certificate authority (CA) that issued the certificate|
|created_at|timestamp without time zone|The time at which the certificate was requested.|
|domain_name|text|The fully qualified domain name for the certificate, such as www.example.com or example.com.|
|domain_validation_options|jsonb|Contains information about the initial validation of each domain name that occurs as a result of the RequestCertificate request.|
|extended_key_usages|jsonb|Contains a list of Extended Key Usage X.509 v3 extension objects.|
|failure_reason|text|The reason the certificate request failed|
|imported_at|timestamp without time zone|The date and time at which the certificate was imported|
|in_use_by|text[]|A list of ARNs for the Amazon Web Services resources that are using the certificate|
|issued_at|timestamp without time zone|The time at which the certificate was issued|
|issuer|text|The name of the certificate authority that issued and signed the certificate.|
|key_algorithm|text|The algorithm that was used to generate the public-private key pair.|
|key_usages|text[]|A list of Key Usage X.509 v3 extension objects. Each object is a string value that identifies the purpose of the public key contained in the certificate.|
|not_after|timestamp without time zone|The time after which the certificate is not valid.|
|not_before|timestamp without time zone|The time before which the certificate is not valid.|
|certificate_transparency_logging_preference|text|You can opt out of certificate transparency logging by specifying the DISABLED option|
|renewal_eligibility|text|Specifies whether the certificate is eligible for renewal|
|renewal_summary_domain_validation_options|jsonb|Contains information about the validation of each domain name in the certificate, as it pertains to ACM's managed renewal.|
|renewal_summary_status|text|The status of ACM's managed renewal (https://docs.aws.amazon.com/acm/latest/userguide/acm-renewal.html) of the certificate. This member is required.|
|renewal_summary_updated_at|timestamp without time zone|The time at which the renewal summary was last updated. This member is required.|
|renewal_summary_failure_reason|text|The reason that a renewal request was unsuccessful.|
|revocation_reason|text|The reason the certificate was revoked|
|revoked_at|timestamp without time zone|The time at which the certificate was revoked|
|serial|text|The serial number of the certificate.|
|signature_algorithm|text|The algorithm that was used to sign the certificate.|
|status|text|The status of the certificate.|
|subject|text|The name of the entity that is associated with the public key contained in the certificate.|
|subject_alternative_names|text[]|One or more domain names (subject alternative names) included in the certificate|
|type|text|The source of the certificate|
|tags|jsonb|The tags that have been applied to the ACM certificate.|
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,5 @@ require (
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.1 // indirect
github.com/aws/aws-sdk-go-v2/service/acm v1.9.1
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.0.0 h1:k7I9E6tyVWBo7H9ffpnxDWudtjau
github.com/aws/aws-sdk-go-v2/internal/ini v1.0.0/go.mod h1:g3XMXuxvqSMUjnsXXp/960152w0wFS4CXVYgQaSVOHE=
github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.4.1 h1:rGY4jUqM06SztzHgdU56MQr2gq2w3n1ByxLH0+caXR4=
github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.4.1/go.mod h1:GeaOk4gKBZZ8DMw+UF4jk3gR8rwEL1g116HN2E0YKYU=
github.com/aws/aws-sdk-go-v2/service/acm v1.9.1 h1:Ft9ymYWT+AM271ecU5PY4gxrb89X6EkHGpE1Mgr4mT4=
github.com/aws/aws-sdk-go-v2/service/acm v1.9.1/go.mod h1:XVW3+f6JwMQVm1Jq+2Cm8Uwek15UMmqkO4GD1FOBQxY=
github.com/aws/aws-sdk-go-v2/service/apigateway v1.4.0 h1:B40GhhE15B/fQq6jxFa3CWVftqIrbeacfB9H0hcSLMw=
github.com/aws/aws-sdk-go-v2/service/apigateway v1.4.0/go.mod h1:ybNHWxmf5nVxSUnqCCwrYLF2IZYZHusxX/uVAET1SVM=
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.3.1 h1:JbtOhT/gRUVyna1ZaPct002pVoBTkkHqYgiuBfV5PMY=
Expand Down
Loading

0 comments on commit b05293c

Please sign in to comment.