Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destination-s3: convert prod code to kotlin #40574

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: file
connectorType: destination
definitionId: 4816b78f-1489-44c1-9060-4b19d5fa9362
dockerImageTag: 0.6.2
dockerImageTag: 0.6.3
dockerRepository: airbyte/destination-s3
githubIssueLabel: destination-s3
icon: s3.svg
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination.s3

import com.google.common.annotations.VisibleForTesting
import io.airbyte.cdk.integrations.base.IntegrationRunner
import io.airbyte.cdk.integrations.destination.s3.BaseS3Destination
import io.airbyte.cdk.integrations.destination.s3.S3DestinationConfigFactory
import io.airbyte.cdk.integrations.destination.s3.StorageProvider

open class S3Destination : BaseS3Destination {
constructor()

@VisibleForTesting
constructor(
s3DestinationConfigFactory: S3DestinationConfigFactory,
env: Map<String, String>
) : super(s3DestinationConfigFactory, env)

override fun storageProvider(): StorageProvider {
return StorageProvider.AWS_S3
}

companion object {
@Throws(Exception::class)
@JvmStatic
fun main(args: Array<String>) {
IntegrationRunner(S3Destination()).run(args)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination.s3

import io.airbyte.cdk.integrations.base.adaptive.AdaptiveDestinationRunner.baseOnEnv

object S3DestinationRunner {
@Throws(Exception::class)
@JvmStatic
fun main(args: Array<String>) {
baseOnEnv()
.withOssDestination { S3Destination() }
.withCloudDestination { S3DestinationStrictEncrypt() }
.run(args)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination.s3

import com.fasterxml.jackson.databind.JsonNode
import com.google.common.annotations.VisibleForTesting
import io.airbyte.cdk.integrations.destination.s3.S3BaseChecks.testCustomEndpointSecured
import io.airbyte.cdk.integrations.destination.s3.S3DestinationConfigFactory
import io.airbyte.protocol.models.v0.AirbyteConnectionStatus

class S3DestinationStrictEncrypt : S3Destination {
constructor() : super()

@VisibleForTesting
constructor(
configFactory: S3DestinationConfigFactory,
environment: Map<String, String>
) : super(configFactory, environment)

override fun check(config: JsonNode): AirbyteConnectionStatus? {
val destinationConfig =
configFactory.getS3DestinationConfig(config, super.storageProvider(), super.environment)

// Fails early to avoid extraneous validations checks if custom endpoint is not secure
if (!testCustomEndpointSecured(destinationConfig.endpoint)) {
return AirbyteConnectionStatus()
.withStatus(AirbyteConnectionStatus.Status.FAILED)
.withMessage("Custom endpoint does not use HTTPS")
}
return super.check(config)
}
}
1 change: 1 addition & 0 deletions docs/integrations/destinations/s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ To see connector limitations, or troubleshoot your S3 connector, see more [in ou

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :--------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0.6.3 | 2024-04-15 | [38204](https://github.com/airbytehq/airbyte/pull/38204) | convert all production code to kotlin |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr id is 40574?

| 0.6.2 | 2024-04-15 | [38204](https://github.com/airbytehq/airbyte/pull/38204) | add assume role auth |
| 0.6.1 | 2024-04-08 | [37546](https://github.com/airbytehq/airbyte/pull/37546) | Adapt to CDK 0.30.8; |
| 0.6.0 | 2024-04-08 | [36869](https://github.com/airbytehq/airbyte/pull/36869) | Adapt to CDK 0.29.8; Kotlin converted code. |
Expand Down
Loading