Skip to content

Commit

Permalink
Merge branch 'awslabs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
0marperez authored Apr 22, 2024
2 parents 1906bae + 51cc3cf commit 4af6194
Show file tree
Hide file tree
Showing 44 changed files with 10,990 additions and 1,020 deletions.
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Changelog

## [1.1.23] - 04/22/2024

### Features
* (**bedrockagent**) Releasing the support for simplified configuration and return of control
* (**bedrockagentruntime**) Releasing the support for simplified configuration and return of control
* (**paymentcryptography**) Adding support to TR-31/TR-34 exports for optional headers, allowing customers to add additional metadata (such as key version and KSN) when exporting keys from the service.
* (**route53profiles**) Route 53 Profiles allows you to apply a central DNS configuration across many VPCs regardless of account.
* (**sagemaker**) This release adds support for Real-Time Collaboration and Shared Space for JupyterLab App on SageMaker Studio.
* (**transfer**) Adding new API to support remote directory listing using SFTP connector

### Fixes
* [#900](https://github.com/awslabs/aws-sdk-kotlin/issues/900) Correctly generate presigners, waiters, and paginators for resource operations

### Documentation
* (**redshiftserverless**) Updates description of schedule field for scheduled actions.
* (**servicediscovery**) This release adds examples to several Cloud Map actions.

## [1.1.22] - 04/19/2024

### Features
* (**glue**) Adding RowFilter in the response for GetUnfilteredTableMetadata API
* (**internetmonitor**) This update introduces the GetInternetEvent and ListInternetEvents APIs, which provide access to internet events displayed on the Amazon CloudWatch Internet Weather Map.
* (**personalize**) This releases auto training capability while creating a solution and automatically syncing latest solution versions when creating/updating a campaign
* Customize S3's `Expires` field, including adding a new `ExpiresString` field for output types.

### Fixes
* [#1210](https://github.com/awslabs/aws-sdk-kotlin/issues/1210) Service client based identity providers now respect AWS_ENDPOINT_URL_SERVICE environment variables

## [1.1.21] - 04/18/2024

### Features
* (**drs**) Outpost ARN added to Source Server and Recovery Instance
* (**emrserverless**) This release adds the capability to publish detailed Spark engine metrics to Amazon Managed Service for Prometheus (AMP) for enhanced monitoring for Spark jobs.
* (**guardduty**) Added IPv6Address fields for local and remote IP addresses
* (**quicksight**) This release adds support for the Cross Sheet Filter and Control features, and support for warnings in asset imports for any permitted errors encountered during execution
* (**rolesanywhere**) This release introduces the PutAttributeMapping and DeleteAttributeMapping APIs. IAM Roles Anywhere now provides the capability to define a set of mapping rules, allowing customers to specify which data is extracted from their X.509 end-entity certificates.
* (**sagemaker**) Removed deprecated enum values and updated API documentation.
* (**workspaces**) Adds new APIs for managing and sharing WorkSpaces BYOL configuration across accounts.

## [1.1.20] - 04/17/2024

### Features
* (**ec2**) Documentation updates for Elastic Compute Cloud (EC2).
* (**qbusiness**) This release adds support for IAM Identity Center (IDC) as the identity gateway for Q Business. It also allows users to provide an explicit intent for Q Business to identify how the Chat request should be handled.

## [1.1.19] - 04/16/2024

### Features
* (**bedrockagent**) For Create Agent API, the agentResourceRoleArn parameter is no longer required.
* (**emrserverless**) This release adds support for shuffle optimized disks that allow larger disk sizes and higher IOPS to efficiently run shuffle heavy workloads.
* (**entityresolution**) Cross Account Resource Support .
* (**iotwireless**) Add PublicGateways in the GetWirelessStatistics call response, indicating the LoRaWAN public network accessed by the device.
* (**lakeformation**) This release adds Lake Formation managed RAM support for the 4 APIs - "DescribeLakeFormationIdentityCenterConfiguration", "CreateLakeFormationIdentityCenterConfiguration", "DescribeLakeFormationIdentityCenterConfiguration", and "DeleteLakeFormationIdentityCenterConfiguration"
* (**m2**) Adding new ListBatchJobRestartPoints API and support for restart batch job.
* (**mediapackagev2**) Dash v2 is a MediaPackage V2 feature to support egressing on DASH manifest format.
* (**outposts**) This release adds new APIs to allow customers to configure their Outpost capacity at order-time.
* (**wellarchitected**) AWS Well-Architected now has a Connector for Jira to allow customers to efficiently track workload risks and improvement efforts and create closed-loop mechanisms.

## [1.1.18] - 04/12/2024

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class SsoCredentialsProvider public constructor(
}

val telemetry = coroutineContext.telemetryProvider
val client = SsoClient {
val client = SsoClient.fromEnvironment {
region = ssoRegion
httpClient = this@SsoCredentialsProvider.httpClient
telemetryProvider = telemetry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public class SsoTokenProvider(

private suspend fun refreshToken(oldToken: SsoToken): SsoToken {
val telemetry = coroutineContext.telemetryProvider
SsoOidcClient {
SsoOidcClient.fromEnvironment {
region = ssoRegion
httpClient = this@SsoTokenProvider.httpClient
telemetryProvider = telemetry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public class StsAssumeRoleCredentialsProvider(
// NOTE: multi region access points require regional STS endpoints
val provider = this
val telemetry = coroutineContext.telemetryProvider
val client = StsClient {
val client = StsClient.fromEnvironment {
region = provider.region ?: GLOBAL_STS_PARTITION_ENDPOINT
credentialsProvider = provider.bootstrapCredentialsProvider
httpClient = provider.httpClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public class StsWebIdentityCredentialsProvider(

val telemetry = coroutineContext.telemetryProvider

val client = StsClient {
val client = StsClient.fromEnvironment {
region = provider.region
httpClient = provider.httpClient
// NOTE: credentials provider not needed for this operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import software.amazon.smithy.kotlin.codegen.rendering.endpoints.EndpointResolve
import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpBindingResolver
import software.amazon.smithy.kotlin.codegen.rendering.serde.serializerName
import software.amazon.smithy.model.knowledge.TopDownIndex
import software.amazon.smithy.model.shapes.OperationShape
import software.amazon.smithy.model.shapes.ServiceShape
import software.amazon.smithy.model.shapes.ShapeId
Expand Down Expand Up @@ -66,8 +67,9 @@ class PresignerGenerator : KotlinIntegration {
val sig4vTrait = service.getTrait<SigV4Trait>() ?: return

// Scan model for operations decorated with PresignTrait
val presignOperations = service.allOperations
.map { ctx.model.expectShape<OperationShape>(it) }
val presignOperations = TopDownIndex
.of(ctx.model)
.getContainedOperations(service)
.filter { it.hasTrait(Presignable.ID) }
.map { operationShape ->
check(AwsSignatureVersion4.hasSigV4AuthScheme(ctx.model, service, operationShape)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.sdk.kotlin.codegen.customization.s3

import software.amazon.smithy.kotlin.codegen.KotlinSettings
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
import software.amazon.smithy.kotlin.codegen.model.*
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolMiddleware
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.shapes.*
import software.amazon.smithy.model.traits.DeprecatedTrait
import software.amazon.smithy.model.traits.DocumentationTrait
import software.amazon.smithy.model.traits.HttpHeaderTrait
import software.amazon.smithy.model.traits.OutputTrait
import software.amazon.smithy.model.transform.ModelTransformer
import kotlin.streams.asSequence

/**
* An integration used to customize behavior around S3's members named `Expires`.
*/
class S3ExpiresIntegration : KotlinIntegration {
override fun enabledForService(model: Model, settings: KotlinSettings) =
model.expectShape<ServiceShape>(settings.service).isS3 && model.shapes<OperationShape>().any { it.hasExpiresMember(model) }

override fun preprocessModel(model: Model, settings: KotlinSettings): Model {
val transformer = ModelTransformer.create()

// Ensure all `Expires` shapes are timestamps
val expiresShapeTimestampMap = model.shapes()
.asSequence()
.mapNotNull { shape ->
shape.members()
.singleOrNull { member -> member.memberName.equals("Expires", ignoreCase = true) }
?.target
}
.associateWith { ShapeType.TIMESTAMP }

var transformedModel = transformer.changeShapeType(model, expiresShapeTimestampMap)

// Add an `ExpiresString` string shape to the model
val expiresString = StringShape.builder()
expiresString.id("aws.sdk.kotlin.s3.synthetic#ExpiresString")
transformedModel = transformedModel.toBuilder().addShape(expiresString.build()).build()

// For output shapes only, deprecate `Expires` and add a synthetic member that targets `ExpiresString`
return transformer.mapShapes(transformedModel) { shape ->
if (shape.hasTrait<OutputTrait>() && shape.memberNames.any { it.equals("Expires", ignoreCase = true) }) {
val builder = (shape as StructureShape).toBuilder()

// Deprecate `Expires`
val expiresMember = shape.members().single { it.memberName.equals("Expires", ignoreCase = true) }

builder.removeMember(expiresMember.memberName)
val deprecatedTrait = DeprecatedTrait.builder()
.message("Please use `expiresString` which contains the raw, unparsed value of this field.")
.build()

builder.addMember(
expiresMember.toBuilder()
.addTrait(deprecatedTrait)
.build(),
)

// Add a synthetic member targeting `ExpiresString`
val expiresStringMember = MemberShape.builder()
expiresStringMember.target(expiresString.id)
expiresStringMember.id(expiresMember.id.toString() + "String") // i.e. com.amazonaws.s3.<MEMBER_NAME>$ExpiresString
expiresStringMember.addTrait(HttpHeaderTrait("ExpiresString")) // Add HttpHeaderTrait to ensure the field is deserialized
expiresMember.getTrait<DocumentationTrait>()?.let {
expiresStringMember.addTrait(it) // Copy documentation from `Expires`
}
builder.addMember(expiresStringMember.build())
builder.build()
} else {
shape
}
}
}

override fun customizeMiddleware(
ctx: ProtocolGenerator.GenerationContext,
resolved: List<ProtocolMiddleware>,
): List<ProtocolMiddleware> = resolved + applyExpiresFieldInterceptor

internal val applyExpiresFieldInterceptor = object : ProtocolMiddleware {
override val name: String = "ExpiresFieldInterceptor"

override fun isEnabledFor(ctx: ProtocolGenerator.GenerationContext, op: OperationShape): Boolean =
ctx.model.expectShape<ServiceShape>(ctx.settings.service).isS3 && op.hasExpiresMember(ctx.model)

override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape, writer: KotlinWriter) {
val interceptorSymbol = buildSymbol {
name = "ExpiresFieldInterceptor"
namespace = ctx.settings.pkg.subpackage("internal")
}

writer.write("op.interceptors.add(#T)", interceptorSymbol)
}
}

private fun OperationShape.hasExpiresMember(model: Model): Boolean {
val input = model.expectShape(this.inputShape)
val output = model.expectShape(this.outputShape)

return (input.memberNames + output.memberNames).any {
it.equals("Expires", ignoreCase = true)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ aws.sdk.kotlin.codegen.customization.SigV4AsymmetricTraitCustomization
aws.sdk.kotlin.codegen.customization.cloudfrontkeyvaluestore.BackfillSigV4ACustomization
aws.sdk.kotlin.codegen.customization.s3.express.SigV4S3ExpressAuthSchemeIntegration
aws.sdk.kotlin.codegen.customization.s3.express.S3ExpressIntegration
aws.sdk.kotlin.codegen.customization.s3.S3ExpiresIntegration
Loading

0 comments on commit 4af6194

Please sign in to comment.