Skip to content

Commit

Permalink
feat: Add transfer servers (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
irmatov committed Aug 17, 2022
1 parent 63887e7 commit a3bf2bf
Show file tree
Hide file tree
Showing 11 changed files with 530 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/source/aws/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/aws/aws-sdk-go-v2/service/ssm"
"github.com/aws/aws-sdk-go-v2/service/sts"
"github.com/aws/aws-sdk-go-v2/service/transfer"
"github.com/aws/aws-sdk-go-v2/service/waf"
"github.com/aws/aws-sdk-go-v2/service/wafregional"
"github.com/aws/aws-sdk-go-v2/service/wafv2"
Expand Down Expand Up @@ -190,6 +191,7 @@ type Services struct {
SNS SnsClient
SQS SQSClient
SSM SSMClient
Transfer TransferClient
Waf WafClient
WafRegional WafRegionalClient
WafV2 WafV2Client
Expand Down Expand Up @@ -695,6 +697,7 @@ func initServices(region string, c aws.Config) Services {
SNS: sns.NewFromConfig(awsCfg),
SQS: sqs.NewFromConfig(awsCfg),
SSM: ssm.NewFromConfig(awsCfg),
Transfer: transfer.NewFromConfig(awsCfg),
Waf: waf.NewFromConfig(awsCfg),
WafRegional: wafregional.NewFromConfig(awsCfg),
WafV2: wafv2.NewFromConfig(awsCfg),
Expand Down
96 changes: 96 additions & 0 deletions plugins/source/aws/client/mocks/transfer.go

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

8 changes: 8 additions & 0 deletions plugins/source/aws/client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/sns"
"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/aws/aws-sdk-go-v2/service/ssm"
"github.com/aws/aws-sdk-go-v2/service/transfer"
"github.com/aws/aws-sdk-go-v2/service/waf"
"github.com/aws/aws-sdk-go-v2/service/wafregional"
"github.com/aws/aws-sdk-go-v2/service/wafv2"
Expand Down Expand Up @@ -853,3 +854,10 @@ type XrayClient interface {
GetGroups(ctx context.Context, params *xray.GetGroupsInput, optFns ...func(*xray.Options)) (*xray.GetGroupsOutput, error)
ListTagsForResource(ctx context.Context, params *xray.ListTagsForResourceInput, optFns ...func(*xray.Options)) (*xray.ListTagsForResourceOutput, error)
}

//go:generate mockgen -package=mocks -destination=./mocks/transfer.go . TransferClient
type TransferClient interface {
DescribeServer(ctx context.Context, params *transfer.DescribeServerInput, optFns ...func(*transfer.Options)) (*transfer.DescribeServerOutput, error)
ListServers(ctx context.Context, params *transfer.ListServersInput, optFns ...func(*transfer.Options)) (*transfer.ListServersOutput, error)
ListTagsForResource(ctx context.Context, params *transfer.ListTagsForResourceInput, optFns ...func(*transfer.Options)) (*transfer.ListTagsForResourceOutput, error)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Table: aws_transfer_server_workflow_details_on_upload
Specifies the workflow ID for the workflow to assign and the execution role that's used for executing the workflow
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|server_cq_id|uuid|Unique CloudQuery ID of aws_transfer_servers table (FK)|
|execution_role|text|Includes the necessary permissions for S3, EFS, and Lambda operations that Transfer can assume, so that all workflow steps can operate on the required resources|
|workflow_id|text|A unique identifier for the workflow|
36 changes: 36 additions & 0 deletions plugins/source/aws/docs/tables/aws_transfer_servers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

# Table: aws_transfer_servers
Describes the properties of a file transfer protocol-enabled server that was specified
## Columns
| Name | Type | Description |
| ------------- | ------------- | ----- |
|account_id|text|The AWS Account ID of the resource.|
|region|text|The AWS Region of the resource.|
|arn|text|Specifies the unique Amazon Resource Name (ARN) of the server|
|certificate|text|Specifies the ARN of the Amazon Web ServicesCertificate Manager (ACM) certificate|
|domain|text|Specifies the domain of the storage system that is used for file transfers|
|endpoint_details_address_allocation_ids|text[]|A list of address allocation IDs that are required to attach an Elastic IP address to your server's endpoint|
|endpoint_details_security_group_ids|text[]|A list of security groups IDs that are available to attach to your server's endpoint|
|endpoint_details_subnet_ids|text[]|A list of subnet IDs that are required to host your server endpoint in your VPC This property can only be set when EndpointType is set to VPC|
|endpoint_details_vpc_endpoint_id|text|The ID of the VPC endpoint|
|endpoint_details_vpc_id|text|The VPC ID of the VPC in which a server's endpoint will be hosted|
|endpoint_type|text|Defines the type of endpoint that your server is connected to|
|host_key_fingerprint|text|Specifies the Base64-encoded SHA256 fingerprint of the server's host key|
|identity_provider_details_directory_id|text|The identifier of the Directory Service directory that you want to stop sharing|
|identity_provider_details_function|text|The ARN for a lambda function to use for the Identity provider|
|identity_provider_details_invocation_role|text|Provides the type of InvocationRole used to authenticate the user account|
|identity_provider_details_url|text|Provides the location of the service endpoint used to authenticate users|
|identity_provider_type|text|The mode of authentication for a server|
|logging_role|text|The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role that allows a server to turn on Amazon CloudWatch logging for Amazon S3 or Amazon EFSevents|
|post_authentication_login_banner|text|Specifies a string to display when users connect to a server|
|pre_authentication_login_banner|text|Specifies a string to display when users connect to a server|
|protocol_details_as2_transports|text[]|Indicates the transport method for the AS2 messages|
|protocol_details_passive_ip|text|Indicates passive mode, for FTP and FTPS protocols|
|protocol_details_set_stat_option|text|Use the SetStatOption to ignore the error that is generated when the client attempts to use SETSTAT on a file you are uploading to an S3 bucket|
|protocol_details_tls_session_resumption_mode|text|A property used with Transfer Family servers that use the FTPS protocol|
|protocols|text[]|Specifies the file transfer protocol or protocols over which your file transfer protocol client can connect to your server's endpoint|
|security_policy_name|text|Specifies the name of the security policy that is attached to the server|
|server_id|text|Specifies the unique system-assigned identifier for a server that you instantiate|
|state|text|The condition of the server that was described|
|tags|jsonb|Specifies the key-value pairs that you can use to search for and group servers that were assigned to the server that was described|
|user_count|bigint|Specifies the number of users that are assigned to a server you specified with the ServerId|
1 change: 1 addition & 0 deletions plugins/source/aws/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8 // indirect
github.com/aws/aws-sdk-go-v2/service/shield v1.16.7
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 // indirect
github.com/aws/aws-sdk-go-v2/service/transfer v1.21.4
github.com/aws/aws-sdk-go-v2/service/wafregional v1.12.8
github.com/creasty/defaults v1.6.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions plugins/source/aws/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 h1:760bUnTX/+d693FT6T6Oa7PZHfE
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12/go.mod h1:MO4qguFjs3wPGcCSpQ7kOFTwRvb+eu+fn+1vKleGHUk=
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9 h1:yOfILxyjmtr2ubRkRJldlHDFBhf5vw4CzhbwWIBmimQ=
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9/go.mod h1:O1IvkYxr+39hRf960Us6j0x1P8pDqhTX+oXM5kQNl/Y=
github.com/aws/aws-sdk-go-v2/service/transfer v1.21.4 h1:TJvBFIo2maBRHnyVhd1x+2XyTFgJeHzH2WHThbBPN8E=
github.com/aws/aws-sdk-go-v2/service/transfer v1.21.4/go.mod h1:/v7FvwtZJmPQfIQfv1mnjuj1vNRsBKIKgK41gdoUzNM=
github.com/aws/aws-sdk-go-v2/service/waf v1.11.7 h1:Hg4o1j5DumR91B/GrvbUg2NxuLRewp0uBel0CFN5eBI=
github.com/aws/aws-sdk-go-v2/service/waf v1.11.7/go.mod h1:Goy0jitMyqpo7yGfeySAcDH4blxnxh69uUk+BgMQce8=
github.com/aws/aws-sdk-go-v2/service/wafregional v1.12.8 h1:rzATeAkJzOPuu6cTaH1V8RoK4sy9CCylOqpxBI4vpGk=
Expand Down
2 changes: 2 additions & 0 deletions plugins/source/aws/resources/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import (
"github.com/cloudquery/cloudquery/plugins/source/aws/resources/services/sns"
"github.com/cloudquery/cloudquery/plugins/source/aws/resources/services/sqs"
"github.com/cloudquery/cloudquery/plugins/source/aws/resources/services/ssm"
"github.com/cloudquery/cloudquery/plugins/source/aws/resources/services/transfer"
"github.com/cloudquery/cloudquery/plugins/source/aws/resources/services/waf"
"github.com/cloudquery/cloudquery/plugins/source/aws/resources/services/wafregional"
"github.com/cloudquery/cloudquery/plugins/source/aws/resources/services/wafv2"
Expand Down Expand Up @@ -285,6 +286,7 @@ func Provider() *provider.Provider {
"ssm.documents": ssm.SsmDocuments(),
"ssm.instances": ssm.SsmInstances(),
"ssm.parameters": ssm.Parameters(),
"transfer.servers": transfer.Servers(),
"waf.rule_groups": waf.WafRuleGroups(),
"waf.rules": waf.WafRules(),
"waf.subscribed_rule_groups": waf.WafSubscribedRuleGroups(),
Expand Down

0 comments on commit a3bf2bf

Please sign in to comment.