-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bulk Load CDK: AWS/S3 Configuration mix-ins, and noop S3V2 usage (#46744
- Loading branch information
1 parent
19f556f
commit 46206e3
Showing
12 changed files
with
300 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dependencies { | ||
implementation project(':airbyte-cdk:bulk:core:bulk-cdk-core-base') | ||
implementation project(':airbyte-cdk:bulk:core:bulk-cdk-core-load') | ||
} |
44 changes: 44 additions & 0 deletions
44
...its/load-aws/src/main/kotlin/io/airbyte/cdk/load/command/aws/AWSAccessKeySpecification.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.load.command.aws | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription | ||
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaInject | ||
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle | ||
|
||
/** | ||
* Mix-in to a configuration to add AWS access key id and secret access key fields as properties. | ||
* | ||
* See [io.airbyte.cdk.load.command.DestinationConfiguration] for more details on how to use this | ||
* interface. | ||
*/ | ||
interface AWSAccessKeySpecification { | ||
@get:JsonSchemaTitle("S3 Key ID") | ||
@get:JsonPropertyDescription( | ||
"The access key ID to access the S3 bucket. Airbyte requires Read and Write permissions to the given bucket. Read more <a href=\"https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys\">here</a>." | ||
) | ||
@get:JsonProperty("access_key_id") | ||
@get:JsonSchemaInject(json = """{"examples":["A012345678910EXAMPLE"]}""") | ||
val accessKeyId: String | ||
|
||
@get:JsonSchemaTitle("S3 Access Key") | ||
@get:JsonPropertyDescription( | ||
"The corresponding secret to the access key ID. Read more <a href=\"https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys\">here</a>" | ||
) | ||
@get:JsonProperty("secret_access_key") | ||
@get:JsonSchemaInject(json = """{"examples":["a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY"]}""") | ||
val secretAccessKey: String | ||
|
||
fun toAWSAccessKeyConfiguration(): AWSAccessKeyConfiguration { | ||
return AWSAccessKeyConfiguration(accessKeyId, secretAccessKey) | ||
} | ||
} | ||
|
||
data class AWSAccessKeyConfiguration(val accessKeyId: String, val secretAccessKey: String) | ||
|
||
interface AWSAccessKeyConfigurationProvider { | ||
val awsAccessKeyConfiguration: AWSAccessKeyConfiguration | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
dependencies { | ||
implementation project(':airbyte-cdk:bulk:core:bulk-cdk-core-base') | ||
implementation project(':airbyte-cdk:bulk:core:bulk-cdk-core-load') | ||
implementation project(':airbyte-cdk:bulk:toolkits:bulk-cdk-toolkit-load-aws') | ||
|
||
implementation("aws.sdk.kotlin:s3:1.0.0") | ||
} |
92 changes: 92 additions & 0 deletions
92
.../toolkits/load-s3/src/main/kotlin/io/airbyte/cdk/load/command/s3/S3BucketSpecification.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.load.command.s3 | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription | ||
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaInject | ||
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle | ||
|
||
enum class S3BucketRegion { | ||
`af-south-1`, | ||
`ap-east-1`, | ||
`ap-northeast-1`, | ||
`ap-northeast-2`, | ||
`ap-northeast-3`, | ||
`ap-south-1`, | ||
`ap-south-2`, | ||
`ap-southeast-1`, | ||
`ap-southeast-2`, | ||
`ap-southeast-3`, | ||
`ap-southeast-4`, | ||
`ca-central-1`, | ||
`ca-west-1`, | ||
`cn-north-1`, | ||
`cn-northwest-1`, | ||
`eu-central-1`, | ||
`eu-central-2`, | ||
`eu-north-1`, | ||
`eu-south-1`, | ||
`eu-south-2`, | ||
`eu-west-1`, | ||
`eu-west-2`, | ||
`eu-west-3`, | ||
`il-central-1`, | ||
`me-central-1`, | ||
`me-south-1`, | ||
`sa-east-1`, | ||
`us-east-1`, | ||
`us-east-2`, | ||
`us-gov-east-1`, | ||
`us-gov-west-1`, | ||
`us-west-1`, | ||
`us-west-2` | ||
} | ||
|
||
/** | ||
* Mix-in to provide S3 bucket configuration fields as properties. | ||
* | ||
* See [io.airbyte.cdk.load.command.DestinationConfiguration] for more details on how to use this | ||
* interface. | ||
*/ | ||
interface S3BucketSpecification { | ||
@get:JsonSchemaTitle("S3 Bucket Name") | ||
@get:JsonPropertyDescription( | ||
"The name of the S3 bucket. Read more <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html\">here</a>." | ||
) | ||
@get:JsonProperty("s3_bucket_name") | ||
@get:JsonSchemaInject(json = """{"examples":["airbyte_sync"]}""") | ||
val s3BucketName: String | ||
|
||
@get:JsonSchemaTitle("S3 Bucket Region") | ||
@get:JsonPropertyDescription( | ||
"The region of the S3 bucket. See <a href=\"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions\">here</a> for all region codes." | ||
) | ||
@get:JsonProperty("s3_bucket_region", defaultValue = "") | ||
@get:JsonSchemaInject(json = """{"examples":["us-east-1"]}""") | ||
val s3BucketRegion: S3BucketRegion | ||
|
||
@get:JsonSchemaTitle("S3 Endpoint") | ||
@get:JsonPropertyDescription( | ||
"Your S3 endpoint url. Read more <a href=\"https://docs.aws.amazon.com/general/latest/gr/s3.html#:~:text=Service%20endpoints-,Amazon%20S3%20endpoints,-When%20you%20use\">here</a>" | ||
) | ||
@get:JsonProperty("s3_endpoint", defaultValue = "", required = false) | ||
@get:JsonSchemaInject(json = """{"examples":["http://localhost:9000"]}""") | ||
val s3Endpoint: String? | ||
|
||
fun toS3BucketConfiguration(): S3BucketConfiguration { | ||
return S3BucketConfiguration(s3BucketName, s3BucketRegion, s3Endpoint) | ||
} | ||
} | ||
|
||
data class S3BucketConfiguration( | ||
val s3BucketName: String, | ||
val s3BucketRegion: S3BucketRegion, | ||
val s3Endpoint: String? | ||
) | ||
|
||
interface S3BucketConfigurationProvider { | ||
val s3BucketConfiguration: S3BucketConfiguration | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters