Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

implement archive managed services#343

Merged
nxtcoder19 merged 1 commit into
mainfrom
impl/archive-msvc
Jun 28, 2024
Merged

implement archive managed services#343
nxtcoder19 merged 1 commit into
mainfrom
impl/archive-msvc

Conversation

@nxtcoder19
Copy link
Copy Markdown
Contributor

@nxtcoder19 nxtcoder19 commented Jun 28, 2024

Summary by Sourcery

This pull request introduces a new feature to archive cluster managed services. It adds a new function, ArchiveClusterManagedService, and modifies the DeleteCluster function to utilize this new archiving capability. Additionally, a new field 'IsArchived' is added to the ClusterManagedService entity to support this feature.

  • New Features:
    • Introduced the ability to archive cluster managed services by adding the ArchiveClusterManagedService function.
  • Enhancements:
    • Modified the DeleteCluster function to archive cluster managed services before deletion.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jun 28, 2024

Reviewer's Guide by Sourcery

This pull request implements the archiving of managed services by adding an ArchiveClusterManagedService method. This method sets the isArchived field to true for the specified cluster's managed services. The DeleteCluster method is updated to call this new method before deleting a cluster. Additionally, the isArchived field and its constant are added to the ClusterManagedService struct.

File-Level Changes

Files Changes
apps/infra/internal/domain/cluster-managed-service.go
apps/infra/internal/domain/clusters.go
apps/infra/internal/domain/api.go
Implemented the ArchiveClusterManagedService method and integrated it into the cluster deletion process.
apps/infra/internal/entities/cluster-managed-service.go
apps/infra/internal/entities/field-constants/generated_constants.go
Added the isArchived field to the ClusterManagedService struct and its corresponding constant.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @nxtcoder19 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

return destMsvc, nil
}

func (d *domain) ArchiveClusterManagedService(ctx InfraContext, clusterName string) error {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (bug_risk): Consider adding a check for empty or invalid clusterName.

Adding a check for an empty or invalid clusterName at the beginning of the function can prevent unnecessary database queries and potential errors.

Suggested change
func (d *domain) ArchiveClusterManagedService(ctx InfraContext, clusterName string) error {
func (d *domain) ArchiveClusterManagedService(ctx InfraContext, clusterName string) error {
if clusterName == "" {
return errors.New("clusterName cannot be empty")
}

@nxtcoder19 nxtcoder19 merged commit a2ea1c4 into main Jun 28, 2024
@nxtcoder19 nxtcoder19 deleted the impl/archive-msvc branch June 28, 2024 06:17
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
implement archive managed services
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