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

Commit

Permalink
feat: Added lightsail load balancers (#1254)
Browse files Browse the repository at this point in the history
* feat: Added lightsail load balancers

* e2e fix

* fix

* generate mock
  • Loading branch information
amanenk committed Jul 22, 2022
1 parent 6749225 commit 382bb7f
Show file tree
Hide file tree
Showing 10 changed files with 649 additions and 0 deletions.
40 changes: 40 additions & 0 deletions client/mocks/mock_lightsail.go

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

2 changes: 2 additions & 0 deletions client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ type LightsailClient interface {
GetCertificates(ctx context.Context, params *lightsail.GetCertificatesInput, optFns ...func(*lightsail.Options)) (*lightsail.GetCertificatesOutput, error)
GetStaticIps(ctx context.Context, params *lightsail.GetStaticIpsInput, optFns ...func(*lightsail.Options)) (*lightsail.GetStaticIpsOutput, error)
GetRelationalDatabaseSnapshots(ctx context.Context, params *lightsail.GetRelationalDatabaseSnapshotsInput, optFns ...func(*lightsail.Options)) (*lightsail.GetRelationalDatabaseSnapshotsOutput, error)
GetLoadBalancers(ctx context.Context, params *lightsail.GetLoadBalancersInput, optFns ...func(*lightsail.Options)) (*lightsail.GetLoadBalancersOutput, error)
GetLoadBalancerTlsCertificates(ctx context.Context, params *lightsail.GetLoadBalancerTlsCertificatesInput, optFns ...func(*lightsail.Options)) (*lightsail.GetLoadBalancerTlsCertificatesOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/mock_mq.go . MQClient
Expand Down
10 changes: 10 additions & 0 deletions docs/tables/aws_lightsail_load_balancer_instance_health_summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Table: aws_lightsail_load_balancer_instance_health_summary
Describes information about the health of the instance
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|load_balancer_cq_id|uuid|Unique CloudQuery ID of aws_lightsail_load_balancers table (FK)|
|instance_health|text|Describes the overall instance health|
|instance_health_reason|text|More information about the instance health|
|instance_name|text|The name of the Lightsail instance for which you are requesting health check data|
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Table: aws_lightsail_load_balancer_tls_certificate_summaries
Provides a summary of SSL/TLS certificate metadata
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|load_balancer_cq_id|uuid|Unique CloudQuery ID of aws_lightsail_load_balancers table (FK)|
|is_attached|boolean|When true, the SSL/TLS certificate is attached to the Lightsail load balancer|
|name|text|The name of the SSL/TLS certificate|
34 changes: 34 additions & 0 deletions docs/tables/aws_lightsail_load_balancer_tls_certificates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

# Table: aws_lightsail_load_balancer_tls_certificates
Describes a load balancer SSL/TLS certificate
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|load_balancer_cq_id|uuid|Unique CloudQuery ID of aws_lightsail_load_balancers table (FK)|
|arn|text|The Amazon Resource Name (ARN) of the SSL/TLS certificate|
|created_at|timestamp without time zone|The time when you created your SSL/TLS certificate|
|domain_name|text|The domain name for your SSL/TLS certificate|
|domain_validation_records|jsonb|An array of LoadBalancerTlsCertificateDomainValidationRecord objects describing the records|
|failure_reason|text|The validation failure reason, if any, of the certificate|
|is_attached|boolean|When true, the SSL/TLS certificate is attached to the Lightsail load balancer|
|issued_at|timestamp without time zone|The time when the SSL/TLS certificate was issued|
|issuer|text|The issuer of the certificate|
|key_algorithm|text|The algorithm used to generate the key pair (the public and private key)|
|load_balancer_name|text|The load balancer name where your SSL/TLS certificate is attached|
|availability_zone|text|The Availability Zone|
|region_name|text|The AWS Region name|
|name|text|The name of the SSL/TLS certificate (eg, my-certificate)|
|not_after|timestamp without time zone|The timestamp when the SSL/TLS certificate expires|
|not_before|timestamp without time zone|The timestamp when the SSL/TLS certificate is first valid|
|renewal_summary_domain_validation_options|jsonb|Contains information about the validation of each domain name in the certificate, as it pertains to Lightsail's managed renewal|
|renewal_summary_renewal_status|text|The renewal status of the certificate|
|resource_type|text|The resource type (eg, LoadBalancerTlsCertificate) * Instance - A Lightsail instance (a virtual private server) * StaticIp - A static IP address * KeyPair - The key pair used to connect to a Lightsail instance * InstanceSnapshot - A Lightsail instance snapshot * Domain - A DNS zone * PeeredVpc - A peered VPC * LoadBalancer - A Lightsail load balancer * LoadBalancerTlsCertificate - An SSL/TLS certificate associated with a Lightsail load balancer * Disk - A Lightsail block storage disk * DiskSnapshot - A block storage disk snapshot|
|revocation_reason|text|The reason the certificate was revoked|
|revoked_at|timestamp without time zone|The timestamp when 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 validation status of the SSL/TLS certificate|
|subject|text|The name of the entity that is associated with the public key contained in the certificate|
|subject_alternative_names|text[]|An array of strings that specify the alternate domains (eg, example2com) and subdomains (eg, blogexamplecom) for the certificate|
|support_code|text|The support code|
|tags|jsonb|The tag keys and optional values for the resource|
25 changes: 25 additions & 0 deletions docs/tables/aws_lightsail_load_balancers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# Table: aws_lightsail_load_balancers
Describes a load balancer
## 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 load balancer|
|configuration_options|jsonb|A string to string map of the configuration options for your load balancer Valid values are listed below|
|created_at|timestamp without time zone|The date when your load balancer was created|
|dns_name|text|The DNS name of your Lightsail load balancer|
|health_check_path|text|The path you specified to perform your health checks|
|https_redirection_enabled|boolean|A Boolean value that indicates whether HTTPS redirection is enabled for the load balancer|
|instance_port|integer|The port where the load balancer will direct traffic to your Lightsail instances|
|ip_address_type|text|The IP address type of the load balancer|
|availability_zone|text|The Availability Zone|
|name|text|The name of the load balancer (eg, my-load-balancer)|
|protocol|text|The protocol you have enabled for your load balancer|
|public_ports|integer[]|An array of public port settings for your load balancer|
|resource_type|text|Type of the lightsail resource|
|state|text|The status of your load balancer|
|support_code|text|The support code|
|tags|jsonb|The tag keys and optional values for the resource|
|tls_policy_name|text|The name of the TLS security policy for the load balancer|
1 change: 1 addition & 0 deletions resources/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func Provider() *provider.Provider {
"lightsail.database_snapshots": lightsail.DatabaseSnapshots(),
"lightsail.disks": lightsail.Disks(),
"lightsail.instances": lightsail.Instances(),
"lightsail.load_balancers": lightsail.LoadBalancers(),
"lightsail.static_ips": lightsail.StaticIps(),
"mq.brokers": mq.Brokers(),
"organizations.accounts": organizations.Accounts(),
Expand Down
76 changes: 76 additions & 0 deletions resources/services/lightsail/gen.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,80 @@ resource "aws" "lightsail" "database_snapshots" {
column "region_name" {
skip = true
}
}


resource "aws" "lightsail" "load_balancers" {
path = "github.com/aws/aws-sdk-go-v2/service/lightsail/types.LoadBalancer"
ignoreError "IgnoreAccessDenied" {
path = "github.com/cloudquery/cq-provider-aws/client.IgnoreAccessDeniedServiceDisabled"
}
multiplex "AwsAccountRegion" {
path = "github.com/cloudquery/cq-provider-aws/client.ServiceAccountRegionMultiplexer"
params = ["lightsail"]
}
deleteFilter "AccountRegionFilter" {
path = "github.com/cloudquery/cq-provider-aws/client.DeleteAccountRegionFilter"
}

options {
primary_keys = [
"arn"
]
}
userDefinedColumn "account_id" {
type = "string"
description = "The AWS Account ID of the resource."
resolver "resolveAWSAccount" {
path = "github.com/cloudquery/cq-provider-aws/client.ResolveAWSAccount"
}
}
userDefinedColumn "region" {
type = "string"
description = "The AWS Region of the resource."
resolver "resolveAWSRegion" {
path = "github.com/cloudquery/cq-provider-aws/client.ResolveAWSRegion"
}
}
column "tags" {
type = "json"
generate_resolver = true
}

column "public_ports" {
generate_resolver = true
}

column "location" {
skip_prefix = true
}

column "region_name" {
skip = true
}

column "resource_type"{
description = "Type of the lightsail resource"
}

user_relation "aws" "lightsail" "tls_certificates" {
path = "github.com/aws/aws-sdk-go-v2/service/lightsail/types.LoadBalancerTlsCertificate"
column "tags" {
type = "json"
generate_resolver = true
}

column "renewal_summary_domain_validation_options" {
type = "json"
}

column "location" {
skip_prefix = true
}


column "domain_validation_records" {
type = "json"
}
}
}
Loading

0 comments on commit 382bb7f

Please sign in to comment.