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

feat: add support for smithy.protocols#rpcv2Cbor protocol #1336

Merged
merged 16 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
8 changes: 8 additions & 0 deletions .changes/41bdd91a-a58d-47bc-b89d-0e5c334ea6f6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "41bdd91a-a58d-47bc-b89d-0e5c334ea6f6",
"type": "feature",
"description": "Add support for `smithy.protocols#rpcv2Cbor` protocol",
"issues": [
"https://github.com/awslabs/aws-sdk-kotlin/issues/1302"
]
}
1 change: 1 addition & 0 deletions build-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {

implementation(libs.smithy.model)
implementation(libs.smithy.aws.traits)
implementation(libs.smithy.protocol.traits)
implementation(libs.kotlinx.serialization.json)

testImplementation(libs.junit.jupiter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import software.amazon.smithy.aws.traits.protocols.Ec2QueryTrait
import software.amazon.smithy.aws.traits.protocols.RestJson1Trait
import software.amazon.smithy.aws.traits.protocols.RestXmlTrait
import software.amazon.smithy.model.shapes.ServiceShape
import software.amazon.smithy.protocol.traits.Rpcv2CborTrait

private const val DEPRECATED_SHAPES_CUTOFF_DATE: String = "2023-11-28"

Expand Down Expand Up @@ -39,4 +40,5 @@ fun ServiceShape.protocolName(): String =
AwsJson1_1Trait.ID,
AwsQueryTrait.ID,
Ec2QueryTrait.ID,
Rpcv2CborTrait.ID,
).first { hasTrait(it) }.name
54 changes: 1 addition & 53 deletions codegen/sdk/aws-models/cloudwatch.json
lauzadis marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "ConcurrentModificationException",
"httpResponseCode": 429
},
"smithy.api#documentation": "<p>More than one process tried to modify a resource at the same time.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 429
Expand Down Expand Up @@ -664,10 +660,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "InvalidParameterInput",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>Some part of the dashboard data is invalid.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand All @@ -693,10 +685,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "ResourceNotFound",
"httpResponseCode": 404
},
"smithy.api#documentation": "<p>The specified dashboard does not exist.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 404
Expand Down Expand Up @@ -2601,7 +2589,7 @@
"aws.auth#sigv4": {
"name": "monitoring"
},
"aws.protocols#awsQuery": {},
"smithy.protocols#rpcv2Cbor": {},
"smithy.api#documentation": "<p>Amazon CloudWatch monitors your Amazon Web Services (Amazon Web Services) resources and the\n\t\t\tapplications you run on Amazon Web Services in real time. You can use CloudWatch to collect and track\n\t\t\tmetrics, which are the variables you want to measure for your resources and\n\t\t\tapplications.</p>\n <p>CloudWatch alarms send notifications or automatically change the resources you are monitoring based on rules\n\t\t\tthat you define. For example, you can monitor the CPU usage and disk reads and writes of your Amazon EC2\n\t\t\tinstances. Then, use this data to determine whether you should launch\n\t\t\tadditional instances to handle increased load. You can also use this data to stop\n\t\t\tunder-used instances to save\n\t\t\tmoney.</p>\n <p>In addition to monitoring the built-in metrics that come with Amazon Web Services, you can monitor\n\t\t\tyour own custom metrics. With CloudWatch, you gain system-wide visibility into resource\n\t\t\tutilization, application performance, and operational health.</p>",
"smithy.api#title": "Amazon CloudWatch",
"smithy.api#xmlNamespace": {
Expand Down Expand Up @@ -3975,10 +3963,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "InternalServiceError",
"httpResponseCode": 500
},
"smithy.api#documentation": "<p>Request processing has failed due to some unknown error, exception, or failure.</p>",
"smithy.api#error": "server",
"smithy.api#httpError": 500
Expand All @@ -3995,10 +3979,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "InvalidFormat",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>Data was not syntactically valid JSON.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand All @@ -4015,10 +3995,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "InvalidNextToken",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>The next token specified is invalid.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand All @@ -4035,10 +4011,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "InvalidParameterCombination",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>Parameters were used together that cannot be used together.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand All @@ -4055,10 +4027,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "InvalidParameterValue",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>The value of an input parameter is bad or out-of-range.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand Down Expand Up @@ -4089,10 +4057,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "LimitExceededException",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>The operation exceeded one or more limits.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand All @@ -4109,10 +4073,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "LimitExceeded",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>The quota for alarms for this customer has already been reached.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand Down Expand Up @@ -5351,10 +5311,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "MissingParameter",
"httpResponseCode": 400
},
"smithy.api#documentation": "<p>An input parameter that is required is missing.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
Expand Down Expand Up @@ -6199,10 +6155,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "ResourceNotFound",
"httpResponseCode": 404
},
"smithy.api#documentation": "<p>The named resource does not exist.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 404
Expand All @@ -6222,10 +6174,6 @@
}
},
"traits": {
"aws.protocols#awsQueryError": {
"code": "ResourceNotFoundException",
"httpResponseCode": 404
},
"smithy.api#documentation": "<p>The named resource does not exist.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 404
Expand Down
2 changes: 1 addition & 1 deletion codegen/sdk/aws-models/secrets-manager.json
Original file line number Diff line number Diff line change
Expand Up @@ -3638,7 +3638,7 @@
"aws.auth#sigv4": {
"name": "secretsmanager"
},
"aws.protocols#awsJson1_1": {},
"smithy.protocols#rpcv2Cbor": {},
"smithy.api#documentation": "<fullname>Amazon Web Services Secrets Manager</fullname>\n <p>Amazon Web Services Secrets Manager provides a service to enable you to store, manage, and retrieve, secrets.</p>\n <p>This guide provides descriptions of the Secrets Manager API. For more information about using this\n service, see the <a href=\"https://docs.aws.amazon.com/secretsmanager/latest/userguide/introduction.html\">Amazon Web Services Secrets Manager User Guide</a>.</p>\n <p>\n <b>API Version</b>\n </p>\n <p>This version of the Secrets Manager API Reference documents the Secrets Manager API version 2017-10-17.</p>\n <p>For a list of endpoints, see <a href=\"https://docs.aws.amazon.com/secretsmanager/latest/userguide/asm_access.html#endpoints\">Amazon Web Services Secrets Manager \n endpoints</a>.</p>\n <p>\n <b>Support and Feedback for Amazon Web Services Secrets Manager</b>\n </p>\n <p>We welcome your feedback. Send your comments to <a href=\"mailto:[email protected]\">[email protected]</a>, or post your feedback and questions in the <a href=\"http://forums.aws.amazon.com/forum.jspa?forumID=296\">Amazon Web Services Secrets Manager Discussion Forum</a>. For more\n information about the Amazon Web Services Discussion Forums, see <a href=\"http://forums.aws.amazon.com/help.jspa\">Forums\n Help</a>.</p>\n <p>\n <b>Logging API Requests</b>\n </p>\n <p>Amazon Web Services Secrets Manager supports Amazon Web Services CloudTrail, a service that records Amazon Web Services API calls for your Amazon Web Services\n account and delivers log files to an Amazon S3 bucket. By using information that's collected\n by Amazon Web Services CloudTrail, you can determine the requests successfully made to Secrets Manager, who made the\n request, when it was made, and so on. For more about Amazon Web Services Secrets Manager and support for Amazon Web Services\n CloudTrail, see <a href=\"https://docs.aws.amazon.com/secretsmanager/latest/userguide/monitoring.html#monitoring_cloudtrail\">Logging\n Amazon Web Services Secrets Manager Events with Amazon Web Services CloudTrail</a> in the <i>Amazon Web Services Secrets Manager User Guide</i>.\n To learn more about CloudTrail, including enabling it and find your log files, see the <a href=\"https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html\">Amazon Web Services CloudTrail User Guide</a>.</p>",
"smithy.api#title": "AWS Secrets Manager",
"smithy.rules#endpointRuleSet": {
Expand Down
6 changes: 4 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ coroutines-version = "1.7.3"
atomicfu-version = "0.23.1"

# smithy-kotlin codegen and runtime are versioned separately
smithy-kotlin-runtime-version = "1.2.7"
smithy-kotlin-codegen-version = "0.32.7"
smithy-kotlin-runtime-version = "1.2.10-SNAPSHOT"
smithy-kotlin-codegen-version = "0.32.10-SNAPSHOT"

# codegen
smithy-version = "1.49.0"
Expand Down Expand Up @@ -71,6 +71,7 @@ smithy-kotlin-serde = { module = "aws.smithy.kotlin:serde", version.ref = "smith
smithy-kotlin-serde-form-url = { module = "aws.smithy.kotlin:serde-form-url", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-serde-json = { module = "aws.smithy.kotlin:serde-json", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-serde-xml = { module = "aws.smithy.kotlin:serde-xml", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-serde-cbor = { module = "aws.smithy.kotlin:serde-cbor", version.ref = "smithy-kotlin-runtime-version" }
Copy link
Contributor

Choose a reason for hiding this comment

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

question: I don't see this used anywhere, is it necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

No it's not used anywhere, neither is serde-formurl, serde-json, serde-xml. I believe these are all here so that we publish them in our version catalog for ease of consumption for downstream users.

smithy-kotlin-smithy-client = { module = "aws.smithy.kotlin:smithy-client", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-smithy-test = { module = "aws.smithy.kotlin:smithy-test", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-telemetry-api = { module = "aws.smithy.kotlin:telemetry-api", version.ref = "smithy-kotlin-runtime-version" }
Expand All @@ -88,6 +89,7 @@ smithy-cli = { module = "software.amazon.smithy:smithy-cli", version.ref = "smit
smithy-waiters = { module = "software.amazon.smithy:smithy-waiters", version.ref = "smithy-version" }
smithy-aws-endpoints = { module = "software.amazon.smithy:smithy-aws-endpoints", version.ref = "smithy-version" }
smithy-aws-traits = { module = "software.amazon.smithy:smithy-aws-traits", version.ref = "smithy-version" }
smithy-protocol-traits = { module = "software.amazon.smithy:smithy-protocol-traits", version.ref = "smithy-version" }
smithy-aws-protocol-tests = { module = "software.amazon.smithy:smithy-aws-protocol-tests", version.ref = "smithy-version" }
smithy-aws-iam-traits = { module = "software.amazon.smithy:smithy-aws-iam-traits", version.ref = "smithy-version" }
smithy-aws-cloudformation-traits = { module = "software.amazon.smithy:smithy-aws-cloudformation-traits", version.ref = "smithy-version" }
Expand Down