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

[0.10] Rename unsignedPayload and ec2QueryName #286

Merged
merged 1 commit into from
Feb 24, 2020
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Smithy Changelog

## 0.10.0 (2020-??-??)

### Breaking changes

* aws.api#ec2QueryName was renamed to `aws.protocols#ec2QueryName`.
* aws.api#unsignedPayload was renamed to `aws.auth#unsignedPayload` and no longer takes an array of values.
All auth schemes that honor this trait should be considered unsigned when this trait is applied.


## 0.9.7 (2020-01-15)

### Features
Expand Down
72 changes: 70 additions & 2 deletions docs/source/spec/aws-auth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ This document defines AWS authentication schemes.

.. _aws.auth#sigv4-trait:

------------------------
``aws.auth#sigv4`` trait
========================
------------------------

Trait summary
The ``aws.auth#sigv4`` trait adds support for `AWS signature version 4`_
Expand Down Expand Up @@ -78,10 +79,75 @@ Trait value
}


.. _aws.auth#unsignedPayload-trait:

----------------------------------
``aws.auth#unsignedPayload`` trait
----------------------------------

Summary
Indicates that the payload of an operation is not to be part of the
signature computed for the request of an operation.
Trait selector
``operation``
Value type
Annotation trait

Most requests sent to AWS services require that the payload of the request is
signed. However, in some cases, a service that streams large amounts of data
with an unknown size at the time a request is initiated might require that the
payload of a request is not signed.

The following example defines an operation that indicates the payload of the
operation MUST NOT be used as part of the request signature calculation:

.. tabs::

.. code-tab:: smithy

use aws.auth#unsignedPayload

@unsignedPayload
operation PutThings {
input: PutThingsInput,
output: PutThingsOutput
}

.. code-tab:: json

{
"smithy": "0.5.0",
"shapes": {
"smithy.example#PutThings": {
"type": "operation",
"input": {
"target": "smithy.example#PutThingsInput"
},
"output": {
"target": "smithy.example#PutThingsOutput"
},
"traits": {
"aws.auth#unsignedPayload": true
}
}
}
}


Unsigned Payloads and signature version 4
=========================================

Using an unsigned payload with `AWS signature version 4`_ requires that the
literal string ``UNSIGNED-PAYLOAD`` is used when constructing a
`canonical request`_, and the same value is sent in the
`x-amz-content-sha256`_ header when sending an HTTP request.


.. _aws.auth#cognitoUserPools-trait:

-------------------------
aws.auth#cognitoUserPools
=========================
-------------------------

Trait summary
The ``aws.auth#cognitoUserPools`` trait adds support for
Expand Down Expand Up @@ -123,3 +189,5 @@ Trait value
.. _AWS signature version 4: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
.. _credential scope: https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html
.. _Amazon Cognito User Pools: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html
.. _canonical request: https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
.. _x-amz-content-sha256: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
123 changes: 0 additions & 123 deletions docs/source/spec/aws-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -831,127 +831,6 @@ plane unless an operation or resource is marked with the
}
}

.. _aws.api#unsignedPayload-trait:

---------------------------------
``aws.api#unsignedPayload`` trait
---------------------------------

Summary
Indicates that the payload of an operation is not to be part of the
signature computed for the request of an operation.
Trait selector
``operation``
Value type
Annotation trait

Most requests sent to AWS services require that the payload of the request is
signed. However, in some cases, a service that streams large amounts of data
with an unknown size at the time a request is initiated might require that the
payload of a request is not signed.

The following example defines an operation that indicates the payload of the
operation MUST NOT be used as part of the request signature calculation:

.. tabs::

.. code-tab:: smithy

use aws.api#unsignedPayload

@unsignedPayload
operation PutThings {
input: PutThingsInput,
output: PutThingsOutput
}

.. code-tab:: json

{
"smithy": "0.5.0",
"shapes": {
"smithy.example#PutThings": {
"type": "operation",
"input": {
"target": "smithy.example#PutThingsInput"
},
"output": {
"target": "smithy.example#PutThingsOutput"
},
"traits": {
"aws.api#unsignedPayload": true
}
}
}
}


Unsigned Payloads and signature version 4
=========================================

Using an unsigned payload with `AWS signature version 4`_ requires that the
literal string ``UNSIGNED-PAYLOAD`` is used when constructing a
`canonical request`_, and the same value is sent in the
`x-amz-content-sha256`_ header when sending an HTTP request.

.. _aws.api#ec2QueryName-trait:

---------------------------------
``aws.api#ec2QueryName`` trait
---------------------------------

Summary
Indicates the serialized name of a structure member when that structure is
serialized for the input of an EC2 operation.
Trait selector
``member:of(structure)``
Value type
``string``

It is very important to note that the ``aws.api#ec2QueryName`` ONLY applies
when serializing an INPUT. For example, given the following Smithy model:

.. tabs::

.. code-tab:: smithy

structure MyStruct {
@ec2QueryName("foo")
bar: String
}

.. code-tab:: json

{
"smithy": "0.5.0",
"shapes": {
"smithy.example#MyStruct": {
"type": "structure",
"members": {
"bar": {
"target": "smithy.api#String",
"traits": {
"aws.api#ec2QueryName": "foo"
}
}
}
}
}
}

The serialization of this structure as an input is:

::

MyStruct.bar=baz

The serialization of the structure as an (XML) output is:

.. code-block:: xml

<MyStruct>
<foo>baz</foo>
</MyStruct>

.. _endpoint-discovery:

Expand Down Expand Up @@ -1438,8 +1317,6 @@ existing AWS services.
.. _AWS CloudFormation service name: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws.template-resource-type-ref.html
.. _ARN service namespace: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces
.. _AWS signature version 4: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
.. _canonical request: https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
.. _x-amz-content-sha256: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
.. _Amazon Resource Name (ARN): https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
.. _AWS Service Namespaces: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces
.. _CloudFormation resource type: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
62 changes: 62 additions & 0 deletions docs/source/spec/aws-query-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,66 @@ Value type
}
}


.. _aws.protocols#ec2QueryName-trait:

------------------------------------
``aws.protocols#ec2QueryName`` trait
------------------------------------

Summary
Indicates the serialized name of a structure member when that structure is
serialized for the input of an EC2 operation using the
``aws.protocols#ec2Query`` protocol.
Trait selector
``member:of(structure)``
Value type
``string``

It is very important to note that the ``aws.protocols#ec2QueryName`` ONLY applies
when serializing an INPUT. For example, given the following Smithy model:

.. tabs::

.. code-tab:: smithy

structure MyStruct {
@ec2QueryName("foo")
bar: String
}

.. code-tab:: json

{
"smithy": "0.5.0",
"shapes": {
"smithy.example#MyStruct": {
"type": "structure",
"members": {
"bar": {
"target": "smithy.api#String",
"traits": {
"aws.protocols#ec2QueryName": "foo"
}
}
}
}
}
}

The serialization of this structure as an input is:

::

MyStruct.bar=baz

The serialization of the structure as an (XML) output is:

.. code-block:: xml

<MyStruct>
<foo>baz</foo>
</MyStruct>


*TODO: Add specifications, protocol examples, etc.*
2 changes: 1 addition & 1 deletion smithy-aws-protocol-tests/model/ec2Query/input.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $version: "0.5.0"

namespace aws.protocoltests.ec2

use aws.api#ec2QueryName
use aws.protocols#ec2QueryName
use aws.protocols#ec2Query
use aws.protocoltests.shared#EpochSeconds
use aws.protocoltests.shared#FooEnum
Expand Down
4 changes: 2 additions & 2 deletions smithy-aws-protocol-tests/model/ec2Query/main.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
//
// 1. EC2 does not support the xmlFlattened trait on input. All lists are flattened.
// 2. EC2 does not utilize input maps.
// 3. EC2 uses a trait called aws.api#ec2QueryName that is used when serializing
// 3. EC2 uses a trait called aws.protocols#ec2QueryName that is used when serializing
// query string input parameters. If this trait is found, then it is used.
// This trait has no effect on output serialization.
// 4. EC2 input parameters not marked with aws.api#ec2QueryName fall back to
// 4. EC2 input parameters not marked with aws.protocols#ec2QueryName fall back to
// using xmlName. If xmlName is set, then the first letter is uppercased
// and serialized in the query.
// 5. Because lists are always considered flattened, the member name of a list,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $version: "0.5.0"

namespace aws.protocoltests.ec2

use aws.api#ec2QueryName
use aws.protocols#ec2QueryName
use aws.protocols#ec2Query
use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
Expand Down
Loading