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

Commit

Permalink
feat: Add Kinesis Data Stream support (#1348)
Browse files Browse the repository at this point in the history

#### Summary

<!--
Explain what problem this PR addresses
-->

---
  • Loading branch information
bbernays authored Aug 1, 2022
1 parent 9d4a22f commit 767bfab
Show file tree
Hide file tree
Showing 11 changed files with 489 additions and 28 deletions.
31 changes: 17 additions & 14 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/guardduty"
"github.com/aws/aws-sdk-go-v2/service/iam"
"github.com/aws/aws-sdk-go-v2/service/iot"
"github.com/aws/aws-sdk-go-v2/service/kinesis"
"github.com/aws/aws-sdk-go-v2/service/kms"
"github.com/aws/aws-sdk-go-v2/service/lambda"
"github.com/aws/aws-sdk-go-v2/service/lightsail"
Expand Down Expand Up @@ -136,24 +137,25 @@ type Services struct {
CognitoUserPools CognitoUserPoolsClient
ConfigService ConfigServiceClient
DAX DAXClient
DMS DatabasemigrationserviceClient
Directconnect DirectconnectClient
DMS DatabasemigrationserviceClient
DynamoDB DynamoDBClient
EC2 Ec2Client
ECR EcrClient
ECS EcsClient
EFS EfsClient
ELBv1 ElbV1Client
ELBv2 ElbV2Client
EMR EmrClient
Eks EksClient
ElasticBeanstalk ElasticbeanstalkClient
ElasticSearch ElasticSearch
ELBv1 ElbV1Client
ELBv2 ElbV2Client
EMR EmrClient
FSX FsxClient
Glue GlueClient
GuardDuty GuardDutyClient
IAM IamClient
IOT IOTClient
Kinesis KinesisClient
KMS KmsClient
Lambda LambdaClient
Lightsail LightsailClient
Expand All @@ -167,16 +169,16 @@ type Services struct {
S3 S3Client
S3Control S3ControlClient
S3Manager S3ManagerClient
SageMaker SageMakerClient
SecretsManager SecretsManagerClient
SES SESClient
Shield ShieldClient
SNS SnsClient
SQS SQSClient
SSM SSMClient
SageMaker SageMakerClient
SecretsManager SecretsManagerClient
Waf WafClient
WafV2 WafV2Client
WafRegional WafRegionalClient
WafV2 WafV2Client
Workspaces WorkspacesClient
Xray XrayClient
}
Expand Down Expand Up @@ -619,18 +621,18 @@ func initServices(region string, c aws.Config) Services {
Apigateway: apigateway.NewFromConfig(awsCfg),
Apigatewayv2: apigatewayv2.NewFromConfig(awsCfg),
ApplicationAutoscaling: applicationautoscaling.NewFromConfig(awsCfg),
Autoscaling: autoscaling.NewFromConfig(awsCfg),
Athena: athena.NewFromConfig(awsCfg),
Autoscaling: autoscaling.NewFromConfig(awsCfg),
Backup: backup.NewFromConfig(awsCfg),
Cloudformation: cloudformation.NewFromConfig(awsCfg),
Cloudfront: cloudfront.NewFromConfig(awsCfg),
Cloudtrail: cloudtrail.NewFromConfig(awsCfg),
Cloudwatch: cloudwatch.NewFromConfig(awsCfg),
CloudwatchLogs: cloudwatchlogs.NewFromConfig(awsCfg),
Cloudformation: cloudformation.NewFromConfig(awsCfg),
CognitoIdentityPools: cognitoidentity.NewFromConfig(awsCfg),
CognitoUserPools: cognitoidentityprovider.NewFromConfig(awsCfg),
Codebuild: codebuild.NewFromConfig(awsCfg),
CodePipeline: codepipeline.NewFromConfig(awsCfg),
CognitoIdentityPools: cognitoidentity.NewFromConfig(awsCfg),
CognitoUserPools: cognitoidentityprovider.NewFromConfig(awsCfg),
ConfigService: configservice.NewFromConfig(awsCfg),
DAX: dax.NewFromConfig(awsCfg),
Directconnect: directconnect.NewFromConfig(awsCfg),
Expand All @@ -650,6 +652,8 @@ func initServices(region string, c aws.Config) Services {
Glue: glue.NewFromConfig(awsCfg),
GuardDuty: guardduty.NewFromConfig(awsCfg),
IAM: iam.NewFromConfig(awsCfg),
IOT: iot.NewFromConfig(awsCfg),
Kinesis: kinesis.NewFromConfig(awsCfg),
KMS: kms.NewFromConfig(awsCfg),
Lambda: lambda.NewFromConfig(awsCfg),
Lightsail: lightsail.NewFromConfig(awsCfg),
Expand All @@ -668,13 +672,12 @@ func initServices(region string, c aws.Config) Services {
SES: sesv2.NewFromConfig(awsCfg),
Shield: shield.NewFromConfig(awsCfg),
SNS: sns.NewFromConfig(awsCfg),
SSM: ssm.NewFromConfig(awsCfg),
SQS: sqs.NewFromConfig(awsCfg),
SSM: ssm.NewFromConfig(awsCfg),
Waf: waf.NewFromConfig(awsCfg),
WafV2: wafv2.NewFromConfig(awsCfg),
WafRegional: wafregional.NewFromConfig(awsCfg),
WafV2: wafv2.NewFromConfig(awsCfg),
Workspaces: workspaces.NewFromConfig(awsCfg),
IOT: iot.NewFromConfig(awsCfg),
Xray: xray.NewFromConfig(awsCfg),
}
}
Expand Down
96 changes: 96 additions & 0 deletions client/mocks/kinesis.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 @@ -40,6 +40,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/guardduty"
"github.com/aws/aws-sdk-go-v2/service/iam"
"github.com/aws/aws-sdk-go-v2/service/iot"
"github.com/aws/aws-sdk-go-v2/service/kinesis"
"github.com/aws/aws-sdk-go-v2/service/kms"
"github.com/aws/aws-sdk-go-v2/service/lambda"
"github.com/aws/aws-sdk-go-v2/service/lightsail"
Expand Down Expand Up @@ -752,3 +753,10 @@ type GlueClient interface {
GetWorkflow(ctx context.Context, params *glue.GetWorkflowInput, optFns ...func(*glue.Options)) (*glue.GetWorkflowOutput, error)
ListWorkflows(ctx context.Context, params *glue.ListWorkflowsInput, optFns ...func(*glue.Options)) (*glue.ListWorkflowsOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/kinesis.go . KinesisClient
type KinesisClient interface {
DescribeStreamSummary(ctx context.Context, params *kinesis.DescribeStreamSummaryInput, optFns ...func(*kinesis.Options)) (*kinesis.DescribeStreamSummaryOutput, error)
ListStreams(ctx context.Context, params *kinesis.ListStreamsInput, optFns ...func(*kinesis.Options)) (*kinesis.ListStreamsOutput, error)
ListTagsForStream(ctx context.Context, params *kinesis.ListTagsForStreamInput, optFns ...func(*kinesis.Options)) (*kinesis.ListTagsForStreamOutput, error)
}
8 changes: 8 additions & 0 deletions docs/tables/aws_kinesis_stream_enhanced_monitoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Table: aws_kinesis_stream_enhanced_monitoring
Represents enhanced metrics types
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|stream_cq_id|uuid|Unique CloudQuery ID of aws_kinesis_streams table (FK)|
|shard_level_metrics|text[]|List of shard-level metrics|
20 changes: 20 additions & 0 deletions docs/tables/aws_kinesis_streams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# Table: aws_kinesis_streams
Represents the output for DescribeStreamSummary
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|account_id|text|The AWS Account ID of the resource.|
|region|text|The AWS Region of the resource.|
|arn|text||
|tags|jsonb||
|open_shard_count|bigint|The number of open shards in the stream|
|retention_period_hours|bigint|The current retention period, in hours|
|stream_arn|text|The Amazon Resource Name (ARN) for the stream being described|
|stream_creation_timestamp|timestamp without time zone|The approximate time that the stream was created|
|stream_name|text|The name of the stream being described|
|stream_status|text|The current status of the stream being described|
|consumer_count|bigint|The number of enhanced fan-out consumers registered with the stream|
|encryption_type|text|The encryption type used|
|key_id|text|The GUID for the customer-managed Amazon Web Services KMS key to use for encryption|
|stream_mode_details_stream_mode|text|Specifies the capacity mode to which you want to set your data stream Currently, in Kinesis Data Streams, you can choose between an on-demand capacity mode and a provisioned capacity mode for your data streams|
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/guardduty v1.14.1
github.com/aws/aws-sdk-go-v2/service/iam v1.18.8
github.com/aws/aws-sdk-go-v2/service/iot v1.25.4
github.com/aws/aws-sdk-go-v2/service/kinesis v1.15.9
github.com/aws/aws-sdk-go-v2/service/kms v1.17.4
github.com/aws/aws-sdk-go-v2/service/lambda v1.23.3
github.com/aws/aws-sdk-go-v2/service/lightsail v1.22.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8 h1:TlN1UC39A0LUNo
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8/go.mod h1:JlVwmWtT/1c5W+6oUsjXjAJ0iJZ+hlghdrDy/8JxGCU=
github.com/aws/aws-sdk-go-v2/service/iot v1.25.4 h1:YdzNOk/XivKEy7kzzueBaRZXo/RCk/SynVCsTiBXONs=
github.com/aws/aws-sdk-go-v2/service/iot v1.25.4/go.mod h1:hdlTEkjkAb2t0TjAC5yNS5EM4N+qX08FyVlkAD3+sCc=
github.com/aws/aws-sdk-go-v2/service/kinesis v1.15.9 h1:eaELb1vnxNsycqR+HQTz77MKxHAGqypKT3jeAWO3fCs=
github.com/aws/aws-sdk-go-v2/service/kinesis v1.15.9/go.mod h1:+aOem7gsXvQM0RmNhF+kR0PLgfR/vKoeJWxmCn19ZC8=
github.com/aws/aws-sdk-go-v2/service/kms v1.17.4 h1:5NKN9OaBjXa6WiLaC7W2qRccJRE2D6rTzBRavswtae8=
github.com/aws/aws-sdk-go-v2/service/kms v1.17.4/go.mod h1:Q4PYKLlbDackWmZYMvdNLtGIY1I1k4xUpLQzzPXIx4c=
github.com/aws/aws-sdk-go-v2/service/lambda v1.23.3 h1:2OCxVGkVJ6zn/sm0eKRnz54VrV7AeTlbWjpU7dzIg78=
Expand Down
Loading

0 comments on commit 767bfab

Please sign in to comment.