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

refactor: update r/vmc #49

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

refactor: update r/vmc #49

wants to merge 1 commit into from

Conversation

tenthirtyam
Copy link
Contributor

@tenthirtyam tenthirtyam commented Jan 10, 2025

In order to have a good experience with our community, we recommend that you read the contributing guidelines for making a pull request.

Summary of Pull Request

This pull request to the hcx package includes significant improvements to the VMware Cloud on AWS resource management, particularly focusing on the activation and deactivation processes. The changes enhance the reliability and maintainability of the code by introducing helper functions, improving error handling, and implementing exponential backoff for retries.

Improvements to Activation and Deactivation Processes:

  • hcx/resource_vmc.go: Refactored the resourceVmcCreate, resourceVmcRead, resourceVmcUpdate, and resourceVmcDelete functions to use a new helper function authenticateAndFetchSDDC for authentication and fetching SDDC details. This change simplifies the code and reduces redundancy.
  • hcx/resource_vmc.go: Introduced exponential backoff with a capped interval for retrying activation and deactivation operations, improving the robustness of these processes.
  • hcx/resource_vmc.go: Enhanced error handling by providing more descriptive error messages and ensuring that appropriate diagnostics are returned.

Constants Update:

  • hcx/constants/constants.go: Added a new constant VmcMaxRetryInterval to define the maximum retry interval for exponential backoff.

Code Cleanup:

  • hcx/resource_vmc.go: Removed unnecessary logging and redundant code to improve readability and maintainability.

These changes collectively enhance the stability and clarity of the VMware Cloud on AWS resource management code, making it easier to maintain and extend in the future.

Type of Pull Request

  • This is a bug fix.
  • This is an enhancement or feature.
  • This is a code style/formatting update.
  • This is a documentation update.
  • This is a refactoring update.
  • This is a chore update
  • This is something else.
    Please describe:

Related to Existing Issues

Issue Number: N/A

Test and Documentation Coverage

For bug fixes or features:

  • Tests have been completed.
  • Documentation has been added/updated.

Breaking Changes?

  • Yes, there are breaking changes.
  • No, there are no breaking changes.

@tenthirtyam tenthirtyam added the refactor Refactor label Jan 10, 2025
@tenthirtyam tenthirtyam added this to the .next milestone Jan 10, 2025
@tenthirtyam tenthirtyam self-assigned this Jan 10, 2025
@github-actions github-actions bot added needs-review Needs Review documentation Documentation labels Jan 10, 2025
@tenthirtyam tenthirtyam force-pushed the refactor/update-r-vmc branch 3 times, most recently from 8b34916 to 34ea593 Compare January 10, 2025 20:23
Copy link

@andybeltz andybeltz left a comment

Choose a reason for hiding this comment

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

A few small changes with a few thoughts...

  • Have you been able to test this? and if so any functionality deltas as a large amount of the code was refactored?

@tenthirtyam tenthirtyam force-pushed the main branch 14 times, most recently from e8b93d7 to 5bdacd5 Compare January 15, 2025 16:59
@tenthirtyam tenthirtyam force-pushed the refactor/update-r-vmc branch from 34ea593 to e471f32 Compare January 27, 2025 16:55
@tenthirtyam tenthirtyam marked this pull request as ready for review January 27, 2025 17:01
@tenthirtyam tenthirtyam requested a review from andybeltz January 27, 2025 17:01
Copy link

@andybeltz andybeltz left a comment

Choose a reason for hiding this comment

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

LGTM

@tenthirtyam tenthirtyam modified the milestones: v0.5.2, .next Jan 28, 2025
@tenthirtyam tenthirtyam marked this pull request as draft January 29, 2025 02:24
@tenthirtyam tenthirtyam removed the request for review from adeleporte January 29, 2025 02:24
@tenthirtyam tenthirtyam force-pushed the refactor/update-r-vmc branch 3 times, most recently from 6f294ca to d39ad23 Compare February 2, 2025 21:53
@tenthirtyam tenthirtyam removed the documentation Documentation label Feb 2, 2025
@tenthirtyam tenthirtyam force-pushed the refactor/update-r-vmc branch from d39ad23 to d8bd705 Compare February 2, 2025 22:04
Refactors `r/vmc`.

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam force-pushed the refactor/update-r-vmc branch from d8bd705 to a9208e4 Compare February 4, 2025 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review Needs Review refactor Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants