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

Semantics of put operation #300

Closed
benkehoe opened this issue Mar 3, 2020 · 3 comments
Closed

Semantics of put operation #300

benkehoe opened this issue Mar 3, 2020 · 3 comments
Assignees

Comments

@benkehoe
Copy link

benkehoe commented Mar 3, 2020

The put lifecycle section says put "used to create[s] a resource using identifiers provided by the client". This is a slightly different definition from HTTP PUT, which says that "the state of the target resource [is] created or replaced" (emphasis mine).

The put operation can be idempotent but not satisfy HTTP PUT semantics. The SQS CreateQueue API is one such example. It only creates queues, it does not update them, but it is idempotent: If you send multiple requests with the same input and a queue did not exist, or a queue with identical properties exists, you'll receive back the queue information every time. If you send multiple requests with the same input and a queue with different properties exists, you'll receive an error every time.

Is the Smithy put operation supposed to match HTTP PUT's semantics, or something closer to SQS CreateQueue?

@mtdowling
Copy link
Member

The put lifecycle works like an HTTP PUT, it just doesn't mandate that a service supports replacing an existing resource. As it's defined now, that's an implementation detail of the service.

We need to model our existing APIs that support idempotently creating resources using client provided identifiers but don't necessarily support replacing them (like DynamoDB tables)... We could add a trait to resources to indicate this kind of special case (for example, @noReplace). Would that clear this up more, or is calling it "put" always going to be confusing?

Do you have a use case in mind where this distinction would be important?

@benkehoe
Copy link
Author

benkehoe commented Mar 3, 2020

I guess at a minimum having the documentation explain that would be good. I do like the idea of @noReplace as validation checks for put operations on a service could verify that replace did or didn't work depending on the presence or absence of the tag.

I didn't have a use case in mind, I just didn't understand from the docs what the intention/semantics were.

mtdowling added a commit that referenced this issue Apr 1, 2020
@mtdowling mtdowling assigned mtdowling and unassigned kstich Apr 1, 2020
mtdowling added a commit that referenced this issue Apr 1, 2020
@mtdowling
Copy link
Member

The @noReplace trait was added, and I added more information to clarify the semantics of the put lifecycle operation.

Thanks for your feedback!

JordonPhillips pushed a commit to JordonPhillips/smithy that referenced this issue Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants