@@ -25,6 +25,7 @@ const (
2525 performanceAdvisorNamespacesPath = performanceAdvisorPath + "/namespaces"
2626 performanceAdvisorSlowQueryLogsPath = performanceAdvisorPath + "/slowQueryLogs"
2727 performanceAdvisorSuggestedIndexesLogsPath = performanceAdvisorPath + "/suggestedIndexes"
28+ performanceAdvisorManagedSlowMs = "api/atlas/v1.0/groups/%s/managedSlowMs"
2829)
2930
3031// PerformanceAdvisorService is an interface of the Performance Advisor
@@ -35,6 +36,8 @@ type PerformanceAdvisorService interface {
3536 GetNamespaces (context.Context , string , string , * NamespaceOptions ) (* Namespaces , * Response , error )
3637 GetSlowQueries (context.Context , string , string , * SlowQueryOptions ) (* SlowQueries , * Response , error )
3738 GetSuggestedIndexes (context.Context , string , string , * SuggestedIndexOptions ) (* SuggestedIndexes , * Response , error )
39+ EnableManagedSlowOperationThreshold (context.Context , string ) (* Response , error )
40+ DisableManagedSlowOperationThreshold (context.Context , string ) (* Response , error )
3841}
3942
4043// PerformanceAdvisorServiceOp handles communication with the Performance Advisor related methods of the MongoDB Atlas API.
@@ -221,3 +224,51 @@ func (s *PerformanceAdvisorServiceOp) GetSuggestedIndexes(ctx context.Context, g
221224
222225 return root , resp , err
223226}
227+
228+ // EnableManagedSlowOperationThreshold enables the Atlas managed slow operation threshold for your project.
229+ //
230+ // See more: https://docs.atlas.mongodb.com/reference/api/pa-managed-slow-ms-enable/
231+ func (s * PerformanceAdvisorServiceOp ) EnableManagedSlowOperationThreshold (ctx context.Context , groupID string ) (* Response , error ) {
232+ if groupID == "" {
233+ return nil , NewArgError ("groupID" , "must be set" )
234+ }
235+
236+ basePath := fmt .Sprintf (performanceAdvisorManagedSlowMs , groupID )
237+ path := fmt .Sprintf ("%s/%s" , basePath , "enable" )
238+
239+ req , err := s .Client .NewRequest (ctx , http .MethodPost , path , nil )
240+ if err != nil {
241+ return nil , err
242+ }
243+
244+ resp , err := s .Client .Do (ctx , req , nil )
245+ if err != nil {
246+ return resp , err
247+ }
248+
249+ return resp , err
250+ }
251+
252+ // DisableManagedSlowOperationThreshold disables the Atlas managed slow operation threshold for your project.
253+ //
254+ // See more: https://docs.atlas.mongodb.com/reference/api/pa-managed-slow-ms-disable/
255+ func (s * PerformanceAdvisorServiceOp ) DisableManagedSlowOperationThreshold (ctx context.Context , groupID string ) (* Response , error ) {
256+ if groupID == "" {
257+ return nil , NewArgError ("groupID" , "must be set" )
258+ }
259+
260+ basePath := fmt .Sprintf (performanceAdvisorManagedSlowMs , groupID )
261+ path := fmt .Sprintf ("%s/%s" , basePath , "disable" )
262+
263+ req , err := s .Client .NewRequest (ctx , http .MethodDelete , path , nil )
264+ if err != nil {
265+ return nil , err
266+ }
267+
268+ resp , err := s .Client .Do (ctx , req , nil )
269+ if err != nil {
270+ return resp , err
271+ }
272+
273+ return resp , err
274+ }
0 commit comments