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

Upgraded AWS dependencies to 1.0 #33

Merged
merged 4 commits into from
Nov 30, 2023
Merged

Upgraded AWS dependencies to 1.0 #33

merged 4 commits into from
Nov 30, 2023

Conversation

GurvirDehal
Copy link
Contributor

@GurvirDehal GurvirDehal commented Nov 28, 2023

Description of changes

Upgraded the AWS dependencies in the Cargo.toml to 1.0. As a result some things broke and needed fixing, here are the types of changes done in this PR:

  • All builders have to be unwrapped following the call to .build().
  • In order to be successfully unwrapped, all builders must be passed input for the parameters that they require.
    • Ex: GetPolicyOutput will fail to build unless passed a PolicyStoreId, PolicyId, CreatedTime etc.
  • The smithy model for the AVP api responses has been updated to not wrap required parameters with Option
    • Previously the field GetPolicyOutput.policy_id was Option<String>, now it is just String.
    • Therefore we don't need any checks or tests for the Some or None cases and they have been removed in the PR.
  • The Unhandled variant in the AVP api exceptions is deprecated and shouldn't be used directly.
    • Instead this variant can be created with the method unhandled on the exception instead
  • The aws client now takes a mandatory parameter BehaviorVersion
  • Testing and mocking the aws client is done through the following now:

Issue #, if available

Checklist for requesting a review

The change in this PR is (choose one, and delete the other options):

  • A change (breaking or otherwise) that only impacts unreleased or experimental code.

I confirm that this PR (choose one, and delete the other options):

  • Does not update the CHANGELOG because my change does not significantly impact released code.

Testing

Ran the./scripts/build_and_test.sh script and ran the integration tests on my aws account. Everything passed.

Disclaimer

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

Copy link

Coverage after merging upgrade-dependencies into main

65.28%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/private/sources
   retry.rs76.47%100%33.33%100%
   mod.rs81.25%100%81.25%100%
src/private/sources/cache
   policy.rs78.85%100%74.36%92.31%77
   template.rs78.85%100%74.36%92.31%78
src/private/sources/policy
   loader.rs67.35%100%53.85%82.61%37, 53–55
   reader.rs75%100%42.86%97.50%80
   core.rs32.92%100%15.75%97.06%78
   error.rs80.56%100%70.83%100%
src/private/sources/schema
   error.rs71.43%100%58.82%100%
   core.rs44.23%100%27.50%100%
   reader.rs54.93%100%29.55%96.30%56
src/private/sources/template
   error.rs67.14%100%61.36%76.92%76–78, 82–84
   core.rs37.50%100%15.79%96.43%66
   reader.rs76.39%100%42.86%97.73%87
   loader.rs68%100%47.83%85.19%38, 60–62
src/private/translator
   avp_to_cedar.rs40.48%100%39.13%46.67%114, 130, 132, 46, 66, 93–95
   error.rs25%100%25%100%
src/private/types
   template_id.rs76%100%72.73%100%
   policy_store_id.rs63.33%100%66.67%50%19–21
   policy_id.rs63.33%100%66.67%50%18–20
src/public
   entity_provider.rs0%100%0%0%103–107, 109–112, 129, 144–147, 152–157, 159–160, 162–169, 171, 176, 178, 182–188, 43–45, 78, 93
   policy_set_provider.rs0%100%0%0%113, 127–135, 139–147, 152, 161, 165–170, 172–177, 180–185, 201–204, 209–210, 212–219, 223–230, 233–241, 244–252, 254–282, 287–293, 58–60, 95
   client.rs91.38%100%69.23%97.78%57

src/private/sources/cache/policy.rs Show resolved Hide resolved
src/private/sources/policy/loader.rs Show resolved Hide resolved
src/private/sources/schema/core.rs Show resolved Hide resolved
src/private/translator/avp_to_cedar.rs Show resolved Hide resolved
src/private/translator/avp_to_cedar.rs Show resolved Hide resolved
src/private/translator/avp_to_cedar.rs Show resolved Hide resolved
src/private/translator/error.rs Show resolved Hide resolved
Copy link

Coverage after merging upgrade-dependencies into main

65.28%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/private/sources
   retry.rs76.47%100%33.33%100%
   mod.rs81.25%100%81.25%100%
src/private/sources/cache
   policy.rs78.85%100%74.36%92.31%77
   template.rs78.85%100%74.36%92.31%78
src/private/sources/policy
   loader.rs67.35%100%53.85%82.61%37, 53–55
   reader.rs75%100%42.86%97.50%80
   core.rs32.92%100%15.75%97.06%78
   error.rs80.56%100%70.83%100%
src/private/sources/schema
   error.rs71.43%100%58.82%100%
   core.rs44.23%100%27.50%100%
   reader.rs54.93%100%29.55%96.30%56
src/private/sources/template
   error.rs67.14%100%61.36%76.92%76–78, 82–84
   core.rs37.50%100%15.79%96.43%66
   reader.rs76.39%100%42.86%97.73%87
   loader.rs68%100%47.83%85.19%38, 60–62
src/private/translator
   avp_to_cedar.rs40.48%100%39.13%46.67%114, 130, 132, 46, 66, 93–95
   error.rs25%100%25%100%
src/private/types
   template_id.rs76%100%72.73%100%
   policy_store_id.rs63.33%100%66.67%50%19–21
   policy_id.rs63.33%100%66.67%50%18–20
src/public
   entity_provider.rs0%100%0%0%103–107, 109–112, 129, 144–147, 152–157, 159–160, 162–169, 171, 176, 178, 182–188, 43–45, 78, 93
   policy_set_provider.rs0%100%0%0%113, 127–135, 139–147, 152, 161, 165–170, 172–177, 180–185, 201–204, 209–210, 212–219, 223–230, 233–241, 244–252, 254–282, 287–293, 58–60, 95
   client.rs91.38%100%69.23%97.78%57

Copy link

Coverage after merging upgrade-dependencies into main

65.28%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/private/sources
   retry.rs76.47%100%33.33%100%
   mod.rs81.25%100%81.25%100%
src/private/sources/cache
   policy.rs78.85%100%74.36%92.31%77
   template.rs78.85%100%74.36%92.31%78
src/private/sources/policy
   loader.rs67.35%100%53.85%82.61%37, 53–55
   reader.rs75%100%42.86%97.50%80
   core.rs32.92%100%15.75%97.06%78
   error.rs80.56%100%70.83%100%
src/private/sources/schema
   error.rs71.43%100%58.82%100%
   core.rs44.23%100%27.50%100%
   reader.rs54.93%100%29.55%96.30%56
src/private/sources/template
   error.rs67.14%100%61.36%76.92%76–78, 82–84
   core.rs37.50%100%15.79%96.43%66
   reader.rs76.39%100%42.86%97.73%87
   loader.rs68%100%47.83%85.19%38, 60–62
src/private/translator
   avp_to_cedar.rs40.48%100%39.13%46.67%114, 130, 132, 46, 66, 93–95
   error.rs25%100%25%100%
src/private/types
   template_id.rs76%100%72.73%100%
   policy_store_id.rs63.33%100%66.67%50%19–21
   policy_id.rs63.33%100%66.67%50%18–20
src/public
   entity_provider.rs0%100%0%0%103–107, 109–112, 129, 144–147, 152–157, 159–160, 162–169, 171, 176, 178, 182–188, 43–45, 78, 93
   policy_set_provider.rs0%100%0%0%113, 127–135, 139–147, 152, 161, 165–170, 172–177, 180–185, 201–204, 209–210, 212–219, 223–230, 233–241, 244–252, 254–282, 287–293, 58–60, 95
   client.rs91.38%100%69.23%97.78%57

src/public/client.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ericox ericox left a comment

Choose a reason for hiding this comment

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

Seems pretty straight forward/mechanical. I carefully looked at the changes around unwrap() calls after build() invocations. I didn't see any changes in non-test code. It looks like the reason is because we aren't using the AVP API GetPolicyOutput/GetPolicyInput, etc types directly. We are using the sdk client which hasn't been effected by the upgrade correct?

src/private/sources/cache/policy.rs Outdated Show resolved Hide resolved
src/public/client.rs Outdated Show resolved Hide resolved
@GurvirDehal
Copy link
Contributor Author

Seems pretty straight forward/mechanical. I carefully looked at the changes around unwrap() calls after build() invocations. I didn't see any changes in non-test code. It looks like the reason is because we aren't using the AVP API GetPolicyOutput/GetPolicyInput, etc types directly. We are using the sdk client which hasn't been effected by the upgrade correct?

There are some changes in non-test code, some of them being in the translator. You're right that we aren't building the GetPolicyOutput type and so we don't need to worry about the new builder errors, but the types themselves have changed. Namely before, the policy_id from that struct was type Option<String> whereas now its just String. Most of the non-test related changes are for accommodating that, and removing exceptions related to that which are no longer possible such as policy_id_not_found.

Copy link

Coverage after merging upgrade-dependencies into main

65.28%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/private/sources
   retry.rs76.47%100%33.33%100%
   mod.rs81.25%100%81.25%100%
src/private/sources/cache
   policy.rs79.25%100%75%92.31%77
   template.rs79.25%100%75%92.31%78
src/private/sources/policy
   loader.rs67.35%100%53.85%82.61%37, 53–55
   reader.rs75%100%42.86%97.50%80
   core.rs32.92%100%15.75%97.06%78
   error.rs80.56%100%70.83%100%
src/private/sources/schema
   error.rs71.43%100%58.82%100%
   core.rs44.23%100%27.50%100%
   reader.rs54.93%100%29.55%96.30%56
src/private/sources/template
   error.rs67.14%100%61.36%76.92%76–78, 82–84
   core.rs37.50%100%15.79%96.43%66
   reader.rs76.39%100%42.86%97.73%87
   loader.rs68%100%47.83%85.19%38, 60–62
src/private/translator
   avp_to_cedar.rs40.48%100%39.13%46.67%114, 130, 132, 46, 66, 93–95
   error.rs25%100%25%100%
src/private/types
   template_id.rs76%100%72.73%100%
   policy_store_id.rs63.33%100%66.67%50%19–21
   policy_id.rs63.33%100%66.67%50%18–20
src/public
   entity_provider.rs0%100%0%0%103–107, 109–112, 129, 144–147, 152–157, 159–160, 162–169, 171, 176, 178, 182–188, 43–45, 78, 93
   policy_set_provider.rs0%100%0%0%113, 127–135, 139–147, 152, 161, 165–170, 172–177, 180–185, 201–204, 209–210, 212–219, 223–230, 233–241, 244–252, 254–282, 287–293, 58–60, 95
   client.rs91.38%100%69.23%97.78%57

Copy link
Contributor

@camarcio camarcio left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@GurvirDehal GurvirDehal merged commit f56df00 into main Nov 30, 2023
2 checks passed
@GurvirDehal GurvirDehal deleted the upgrade-dependencies branch November 30, 2023 22:07
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

Successfully merging this pull request may close these issues.

5 participants