Skip to content

Commit

Permalink
clean up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
husniMDB committed Jun 25, 2024
1 parent a14b1a1 commit f81a0c1
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 41 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/google/go-querystring v1.1.0
github.com/stretchr/testify v1.9.0
github.com/xdg-go/stringprep v1.0.4
go.mongodb.org/atlas v0.36.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions opsmngr/accesslist_api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const accessListAPIKeysPath = "api/public/v1.0/orgs/%s/apiKeys/%s/accessList" //nolint:gosec // This is a path

// AccessListAPIKeysService is an interface for interfacing with the AccessList API Keys
// endpoints of the MongoDB Atlas API.
// endpoints of the MongoDB Ops Manager API.
type AccessListAPIKeysService interface {
List(context.Context, string, string, *ListOptions) (*AccessListAPIKeys, *Response, error)
Get(context.Context, string, string, string) (*AccessListAPIKey, *Response, error)
Expand All @@ -32,7 +32,7 @@ type AccessListAPIKeysService interface {
}

// AccessListAPIKeysServiceOp handles communication with the AccessList API keys related methods of the
// MongoDB Atlas API.
// MongoDB Ops Manager API.
type AccessListAPIKeysServiceOp service

var _ AccessListAPIKeysService = &AccessListAPIKeysServiceOp{}
Expand Down
16 changes: 8 additions & 8 deletions opsmngr/alert_configurations.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type MetricThreshold struct {
Operator string `json:"operator,omitempty"` // Operator to apply when checking the current metric value against the threshold value.
Threshold float64 `json:"threshold"` // Threshold value outside of which an alert will be triggered.
Units string `json:"units,omitempty"` // The units for the threshold value.
Mode string `json:"mode,omitempty"` // This must be set to AVERAGE. Atlas computes the current metric value as an average.
Mode string `json:"mode,omitempty"` // This must be set to AVERAGE. Ops Manager computes the current metric value as an average.
}

// Threshold that triggers an alert. Don’t include if "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD".
Expand All @@ -97,29 +97,29 @@ type Threshold struct {

// Notification sends when an alert condition is detected.
type Notification struct {
APIToken string `json:"apiToken,omitempty"` // Slack API token or Bot token. Populated for the SLACK notifications type. If the token later becomes invalid, Atlas sends an email to the project owner and eventually removes the token.
APIToken string `json:"apiToken,omitempty"` // Slack API token or Bot token. Populated for the SLACK notifications type. If the token later becomes invalid, Ops Manager sends an email to the project owner and eventually removes the token.
ChannelName string `json:"channelName,omitempty"` // Slack channel name. Populated for the SLACK notifications type.
DatadogAPIKey string `json:"datadogApiKey,omitempty"` // Datadog API Key. Found in the Datadog dashboard. Populated for the DATADOG notifications type.
DatadogRegion string `json:"datadogRegion,omitempty"` // Region that indicates which API URL to use
DelayMin *int `json:"delayMin,omitempty"` // Number of minutes to wait after an alert condition is detected before sending out the first notification.
EmailAddress string `json:"emailAddress,omitempty"` // Email address to which alert notifications are sent. Populated for the EMAIL notifications type.
EmailEnabled *bool `json:"emailEnabled,omitempty"` // Flag indicating if email notifications should be sent. Populated for ORG, GROUP, and USER notifications types.
FlowdockAPIToken string `json:"flowdockApiToken,omitempty"` // The Flowdock personal API token. Populated for the FLOWDOCK notifications type. If the token later becomes invalid, Atlas sends an email to the project owner and eventually removes the token.
FlowdockAPIToken string `json:"flowdockApiToken,omitempty"` // The Flowdock personal API token. Populated for the FLOWDOCK notifications type. If the token later becomes invalid, Ops Manager sends an email to the project owner and eventually removes the token.
FlowName string `json:"flowName,omitempty"` // Flowdock flow namse in lower-case letters.
IntervalMin int `json:"intervalMin,omitempty"` // Number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
MobileNumber string `json:"mobileNumber,omitempty"` // Mobile number to which alert notifications are sent. Populated for the SMS notifications type.
OpsGenieAPIKey string `json:"opsGenieApiKey,omitempty"` // Opsgenie API Key. Populated for the OPS_GENIE notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the token.
OpsGenieAPIKey string `json:"opsGenieApiKey,omitempty"` // Opsgenie API Key. Populated for the OPS_GENIE notifications type. If the key later becomes invalid, Ops Manager sends an email to the project owner and eventually removes the token.
OpsGenieRegion string `json:"opsGenieRegion,omitempty"` // Region that indicates which API URL to use.
OrgName string `json:"orgName,omitempty"` // Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string. Populated for the FLOWDOCK notifications type.
ServiceKey string `json:"serviceKey,omitempty"` // PagerDuty service key. Populated for the PAGER_DUTY notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key.
ServiceKey string `json:"serviceKey,omitempty"` // PagerDuty service key. Populated for the PAGER_DUTY notifications type. If the key later becomes invalid, Ops Manager sends an email to the project owner and eventually removes the key.
SMSEnabled *bool `json:"smsEnabled,omitempty"` // Flag indicating if text message notifications should be sent. Populated for ORG, GROUP, and USER notifications types.
TeamID string `json:"teamId,omitempty"` // Unique identifier of a team.
TeamName string `json:"teamName,omitempty"` // Label for the team that receives this notification.
NotifierID string `json:"notifierId,omitempty"` // The notifierId is a system-generated unique identifier assigned to each notification method.
TypeName string `json:"typeName,omitempty"` // Type of alert notification.
Username string `json:"username,omitempty"` // Name of the Atlas user to which to send notifications. Only a user in the project that owns the alert configuration is allowed here. Populated for the USER notifications type.
VictorOpsAPIKey string `json:"victorOpsApiKey,omitempty"` // VictorOps API key. Populated for the VICTOR_OPS notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key.
VictorOpsRoutingKey string `json:"victorOpsRoutingKey,omitempty"` // VictorOps routing key. Populated for the VICTOR_OPS notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key.
Username string `json:"username,omitempty"` // Name of the Ops Manager user to which to send notifications. Only a user in the project that owns the alert configuration is allowed here. Populated for the USER notifications type.
VictorOpsAPIKey string `json:"victorOpsApiKey,omitempty"` // VictorOps API key. Populated for the VICTOR_OPS notifications type. If the key later becomes invalid, Ops Manager sends an email to the project owner and eventually removes the key.
VictorOpsRoutingKey string `json:"victorOpsRoutingKey,omitempty"` // VictorOps routing key. Populated for the VICTOR_OPS notifications type. If the key later becomes invalid, Ops Manager sends an email to the project owner and eventually removes the key.
Roles []string `json:"roles,omitempty"` // The following roles grant privileges within a project.
MicrosoftTeamsWebhookURL string `json:"microsoftTeamsWebhookUrl,omitempty"` // Microsoft Teams Wewbhook URL
WebhookSecret string `json:"webhookSecret,omitempty"` // Webhook Secret
Expand Down
2 changes: 0 additions & 2 deletions opsmngr/automation_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
)

// GetConfig retrieves the current automation configuration for a project.
// atlas
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/automation-config/#get-the-automation-configuration
func (s *AutomationServiceOp) GetConfig(ctx context.Context, groupID string) (*AutomationConfig, *Response, error) {
if groupID == "" {
return nil, nil, NewArgError("groupID", "must be set")
Expand Down
14 changes: 4 additions & 10 deletions opsmngr/continuous_restore_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type ContinuousRestoreJobsService interface {
}

// ContinuousRestoreJobsServiceOp handles communication with the Continuous Backup Restore Jobs related methods
// of the MongoDB Atlas API.
// of the MongoDB Ops Manager API.
type ContinuousRestoreJobsServiceOp service

var _ ContinuousRestoreJobsService = &ContinuousRestoreJobsServiceOp{}
Expand Down Expand Up @@ -91,9 +91,7 @@ type ContinuousJobRequest struct {
SnapshotID string `json:"snapshotId,omitempty"`
}

// List lists all continuous backup jobs in Atlas
//
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/restorejobs/get-all-restore-jobs-for-one-cluster/
// List lists all continuous backup jobs in Ops Manager.
func (s *ContinuousRestoreJobsServiceOp) List(ctx context.Context, groupID, clusterID string, opts *ListOptions) (*ContinuousJobs, *Response, error) {
if clusterID == "" {
return nil, nil, NewArgError("clusterID", "must be set")
Expand All @@ -120,9 +118,7 @@ func (s *ContinuousRestoreJobsServiceOp) List(ctx context.Context, groupID, clus
return root, resp, err
}

// Get gets a continuous backup job in Atlas
//
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/restorejobs/get-one-single-restore-job-for-one-cluster/
// Get gets a continuous backup job in Ops Manager.
func (s *ContinuousRestoreJobsServiceOp) Get(ctx context.Context, groupID, clusterID, jobID string) (*ContinuousJob, *Response, error) {
if clusterID == "" {
return nil, nil, NewArgError("clusterID", "must be set")
Expand All @@ -149,9 +145,7 @@ func (s *ContinuousRestoreJobsServiceOp) Get(ctx context.Context, groupID, clust
return root, resp, err
}

// Create creates a continuous backup job in Atlas
//
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/restorejobs/create-one-restore-job-for-one-cluster/
// Create creates a continuous backup job in Ops Manager.
func (s *ContinuousRestoreJobsServiceOp) Create(ctx context.Context, groupID, clusterID string, request *ContinuousJobRequest) (*ContinuousJobs, *Response, error) {
if request == nil {
return nil, nil, NewArgError("request", "must be set")
Expand Down
2 changes: 1 addition & 1 deletion opsmngr/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type EventsServiceOp service

var _ EventsService = &EventsServiceOp{}

// Event represents an event of the MongoDB Atlas API.
// Event represents an event of the MongoDB Ops Manager API.
type Event struct {
AlertID string `json:"alertId"`
AlertConfigID string `json:"alertConfigId"`
Expand Down
14 changes: 5 additions & 9 deletions opsmngr/live_data_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const liveMigrationBasePath = "api/public/v1.0/orgs/%s/liveExport/migrationLink"

type LinkToken struct {
LinkToken string `json:"linkToken,omitempty"` // Atlas-generated token that links the source (Cloud Manager or Ops Manager) and destination (Atlas) clusters for migration.
LinkToken string `json:"linkToken,omitempty"` // Ops Manager-generated token that links the source (Cloud Manager or Ops Manager) and destination (Atlas) clusters for migration.
}

// LiveDataMigrationService is an interface for interfacing with the Live Migration
Expand All @@ -38,15 +38,15 @@ type LiveDataMigrationService interface {

// ConnectionStatus represents the response of LiveDataMigrationService.ConnectOrganizations and LiveDataMigrationService.ConnectionStatus.
type ConnectionStatus struct {
Status string `json:"status,omitempty"` // Status represents the state of the connection that exists between this organization and the target cluster in the MongoDB Atlas organization.
Status string `json:"status,omitempty"` // Status represents the state of the connection that exists between this organization and the target cluster in the MongoDB Ops Manager organization.
}

// LiveDataMigrationServiceOp provides an implementation of the LiveDataMigrationService interface.
type LiveDataMigrationServiceOp service

var _ LiveDataMigrationService = &LiveDataMigrationServiceOp{}

// ConnectionStatus returns the status of the connection between the specified source Ops Manager organization and the target MongoDB Atlas organization.
// ConnectionStatus returns the status of the connection between the specified source Ops Manager organization and the target MongoDB Ops Manager organization.
//
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/cloud-migration/return-the-status-of-the-organization-link/
func (s *LiveDataMigrationServiceOp) ConnectionStatus(ctx context.Context, orgID string) (*ConnectionStatus, *Response, error) {
Expand All @@ -68,9 +68,7 @@ func (s *LiveDataMigrationServiceOp) ConnectionStatus(ctx context.Context, orgID
return root, resp, err
}

// ConnectOrganizations connects the source Ops Manager organization with a target MongoDB Atlas organization.
//
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/cloud-migration/link-the-organization-with-atlas/
// ConnectOrganizations connects the source Ops Manager organization with a target MongoDB Ops Manager organization.
func (s *LiveDataMigrationServiceOp) ConnectOrganizations(ctx context.Context, orgID string, linkToken *LinkToken) (*ConnectionStatus, *Response, error) {
if orgID == "" {
return nil, nil, NewArgError("orgID", "must be set")
Expand All @@ -92,9 +90,7 @@ func (s *LiveDataMigrationServiceOp) ConnectOrganizations(ctx context.Context, o
return root, resp, err
}

// DeleteConnection removes the connection between the source Ops Manager organization and the target MongoDB Atlas organization.
//
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-delete-one/
// DeleteConnection removes the connection between the source Ops Manager organization and the target MongoDB Ops Manager organization.
func (s *LiveDataMigrationServiceOp) DeleteConnection(ctx context.Context, orgID string) (*Response, error) {
if orgID == "" {
return nil, NewArgError("orgID", "must be set")
Expand Down
2 changes: 1 addition & 1 deletion opsmngr/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type MaintenanceWindows struct {
}

// MaintenanceWindowsServiceOp handles communication with the MaintenanceWindows related methods
// of the OpsManager Atlas API.
// of the Ops Manager API.
type MaintenanceWindowsServiceOp service

var _ MaintenanceWindowsService = &MaintenanceWindowsServiceOp{}
Expand Down
2 changes: 1 addition & 1 deletion opsmngr/organization_api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type APIKeysService interface {
}

// APIKeysServiceOp handles communication with the APIKey related methods
// of the MongoDB Atlas API.
// of the MongoDB Ops Manager API.
type APIKeysServiceOp service

var _ APIKeysService = &APIKeysServiceOp{}
Expand Down
2 changes: 1 addition & 1 deletion opsmngr/project_api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ProjectAPIKeysService interface {
}

// ProjectAPIKeysOp handles communication with the APIKey related methods
// of the MongoDB Atlas API.
// of the MongoDB Ops Manager API.
type ProjectAPIKeysOp service

var _ ProjectAPIKeysService = &ProjectAPIKeysOp{}
Expand Down
2 changes: 1 addition & 1 deletion opsmngr/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ProjectsListOptions struct {
}

type CreateProjectOptions struct {
ProjectOwnerID string `url:"projectOwnerId,omitempty"` // Unique 24-hexadecimal digit string that identifies the Atlas user account to be granted the Project Owner role on the specified project.
ProjectOwnerID string `url:"projectOwnerId,omitempty"` // Unique 24-hexadecimal digit string that identifies the Ops Manager user account to be granted the Project Owner role on the specified project.
}

// ProjectTeam represents the kind of role that has the team.
Expand Down
2 changes: 1 addition & 1 deletion opsmngr/service_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

const versionPath = "api/private/unauth/version"

// ServiceVersionService is an interface for the version private endpoint of the MongoDB Atlas API.
// ServiceVersionService is an interface for the version private endpoint of the MongoDB Ops Manager API.
//
// We currently make no promise to support or document this service or endpoint
// beyond what can be seen here.
Expand Down
2 changes: 1 addition & 1 deletion opsmngr/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (s *TeamsServiceOp) Rename(ctx context.Context, orgID, teamID, teamName str
return root, resp, err
}

// UpdateTeamRoles Update the roles of a team in an Atlas project.
// UpdateTeamRoles Update the roles of a team in an Ops Manager project.
//
// See more: https://docs.opsmanager.mongodb.com/current/reference/api/teams/teams-update-roles/
func (s *TeamsServiceOp) UpdateTeamRoles(ctx context.Context, orgID, teamID string, updateTeamRolesRequest *TeamUpdateRoles) ([]TeamRoles, *Response, error) {
Expand Down
4 changes: 2 additions & 2 deletions opsmngr/teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,12 @@ func TestTeams_AddUsersToTeam(t *testing.T) {
}`)
})

atlasUsers, _, err := client.Teams.AddUsersToTeam(ctx, orgID, teamID, usersID)
users, _, err := client.Teams.AddUsersToTeam(ctx, orgID, teamID, usersID)
if err != nil {
t.Fatalf("Teams.AddUsersToTeam returned error: %v", err)
}

if userCount := len(atlasUsers); userCount != 2 {
if userCount := len(users); userCount != 2 {
t.Errorf("expected userCount '%d', received '%d'", 2, userCount)
}
}
Expand Down

0 comments on commit f81a0c1

Please sign in to comment.