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

CLOUDP-70044: mongocli ops-manager|cloud-manager maintenanceWindow(s) create #428

Merged
merged 9 commits into from
Sep 9, 2020

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Sep 9, 2020

Proposed changes

Jira ticket: CLOUDP-70044

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

Further comments

./bin/mongocli om maintenanceWindows create --alertType REPLICA_SET --startDate 2020-09-11T22:00:00 --endDate 2020-09-11T23:30:00Z -P ops --desc "test" -o json
{
  "id": "5f58a1dbff0c866d3746fffb",
  "groupId": "5f587f73ff0c866d3746e522",
  "created": "2020-09-09T09:35:23Z",
  "startDate": "2020-09-11T22:00:00Z",
  "endDate": "2020-09-11T23:30:00Z",
  "updated": "2020-09-09T09:35:23Z",
  "alertTypeNames": [
    "REPLICA_SET"
  ],
  "description": "test"
}
./bin/mongocli om maintenanceWindows create --alertType REPLICA_SET --startDate 2020-09-11T22:00:00 --endDate 2020-09-11T23:30:00Z -P ops --desc "test"
Maintenance window '5f58a1d7ff0c866d3746fff7' successfully created

@andreaangiolillo andreaangiolillo marked this pull request as ready for review September 9, 2020 09:59
gssbzn
gssbzn previously approved these changes Sep 9, 2020
Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

One small nit but not blocking

internal/cli/opsmanager/maintenance/create.go Outdated Show resolved Hide resolved
@@ -83,3 +88,14 @@ func (s *Store) MaintenanceWindow(projectID string) (*atlas.MaintenanceWindow, e
return nil, fmt.Errorf("unsupported service: %s", s.service)
}
}

// CreateMaintenanceWindow encapsulates the logic to manage different cloud providers
func (s *Store) CreateMaintenanceWindow(projectID string, maintenanceWindow *opsmngr.MaintenanceWindow) (*opsmngr.MaintenanceWindow, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure what your plane is when we get to do get/update/rm for ops manager given their signature will probably be different so I'm not sure we should keep them in the same file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking about calling the interface like "OpsManagerMaintenanceWindowsUpdater". Would you rather have one file or two?

Copy link
Collaborator

@gssbzn gssbzn Sep 9, 2020

Choose a reason for hiding this comment

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

if you're going to have OpsManagerMaintenanceWindowUpdater, we should have OpsManagerMaintenanceWindowCreator, I would also make the methods explicit
CreateOpsManagerMaintenanceWindow and UpdateOpsManagerMaintenanceWindow to avoid confusion.

Separate files is up to you so far I don't have strong opinion on it specially since files within the same package are just symbolic, my only comment is on the name of the interfaces and methods, again to avoid confusion
Feel free to address any of this in a separate PR

Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -83,3 +88,14 @@ func (s *Store) MaintenanceWindow(projectID string) (*atlas.MaintenanceWindow, e
return nil, fmt.Errorf("unsupported service: %s", s.service)
}
}

// CreateMaintenanceWindow encapsulates the logic to manage different cloud providers
func (s *Store) CreateMaintenanceWindow(projectID string, maintenanceWindow *opsmngr.MaintenanceWindow) (*opsmngr.MaintenanceWindow, error) {
Copy link
Collaborator

@gssbzn gssbzn Sep 9, 2020

Choose a reason for hiding this comment

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

if you're going to have OpsManagerMaintenanceWindowUpdater, we should have OpsManagerMaintenanceWindowCreator, I would also make the methods explicit
CreateOpsManagerMaintenanceWindow and UpdateOpsManagerMaintenanceWindow to avoid confusion.

Separate files is up to you so far I don't have strong opinion on it specially since files within the same package are just symbolic, my only comment is on the name of the interfaces and methods, again to avoid confusion
Feel free to address any of this in a separate PR

@andreaangiolillo andreaangiolillo merged commit 730f3fa into master Sep 9, 2020
@andreaangiolillo andreaangiolillo deleted the CLOUDP-70044 branch September 9, 2020 10:40
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.

None yet

2 participants