Skip to content

Commit

Permalink
destination-s3: convert prod code to kotlin (#40574)
Browse files Browse the repository at this point in the history
## What
<!--
* Describe what the change is solving. Link all GitHub issues related to this change.
-->

## How
<!--
* Describe how code changes achieve the solution.
-->

## Review guide
<!--
1. `x.py`
2. `y.py`
-->

## User Impact
<!--
* What is the end result perceived by the user?
* If there are negative side effects, please list them. 
-->

## Can this PR be safely reverted and rolled back?
<!--
* If unsure, leave it blank.
-->
- [ ] YES 💚
- [ ] NO ❌
  • Loading branch information
stephane-airbyte authored Jun 27, 2024
1 parent a88d9e8 commit 4b3d780
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 92 deletions.
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 |
| 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

0 comments on commit 4b3d780

Please sign in to comment.