@@ -33,6 +33,7 @@ type AdvancedClustersService interface {
33
33
Create (ctx context.Context , groupID string , cluster * AdvancedCluster ) (* AdvancedCluster , * Response , error )
34
34
Update (ctx context.Context , groupID , clusterName string , cluster * AdvancedCluster ) (* AdvancedCluster , * Response , error )
35
35
Delete (ctx context.Context , groupID , clusterName string ) (* Response , error )
36
+ TestFailover (ctx context.Context , groupID , clusterName string ) (* Response , error )
36
37
}
37
38
38
39
// AdvancedClustersServiceOp handles communication with the Cluster (Advanced) related methods
@@ -246,3 +247,28 @@ func (s *AdvancedClustersServiceOp) Delete(ctx context.Context, groupID, cluster
246
247
247
248
return resp , err
248
249
}
250
+
251
+ // TestFailover starts a failover test for the specified cluster in the specified project
252
+ //
253
+ // See more: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#tag/Multi-Cloud-Clusters/operation/testFailover
254
+ func (s * AdvancedClustersServiceOp ) TestFailover (ctx context.Context , groupID , clusterName string ) (* Response , error ) {
255
+ if groupID == "" {
256
+ return nil , NewArgError ("groupId" , "must be set" )
257
+ }
258
+ if clusterName == "" {
259
+ return nil , NewArgError ("clusterName" , "must be set" )
260
+ }
261
+
262
+ basePath := fmt .Sprintf (advancedClustersPath , groupID )
263
+ escapedEntry := url .PathEscape (clusterName )
264
+ path := fmt .Sprintf ("%s/%s/restartPrimaries" , basePath , escapedEntry )
265
+
266
+ req , err := s .Client .NewRequest (ctx , http .MethodPost , path , nil )
267
+ if err != nil {
268
+ return nil , err
269
+ }
270
+
271
+ resp , err := s .Client .Do (ctx , req , nil )
272
+
273
+ return resp , err
274
+ }
0 commit comments