Skip to content

chore: make generateIdempotencyToken calls before consuming #1168

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

Closed

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented May 11, 2020

Issue #, if available:
N/A

Description of changes:

  • make generateIdempotencyToken calls before consuming
  • precursor to:

Before, the input is modified while populating body/bodyParams:

const serializeAws_json1_1CreateProfileRequest = (
  input: CreateProfileRequest,
  context: __SerdeContext
): any => {
  const bodyParams: any = {};
  if (input.Address !== undefined) {
    bodyParams["Address"] = input.Address;
  }
  if (input.ClientRequestToken === undefined) {
    input.ClientRequestToken = generateIdempotencyToken();
  }
  if (input.ClientRequestToken !== undefined) {
    bodyParams["ClientRequestToken"] = input.ClientRequestToken;
  }

After, the input is modified prior to populating body/bodyParams:

const serializeAws_json1_1CreateProfileRequest = (
  input: CreateProfileRequest,
  context: __SerdeContext
): any => {
  if (input.ClientRequestToken === undefined) {
    input.ClientRequestToken = generateIdempotencyToken();
  }
  const bodyParams: any = {};
  if (input.Address !== undefined) {
    bodyParams["Address"] = input.Address;
  }
  if (input.ClientRequestToken !== undefined) {
    bodyParams["ClientRequestToken"] = input.ClientRequestToken;
  }

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: ab7c49c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@trivikr trivikr marked this pull request as draft May 11, 2020 20:26
@trivikr
Copy link
Member Author

trivikr commented May 11, 2020

Closing as this PR will be replaced with another solution to get work done without modifying input

@trivikr trivikr closed this May 11, 2020
@trivikr trivikr deleted the refactor-write-idempotency-autofill branch May 11, 2020 22:32
@trivikr
Copy link
Member Author

trivikr commented May 13, 2020

Succeeded by #1176

@lock
Copy link

lock bot commented May 20, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants