@@ -29,6 +29,7 @@ type ServerlessInstancesService interface {
2929 List (context.Context , string , * ListOptions ) (* ClustersResponse , * Response , error )
3030 Get (context.Context , string , string ) (* Cluster , * Response , error )
3131 Create (context.Context , string , * ServerlessCreateRequestParams ) (* Cluster , * Response , error )
32+ Update (context.Context , string , string , * ServerlessUpdateRequestParams ) (* Cluster , * Response , error )
3233 Delete (context.Context , string , string ) (* Response , error )
3334}
3435
@@ -46,8 +47,13 @@ type ClustersResponse struct {
4647
4748// ServerlessCreateRequestParams represents the Request Body Parameters of ServerlessInstancesService.Create.
4849type ServerlessCreateRequestParams struct {
49- Name string `json:"name,omitempty"`
50- ProviderSettings * ServerlessProviderSettings `json:"providerSettings,omitempty"`
50+ Name string `json:"name,omitempty"`
51+ ProviderSettings * ServerlessProviderSettings `json:"providerSettings,omitempty"`
52+ ServerlessBackupOptions * ServerlessBackupOptions `json:"serverlessBackupOptions,omitempty"`
53+ }
54+
55+ type ServerlessUpdateRequestParams struct {
56+ ServerlessBackupOptions * ServerlessBackupOptions `json:"serverlessBackupOptions"`
5157}
5258
5359// ServerlessProviderSettings represents the Provider Settings of serverless instances.
@@ -57,6 +63,11 @@ type ServerlessProviderSettings struct {
5763 RegionName string `json:"regionName,omitempty"`
5864}
5965
66+ // ServerlessBackupOptions Serverless Continuous Backup.
67+ type ServerlessBackupOptions struct {
68+ ServerlessContinuousBackupEnabled * bool `json:"serverlessContinuousBackupEnabled,omitempty"`
69+ }
70+
6071// List gets all serverless instances in the specified project.
6172//
6273// See more: https://docs.atlas.mongodb.com/reference/api/serverless/return-all-serverless-instances/
@@ -138,6 +149,34 @@ func (s *ServerlessInstancesServiceOp) Create(ctx context.Context, projectID str
138149 return root , resp , err
139150}
140151
152+ // Update one serverless instance in the specified project..
153+ //
154+ // See more: https://www.mongodb.com/docs/atlas/reference/api/serverless/update-one-serverless-instance/
155+ func (s * ServerlessInstancesServiceOp ) Update (ctx context.Context , projectID , instanceName string , bodyParams * ServerlessUpdateRequestParams ) (* Cluster , * Response , error ) {
156+ if projectID == "" {
157+ return nil , nil , NewArgError ("projectID" , "must be set" )
158+ }
159+ if instanceName == "" {
160+ return nil , nil , NewArgError ("instanceName" , "must be set" )
161+ }
162+
163+ basePath := fmt .Sprintf (serverlessInstancesPath , projectID )
164+ path := fmt .Sprintf ("%s/%s" , basePath , instanceName )
165+
166+ req , err := s .Client .NewRequest (ctx , http .MethodPatch , path , bodyParams )
167+ if err != nil {
168+ return nil , nil , err
169+ }
170+
171+ root := new (Cluster )
172+ resp , err := s .Client .Do (ctx , req , root )
173+ if err != nil {
174+ return nil , resp , err
175+ }
176+
177+ return root , resp , err
178+ }
179+
141180// Delete deletes one serverless instance in the specified project.
142181//
143182// See more: https://docs.atlas.mongodb.com/reference/api/serverless/remove-one-serverless-instance/
0 commit comments