Skip to content

Commit

Permalink
Merge branch 'main' into fix-resource-op-codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbotsf authored Apr 19, 2024
2 parents 27cb77d + f065291 commit 7e7db6f
Show file tree
Hide file tree
Showing 65 changed files with 25,602 additions and 12,936 deletions.
5 changes: 5 additions & 0 deletions .changes/14eca09d-0ee6-45f3-a758-5e5b2ac471f0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "14eca09d-0ee6-45f3-a758-5e5b2ac471f0",
"type": "feature",
"description": "Customize S3's `Expires` field, including adding a new `ExpiresString` field for output types."
}
8 changes: 8 additions & 0 deletions .changes/7699105e-2f52-4239-abff-631aa6dba005.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "7699105e-2f52-4239-abff-631aa6dba005",
"type": "bugfix",
"description": "Service client based identity providers now respect AWS_ENDPOINT_URL_SERVICE environment variables",
"issues": [
"awslabs/aws-sdk-kotlin#1210"
]
}
85 changes: 85 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,90 @@
# Changelog

## [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
* (**cloudformation**) Adding support for the new parameter "IncludePropertyValues" in the CloudFormation DescribeChangeSet API. When this parameter is included, the DescribeChangeSet response will include more detailed information such as before and after values for the resource properties that will change.
* (**glue**) Modifying request for GetUnfilteredTableMetadata for view-related fields.
* (**healthlake**) Added new CREATE_FAILED status for data stores. Added new errorCause to DescribeFHIRDatastore API and ListFHIRDatastores API response for additional insights into data store creation and deletion workflows.
* (**kms**) This feature supports the ability to specify a custom rotation period for automatic key rotations, the ability to perform on-demand key rotations, and visibility into your key material rotations.
* (**mediatailor**) Added InsertionMode to PlaybackConfigurations. This setting controls whether players can use stitched or guided ad insertion. The default for players that do not specify an insertion mode is stitched.
* (**outposts**) This release adds EXPEDITORS as a valid shipment carrier.
* (**redshift**) Adds support for Amazon Redshift DescribeClusterSnapshots API to include Snapshot ARN response field.
* (**transfer**) This change releases support for importing self signed certificates to the Transfer Family for sending outbound file transfers over TLS/HTTPS.

### Documentation
* (**configservice**) Updates documentation for AWS Config
* (**iotfleethub**) Documentation updates for AWS IoT Fleet Hub to clarify that Fleet Hub supports organization instance of IAM Identity Center.
* (**neptunegraph**) Update to API documentation to resolve customer reported issues.

## [1.1.17] - 04/11/2024

### Features
* (**batch**) This release adds the task properties field to attempt details and the name field on EKS container detail.
* (**cloudfront**) CloudFront origin access control extends support to AWS Lambda function URLs and AWS Elemental MediaPackage v2 origins.
* (**cloudwatch**) This release adds support for Metric Characteristics for CloudWatch Anomaly Detection. Anomaly Detector now takes Metric Characteristics object with Periodic Spikes boolean field that tells Anomaly Detection that spikes that repeat at the same time every week are part of the expected pattern.
* (**iam**) For CreateOpenIDConnectProvider API, the ThumbprintList parameter is no longer required.
* (**medialive**) AWS Elemental MediaLive introduces workflow monitor, a new feature that enables the visualization and monitoring of your media workflows. Create signal maps of your existing workflows and monitor them by creating notification and monitoring template groups.
* (**omics**) This release adds support for retrieval of S3 direct access metadata on sequence stores and read sets, and adds support for SHA256up and SHA512up HealthOmics ETags.
* (**pipes**) LogConfiguration ARN validation fixes
* (**wafv2**) Adds an updated version of smoke tests, including smithy trait, for SDK testing.

### Documentation
* (**codebuild**) Support access tokens for Bitbucket sources
* (**rds**) Updates Amazon RDS documentation for Standard Edition 2 support in RDS Custom for Oracle.
* (**s3control**) Documentation updates for Amazon S3-control.

## [1.1.16] - 04/10/2024

### Features
* (**cleanrooms**) AWS Clean Rooms Differential Privacy is now fully available. Differential privacy protects against user-identification attempts.
* (**connect**) This release adds new Submit Auto Evaluation Action for Amazon Connect Rules.
* (**qconnect**) This release adds a new QiC public API updateSession and updates an existing QiC public API createSession
* (**rekognition**) Added support for ContentType to content moderation detections.
* (**supplychain**) This release includes API SendDataIntegrationEvent for AWS Supply Chain
* (**workspacesthinclient**) Adding tags field to SoftwareSet. Removing tags fields from Summary objects. Changing the list of exceptions in tagging APIs. Fixing an issue where the SDK returns empty tags in Get APIs.

### Documentation
* (**networkmonitor**) Examples were added to CloudWatch Network Monitor commands.

## [1.1.15] - 04/09/2024

### Features
* (**codebuild**) Add new webhook filter types for GitHub webhooks
* (**mediaconvert**) This release includes support for bringing your own fonts to use for burn-in or DVB-Sub captioning workflows.
* (**pinpoint**) The OrchestrationSendingRoleArn has been added to the email channel and is used to send emails from campaigns or journeys.
* (**rds**) This release adds support for specifying the CA certificate to use for the new db instance when restoring from db snapshot, restoring from s3, restoring to point in time, and creating a db instance read replica.

## [1.1.13] - 04/05/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
@@ -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 7e7db6f

Please sign in to comment.