...

Source file src/github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2022-08-15/documentdb/mongodbresources.go

Documentation: github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2022-08-15/documentdb

     1  package documentdb
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"github.com/Azure/go-autorest/autorest"
    12  	"github.com/Azure/go-autorest/autorest/azure"
    13  	"github.com/Azure/go-autorest/autorest/validation"
    14  	"github.com/Azure/go-autorest/tracing"
    15  	"net/http"
    16  )
    17  
    18  // MongoDBResourcesClient is the client for the MongoDBResources methods of the Documentdb service.
    19  type MongoDBResourcesClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client.
    24  func NewMongoDBResourcesClient(subscriptionID string) MongoDBResourcesClient {
    25  	return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient client using a custom
    29  // endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
    30  // stack).
    31  func NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string) MongoDBResourcesClient {
    32  	return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection
    36  // Parameters:
    37  // resourceGroupName - the name of the resource group. The name is case insensitive.
    38  // accountName - cosmos DB database account name.
    39  // databaseName - cosmos DB database name.
    40  // collectionName - cosmos DB collection name.
    41  // createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection.
    42  func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) {
    43  	if tracing.IsEnabled() {
    44  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection")
    45  		defer func() {
    46  			sc := -1
    47  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
    48  				sc = result.FutureAPI.Response().StatusCode
    49  			}
    50  			tracing.EndSpan(ctx, sc, err)
    51  		}()
    52  	}
    53  	if err := validation.Validate([]validation.Validation{
    54  		{TargetValue: client.SubscriptionID,
    55  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
    56  		{TargetValue: resourceGroupName,
    57  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
    58  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
    59  		{TargetValue: accountName,
    60  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
    61  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
    62  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
    63  		{TargetValue: createUpdateMongoDBCollectionParameters,
    64  			Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true,
    65  				Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
    66  					Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
    67  				}}}}}); err != nil {
    68  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error())
    69  	}
    70  
    71  	req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters)
    72  	if err != nil {
    73  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request")
    74  		return
    75  	}
    76  
    77  	result, err = client.CreateUpdateMongoDBCollectionSender(req)
    78  	if err != nil {
    79  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request")
    80  		return
    81  	}
    82  
    83  	return
    84  }
    85  
    86  // CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request.
    87  func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) {
    88  	pathParameters := map[string]interface{}{
    89  		"accountName":       autorest.Encode("path", accountName),
    90  		"collectionName":    autorest.Encode("path", collectionName),
    91  		"databaseName":      autorest.Encode("path", databaseName),
    92  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
    93  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    94  	}
    95  
    96  	const APIVersion = "2022-08-15"
    97  	queryParameters := map[string]interface{}{
    98  		"api-version": APIVersion,
    99  	}
   100  
   101  	preparer := autorest.CreatePreparer(
   102  		autorest.AsContentType("application/json; charset=utf-8"),
   103  		autorest.AsPut(),
   104  		autorest.WithBaseURL(client.BaseURI),
   105  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters),
   106  		autorest.WithJSON(createUpdateMongoDBCollectionParameters),
   107  		autorest.WithQueryParameters(queryParameters))
   108  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   109  }
   110  
   111  // CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the
   112  // http.Response Body if it receives an error.
   113  func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) {
   114  	var resp *http.Response
   115  	future.FutureAPI = &azure.Future{}
   116  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   117  	if err != nil {
   118  		return
   119  	}
   120  	var azf azure.Future
   121  	azf, err = azure.NewFutureFromResponse(resp)
   122  	future.FutureAPI = &azf
   123  	future.Result = future.result
   124  	return
   125  }
   126  
   127  // CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always
   128  // closes the http.Response Body.
   129  func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) {
   130  	err = autorest.Respond(
   131  		resp,
   132  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   133  		autorest.ByUnmarshallingJSON(&result),
   134  		autorest.ByClosing())
   135  	result.Response = autorest.Response{Response: resp}
   136  	return
   137  }
   138  
   139  // CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database
   140  // Parameters:
   141  // resourceGroupName - the name of the resource group. The name is case insensitive.
   142  // accountName - cosmos DB database account name.
   143  // databaseName - cosmos DB database name.
   144  // createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database.
   145  func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) {
   146  	if tracing.IsEnabled() {
   147  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase")
   148  		defer func() {
   149  			sc := -1
   150  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   151  				sc = result.FutureAPI.Response().StatusCode
   152  			}
   153  			tracing.EndSpan(ctx, sc, err)
   154  		}()
   155  	}
   156  	if err := validation.Validate([]validation.Validation{
   157  		{TargetValue: client.SubscriptionID,
   158  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   159  		{TargetValue: resourceGroupName,
   160  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   161  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   162  		{TargetValue: accountName,
   163  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   164  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   165  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
   166  		{TargetValue: createUpdateMongoDBDatabaseParameters,
   167  			Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true,
   168  				Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
   169  					Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
   170  				}}}}}); err != nil {
   171  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error())
   172  	}
   173  
   174  	req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters)
   175  	if err != nil {
   176  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request")
   177  		return
   178  	}
   179  
   180  	result, err = client.CreateUpdateMongoDBDatabaseSender(req)
   181  	if err != nil {
   182  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request")
   183  		return
   184  	}
   185  
   186  	return
   187  }
   188  
   189  // CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request.
   190  func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) {
   191  	pathParameters := map[string]interface{}{
   192  		"accountName":       autorest.Encode("path", accountName),
   193  		"databaseName":      autorest.Encode("path", databaseName),
   194  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   195  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   196  	}
   197  
   198  	const APIVersion = "2022-08-15"
   199  	queryParameters := map[string]interface{}{
   200  		"api-version": APIVersion,
   201  	}
   202  
   203  	preparer := autorest.CreatePreparer(
   204  		autorest.AsContentType("application/json; charset=utf-8"),
   205  		autorest.AsPut(),
   206  		autorest.WithBaseURL(client.BaseURI),
   207  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters),
   208  		autorest.WithJSON(createUpdateMongoDBDatabaseParameters),
   209  		autorest.WithQueryParameters(queryParameters))
   210  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   211  }
   212  
   213  // CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the
   214  // http.Response Body if it receives an error.
   215  func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) {
   216  	var resp *http.Response
   217  	future.FutureAPI = &azure.Future{}
   218  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   219  	if err != nil {
   220  		return
   221  	}
   222  	var azf azure.Future
   223  	azf, err = azure.NewFutureFromResponse(resp)
   224  	future.FutureAPI = &azf
   225  	future.Result = future.result
   226  	return
   227  }
   228  
   229  // CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always
   230  // closes the http.Response Body.
   231  func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) {
   232  	err = autorest.Respond(
   233  		resp,
   234  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   235  		autorest.ByUnmarshallingJSON(&result),
   236  		autorest.ByClosing())
   237  	result.Response = autorest.Response{Response: resp}
   238  	return
   239  }
   240  
   241  // CreateUpdateMongoRoleDefinition creates or updates an Azure Cosmos DB Mongo Role Definition.
   242  // Parameters:
   243  // mongoRoleDefinitionID - the ID for the Role Definition {dbName.roleName}.
   244  // resourceGroupName - the name of the resource group. The name is case insensitive.
   245  // accountName - cosmos DB database account name.
   246  // createUpdateMongoRoleDefinitionParameters - the properties required to create or update a Role Definition.
   247  func (client MongoDBResourcesClient) CreateUpdateMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoRoleDefinitionParameters MongoRoleDefinitionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoRoleDefinitionFuture, err error) {
   248  	if tracing.IsEnabled() {
   249  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoRoleDefinition")
   250  		defer func() {
   251  			sc := -1
   252  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   253  				sc = result.FutureAPI.Response().StatusCode
   254  			}
   255  			tracing.EndSpan(ctx, sc, err)
   256  		}()
   257  	}
   258  	if err := validation.Validate([]validation.Validation{
   259  		{TargetValue: client.SubscriptionID,
   260  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   261  		{TargetValue: resourceGroupName,
   262  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   263  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   264  		{TargetValue: accountName,
   265  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   266  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   267  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   268  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoRoleDefinition", err.Error())
   269  	}
   270  
   271  	req, err := client.CreateUpdateMongoRoleDefinitionPreparer(ctx, mongoRoleDefinitionID, resourceGroupName, accountName, createUpdateMongoRoleDefinitionParameters)
   272  	if err != nil {
   273  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoRoleDefinition", nil, "Failure preparing request")
   274  		return
   275  	}
   276  
   277  	result, err = client.CreateUpdateMongoRoleDefinitionSender(req)
   278  	if err != nil {
   279  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoRoleDefinition", result.Response(), "Failure sending request")
   280  		return
   281  	}
   282  
   283  	return
   284  }
   285  
   286  // CreateUpdateMongoRoleDefinitionPreparer prepares the CreateUpdateMongoRoleDefinition request.
   287  func (client MongoDBResourcesClient) CreateUpdateMongoRoleDefinitionPreparer(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoRoleDefinitionParameters MongoRoleDefinitionCreateUpdateParameters) (*http.Request, error) {
   288  	pathParameters := map[string]interface{}{
   289  		"accountName":           autorest.Encode("path", accountName),
   290  		"mongoRoleDefinitionId": autorest.Encode("path", mongoRoleDefinitionID),
   291  		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
   292  		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
   293  	}
   294  
   295  	const APIVersion = "2022-08-15"
   296  	queryParameters := map[string]interface{}{
   297  		"api-version": APIVersion,
   298  	}
   299  
   300  	preparer := autorest.CreatePreparer(
   301  		autorest.AsContentType("application/json; charset=utf-8"),
   302  		autorest.AsPut(),
   303  		autorest.WithBaseURL(client.BaseURI),
   304  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}", pathParameters),
   305  		autorest.WithJSON(createUpdateMongoRoleDefinitionParameters),
   306  		autorest.WithQueryParameters(queryParameters))
   307  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   308  }
   309  
   310  // CreateUpdateMongoRoleDefinitionSender sends the CreateUpdateMongoRoleDefinition request. The method will close the
   311  // http.Response Body if it receives an error.
   312  func (client MongoDBResourcesClient) CreateUpdateMongoRoleDefinitionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoRoleDefinitionFuture, err error) {
   313  	var resp *http.Response
   314  	future.FutureAPI = &azure.Future{}
   315  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   316  	if err != nil {
   317  		return
   318  	}
   319  	var azf azure.Future
   320  	azf, err = azure.NewFutureFromResponse(resp)
   321  	future.FutureAPI = &azf
   322  	future.Result = future.result
   323  	return
   324  }
   325  
   326  // CreateUpdateMongoRoleDefinitionResponder handles the response to the CreateUpdateMongoRoleDefinition request. The method always
   327  // closes the http.Response Body.
   328  func (client MongoDBResourcesClient) CreateUpdateMongoRoleDefinitionResponder(resp *http.Response) (result MongoRoleDefinitionGetResults, err error) {
   329  	err = autorest.Respond(
   330  		resp,
   331  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   332  		autorest.ByUnmarshallingJSON(&result),
   333  		autorest.ByClosing())
   334  	result.Response = autorest.Response{Response: resp}
   335  	return
   336  }
   337  
   338  // CreateUpdateMongoUserDefinition creates or updates an Azure Cosmos DB Mongo User Definition.
   339  // Parameters:
   340  // mongoUserDefinitionID - the ID for the User Definition {dbName.userName}.
   341  // resourceGroupName - the name of the resource group. The name is case insensitive.
   342  // accountName - cosmos DB database account name.
   343  // createUpdateMongoUserDefinitionParameters - the properties required to create or update a User Definition.
   344  func (client MongoDBResourcesClient) CreateUpdateMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoUserDefinitionParameters MongoUserDefinitionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoUserDefinitionFuture, err error) {
   345  	if tracing.IsEnabled() {
   346  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoUserDefinition")
   347  		defer func() {
   348  			sc := -1
   349  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   350  				sc = result.FutureAPI.Response().StatusCode
   351  			}
   352  			tracing.EndSpan(ctx, sc, err)
   353  		}()
   354  	}
   355  	if err := validation.Validate([]validation.Validation{
   356  		{TargetValue: client.SubscriptionID,
   357  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   358  		{TargetValue: resourceGroupName,
   359  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   360  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   361  		{TargetValue: accountName,
   362  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   363  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   364  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   365  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoUserDefinition", err.Error())
   366  	}
   367  
   368  	req, err := client.CreateUpdateMongoUserDefinitionPreparer(ctx, mongoUserDefinitionID, resourceGroupName, accountName, createUpdateMongoUserDefinitionParameters)
   369  	if err != nil {
   370  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoUserDefinition", nil, "Failure preparing request")
   371  		return
   372  	}
   373  
   374  	result, err = client.CreateUpdateMongoUserDefinitionSender(req)
   375  	if err != nil {
   376  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoUserDefinition", result.Response(), "Failure sending request")
   377  		return
   378  	}
   379  
   380  	return
   381  }
   382  
   383  // CreateUpdateMongoUserDefinitionPreparer prepares the CreateUpdateMongoUserDefinition request.
   384  func (client MongoDBResourcesClient) CreateUpdateMongoUserDefinitionPreparer(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoUserDefinitionParameters MongoUserDefinitionCreateUpdateParameters) (*http.Request, error) {
   385  	pathParameters := map[string]interface{}{
   386  		"accountName":           autorest.Encode("path", accountName),
   387  		"mongoUserDefinitionId": autorest.Encode("path", mongoUserDefinitionID),
   388  		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
   389  		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
   390  	}
   391  
   392  	const APIVersion = "2022-08-15"
   393  	queryParameters := map[string]interface{}{
   394  		"api-version": APIVersion,
   395  	}
   396  
   397  	preparer := autorest.CreatePreparer(
   398  		autorest.AsContentType("application/json; charset=utf-8"),
   399  		autorest.AsPut(),
   400  		autorest.WithBaseURL(client.BaseURI),
   401  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}", pathParameters),
   402  		autorest.WithJSON(createUpdateMongoUserDefinitionParameters),
   403  		autorest.WithQueryParameters(queryParameters))
   404  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   405  }
   406  
   407  // CreateUpdateMongoUserDefinitionSender sends the CreateUpdateMongoUserDefinition request. The method will close the
   408  // http.Response Body if it receives an error.
   409  func (client MongoDBResourcesClient) CreateUpdateMongoUserDefinitionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoUserDefinitionFuture, err error) {
   410  	var resp *http.Response
   411  	future.FutureAPI = &azure.Future{}
   412  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   413  	if err != nil {
   414  		return
   415  	}
   416  	var azf azure.Future
   417  	azf, err = azure.NewFutureFromResponse(resp)
   418  	future.FutureAPI = &azf
   419  	future.Result = future.result
   420  	return
   421  }
   422  
   423  // CreateUpdateMongoUserDefinitionResponder handles the response to the CreateUpdateMongoUserDefinition request. The method always
   424  // closes the http.Response Body.
   425  func (client MongoDBResourcesClient) CreateUpdateMongoUserDefinitionResponder(resp *http.Response) (result MongoUserDefinitionGetResults, err error) {
   426  	err = autorest.Respond(
   427  		resp,
   428  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   429  		autorest.ByUnmarshallingJSON(&result),
   430  		autorest.ByClosing())
   431  	result.Response = autorest.Response{Response: resp}
   432  	return
   433  }
   434  
   435  // DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection.
   436  // Parameters:
   437  // resourceGroupName - the name of the resource group. The name is case insensitive.
   438  // accountName - cosmos DB database account name.
   439  // databaseName - cosmos DB database name.
   440  // collectionName - cosmos DB collection name.
   441  func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) {
   442  	if tracing.IsEnabled() {
   443  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection")
   444  		defer func() {
   445  			sc := -1
   446  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   447  				sc = result.FutureAPI.Response().StatusCode
   448  			}
   449  			tracing.EndSpan(ctx, sc, err)
   450  		}()
   451  	}
   452  	if err := validation.Validate([]validation.Validation{
   453  		{TargetValue: client.SubscriptionID,
   454  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   455  		{TargetValue: resourceGroupName,
   456  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   457  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   458  		{TargetValue: accountName,
   459  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   460  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   461  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   462  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error())
   463  	}
   464  
   465  	req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName)
   466  	if err != nil {
   467  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request")
   468  		return
   469  	}
   470  
   471  	result, err = client.DeleteMongoDBCollectionSender(req)
   472  	if err != nil {
   473  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request")
   474  		return
   475  	}
   476  
   477  	return
   478  }
   479  
   480  // DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request.
   481  func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) {
   482  	pathParameters := map[string]interface{}{
   483  		"accountName":       autorest.Encode("path", accountName),
   484  		"collectionName":    autorest.Encode("path", collectionName),
   485  		"databaseName":      autorest.Encode("path", databaseName),
   486  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   487  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   488  	}
   489  
   490  	const APIVersion = "2022-08-15"
   491  	queryParameters := map[string]interface{}{
   492  		"api-version": APIVersion,
   493  	}
   494  
   495  	preparer := autorest.CreatePreparer(
   496  		autorest.AsDelete(),
   497  		autorest.WithBaseURL(client.BaseURI),
   498  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters),
   499  		autorest.WithQueryParameters(queryParameters))
   500  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   501  }
   502  
   503  // DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the
   504  // http.Response Body if it receives an error.
   505  func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, err error) {
   506  	var resp *http.Response
   507  	future.FutureAPI = &azure.Future{}
   508  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   509  	if err != nil {
   510  		return
   511  	}
   512  	var azf azure.Future
   513  	azf, err = azure.NewFutureFromResponse(resp)
   514  	future.FutureAPI = &azf
   515  	future.Result = future.result
   516  	return
   517  }
   518  
   519  // DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always
   520  // closes the http.Response Body.
   521  func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(resp *http.Response) (result autorest.Response, err error) {
   522  	err = autorest.Respond(
   523  		resp,
   524  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   525  		autorest.ByClosing())
   526  	result.Response = resp
   527  	return
   528  }
   529  
   530  // DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database.
   531  // Parameters:
   532  // resourceGroupName - the name of the resource group. The name is case insensitive.
   533  // accountName - cosmos DB database account name.
   534  // databaseName - cosmos DB database name.
   535  func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) {
   536  	if tracing.IsEnabled() {
   537  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase")
   538  		defer func() {
   539  			sc := -1
   540  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   541  				sc = result.FutureAPI.Response().StatusCode
   542  			}
   543  			tracing.EndSpan(ctx, sc, err)
   544  		}()
   545  	}
   546  	if err := validation.Validate([]validation.Validation{
   547  		{TargetValue: client.SubscriptionID,
   548  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   549  		{TargetValue: resourceGroupName,
   550  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   551  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   552  		{TargetValue: accountName,
   553  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   554  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   555  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   556  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error())
   557  	}
   558  
   559  	req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
   560  	if err != nil {
   561  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request")
   562  		return
   563  	}
   564  
   565  	result, err = client.DeleteMongoDBDatabaseSender(req)
   566  	if err != nil {
   567  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request")
   568  		return
   569  	}
   570  
   571  	return
   572  }
   573  
   574  // DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request.
   575  func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
   576  	pathParameters := map[string]interface{}{
   577  		"accountName":       autorest.Encode("path", accountName),
   578  		"databaseName":      autorest.Encode("path", databaseName),
   579  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   580  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   581  	}
   582  
   583  	const APIVersion = "2022-08-15"
   584  	queryParameters := map[string]interface{}{
   585  		"api-version": APIVersion,
   586  	}
   587  
   588  	preparer := autorest.CreatePreparer(
   589  		autorest.AsDelete(),
   590  		autorest.WithBaseURL(client.BaseURI),
   591  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters),
   592  		autorest.WithQueryParameters(queryParameters))
   593  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   594  }
   595  
   596  // DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the
   597  // http.Response Body if it receives an error.
   598  func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) {
   599  	var resp *http.Response
   600  	future.FutureAPI = &azure.Future{}
   601  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   602  	if err != nil {
   603  		return
   604  	}
   605  	var azf azure.Future
   606  	azf, err = azure.NewFutureFromResponse(resp)
   607  	future.FutureAPI = &azf
   608  	future.Result = future.result
   609  	return
   610  }
   611  
   612  // DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always
   613  // closes the http.Response Body.
   614  func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(resp *http.Response) (result autorest.Response, err error) {
   615  	err = autorest.Respond(
   616  		resp,
   617  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   618  		autorest.ByClosing())
   619  	result.Response = resp
   620  	return
   621  }
   622  
   623  // DeleteMongoRoleDefinition deletes an existing Azure Cosmos DB Mongo Role Definition.
   624  // Parameters:
   625  // mongoRoleDefinitionID - the ID for the Role Definition {dbName.roleName}.
   626  // resourceGroupName - the name of the resource group. The name is case insensitive.
   627  // accountName - cosmos DB database account name.
   628  func (client MongoDBResourcesClient) DeleteMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string) (result MongoDBResourcesDeleteMongoRoleDefinitionFuture, err error) {
   629  	if tracing.IsEnabled() {
   630  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoRoleDefinition")
   631  		defer func() {
   632  			sc := -1
   633  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   634  				sc = result.FutureAPI.Response().StatusCode
   635  			}
   636  			tracing.EndSpan(ctx, sc, err)
   637  		}()
   638  	}
   639  	if err := validation.Validate([]validation.Validation{
   640  		{TargetValue: client.SubscriptionID,
   641  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   642  		{TargetValue: resourceGroupName,
   643  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   644  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   645  		{TargetValue: accountName,
   646  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   647  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   648  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   649  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoRoleDefinition", err.Error())
   650  	}
   651  
   652  	req, err := client.DeleteMongoRoleDefinitionPreparer(ctx, mongoRoleDefinitionID, resourceGroupName, accountName)
   653  	if err != nil {
   654  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoRoleDefinition", nil, "Failure preparing request")
   655  		return
   656  	}
   657  
   658  	result, err = client.DeleteMongoRoleDefinitionSender(req)
   659  	if err != nil {
   660  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoRoleDefinition", result.Response(), "Failure sending request")
   661  		return
   662  	}
   663  
   664  	return
   665  }
   666  
   667  // DeleteMongoRoleDefinitionPreparer prepares the DeleteMongoRoleDefinition request.
   668  func (client MongoDBResourcesClient) DeleteMongoRoleDefinitionPreparer(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) {
   669  	pathParameters := map[string]interface{}{
   670  		"accountName":           autorest.Encode("path", accountName),
   671  		"mongoRoleDefinitionId": autorest.Encode("path", mongoRoleDefinitionID),
   672  		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
   673  		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
   674  	}
   675  
   676  	const APIVersion = "2022-08-15"
   677  	queryParameters := map[string]interface{}{
   678  		"api-version": APIVersion,
   679  	}
   680  
   681  	preparer := autorest.CreatePreparer(
   682  		autorest.AsDelete(),
   683  		autorest.WithBaseURL(client.BaseURI),
   684  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}", pathParameters),
   685  		autorest.WithQueryParameters(queryParameters))
   686  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   687  }
   688  
   689  // DeleteMongoRoleDefinitionSender sends the DeleteMongoRoleDefinition request. The method will close the
   690  // http.Response Body if it receives an error.
   691  func (client MongoDBResourcesClient) DeleteMongoRoleDefinitionSender(req *http.Request) (future MongoDBResourcesDeleteMongoRoleDefinitionFuture, err error) {
   692  	var resp *http.Response
   693  	future.FutureAPI = &azure.Future{}
   694  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   695  	if err != nil {
   696  		return
   697  	}
   698  	var azf azure.Future
   699  	azf, err = azure.NewFutureFromResponse(resp)
   700  	future.FutureAPI = &azf
   701  	future.Result = future.result
   702  	return
   703  }
   704  
   705  // DeleteMongoRoleDefinitionResponder handles the response to the DeleteMongoRoleDefinition request. The method always
   706  // closes the http.Response Body.
   707  func (client MongoDBResourcesClient) DeleteMongoRoleDefinitionResponder(resp *http.Response) (result autorest.Response, err error) {
   708  	err = autorest.Respond(
   709  		resp,
   710  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   711  		autorest.ByClosing())
   712  	result.Response = resp
   713  	return
   714  }
   715  
   716  // DeleteMongoUserDefinition deletes an existing Azure Cosmos DB Mongo User Definition.
   717  // Parameters:
   718  // mongoUserDefinitionID - the ID for the User Definition {dbName.userName}.
   719  // resourceGroupName - the name of the resource group. The name is case insensitive.
   720  // accountName - cosmos DB database account name.
   721  func (client MongoDBResourcesClient) DeleteMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string) (result MongoDBResourcesDeleteMongoUserDefinitionFuture, err error) {
   722  	if tracing.IsEnabled() {
   723  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoUserDefinition")
   724  		defer func() {
   725  			sc := -1
   726  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   727  				sc = result.FutureAPI.Response().StatusCode
   728  			}
   729  			tracing.EndSpan(ctx, sc, err)
   730  		}()
   731  	}
   732  	if err := validation.Validate([]validation.Validation{
   733  		{TargetValue: client.SubscriptionID,
   734  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   735  		{TargetValue: resourceGroupName,
   736  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   737  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   738  		{TargetValue: accountName,
   739  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   740  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   741  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   742  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoUserDefinition", err.Error())
   743  	}
   744  
   745  	req, err := client.DeleteMongoUserDefinitionPreparer(ctx, mongoUserDefinitionID, resourceGroupName, accountName)
   746  	if err != nil {
   747  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoUserDefinition", nil, "Failure preparing request")
   748  		return
   749  	}
   750  
   751  	result, err = client.DeleteMongoUserDefinitionSender(req)
   752  	if err != nil {
   753  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoUserDefinition", result.Response(), "Failure sending request")
   754  		return
   755  	}
   756  
   757  	return
   758  }
   759  
   760  // DeleteMongoUserDefinitionPreparer prepares the DeleteMongoUserDefinition request.
   761  func (client MongoDBResourcesClient) DeleteMongoUserDefinitionPreparer(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) {
   762  	pathParameters := map[string]interface{}{
   763  		"accountName":           autorest.Encode("path", accountName),
   764  		"mongoUserDefinitionId": autorest.Encode("path", mongoUserDefinitionID),
   765  		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
   766  		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
   767  	}
   768  
   769  	const APIVersion = "2022-08-15"
   770  	queryParameters := map[string]interface{}{
   771  		"api-version": APIVersion,
   772  	}
   773  
   774  	preparer := autorest.CreatePreparer(
   775  		autorest.AsDelete(),
   776  		autorest.WithBaseURL(client.BaseURI),
   777  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}", pathParameters),
   778  		autorest.WithQueryParameters(queryParameters))
   779  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   780  }
   781  
   782  // DeleteMongoUserDefinitionSender sends the DeleteMongoUserDefinition request. The method will close the
   783  // http.Response Body if it receives an error.
   784  func (client MongoDBResourcesClient) DeleteMongoUserDefinitionSender(req *http.Request) (future MongoDBResourcesDeleteMongoUserDefinitionFuture, err error) {
   785  	var resp *http.Response
   786  	future.FutureAPI = &azure.Future{}
   787  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   788  	if err != nil {
   789  		return
   790  	}
   791  	var azf azure.Future
   792  	azf, err = azure.NewFutureFromResponse(resp)
   793  	future.FutureAPI = &azf
   794  	future.Result = future.result
   795  	return
   796  }
   797  
   798  // DeleteMongoUserDefinitionResponder handles the response to the DeleteMongoUserDefinition request. The method always
   799  // closes the http.Response Body.
   800  func (client MongoDBResourcesClient) DeleteMongoUserDefinitionResponder(resp *http.Response) (result autorest.Response, err error) {
   801  	err = autorest.Respond(
   802  		resp,
   803  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   804  		autorest.ByClosing())
   805  	result.Response = resp
   806  	return
   807  }
   808  
   809  // GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account.
   810  // Parameters:
   811  // resourceGroupName - the name of the resource group. The name is case insensitive.
   812  // accountName - cosmos DB database account name.
   813  // databaseName - cosmos DB database name.
   814  // collectionName - cosmos DB collection name.
   815  func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) {
   816  	if tracing.IsEnabled() {
   817  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection")
   818  		defer func() {
   819  			sc := -1
   820  			if result.Response.Response != nil {
   821  				sc = result.Response.Response.StatusCode
   822  			}
   823  			tracing.EndSpan(ctx, sc, err)
   824  		}()
   825  	}
   826  	if err := validation.Validate([]validation.Validation{
   827  		{TargetValue: client.SubscriptionID,
   828  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   829  		{TargetValue: resourceGroupName,
   830  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   831  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   832  		{TargetValue: accountName,
   833  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   834  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   835  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   836  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error())
   837  	}
   838  
   839  	req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName)
   840  	if err != nil {
   841  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request")
   842  		return
   843  	}
   844  
   845  	resp, err := client.GetMongoDBCollectionSender(req)
   846  	if err != nil {
   847  		result.Response = autorest.Response{Response: resp}
   848  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request")
   849  		return
   850  	}
   851  
   852  	result, err = client.GetMongoDBCollectionResponder(resp)
   853  	if err != nil {
   854  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request")
   855  		return
   856  	}
   857  
   858  	return
   859  }
   860  
   861  // GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request.
   862  func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) {
   863  	pathParameters := map[string]interface{}{
   864  		"accountName":       autorest.Encode("path", accountName),
   865  		"collectionName":    autorest.Encode("path", collectionName),
   866  		"databaseName":      autorest.Encode("path", databaseName),
   867  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   868  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   869  	}
   870  
   871  	const APIVersion = "2022-08-15"
   872  	queryParameters := map[string]interface{}{
   873  		"api-version": APIVersion,
   874  	}
   875  
   876  	preparer := autorest.CreatePreparer(
   877  		autorest.AsGet(),
   878  		autorest.WithBaseURL(client.BaseURI),
   879  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters),
   880  		autorest.WithQueryParameters(queryParameters))
   881  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   882  }
   883  
   884  // GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the
   885  // http.Response Body if it receives an error.
   886  func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) {
   887  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   888  }
   889  
   890  // GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always
   891  // closes the http.Response Body.
   892  func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) {
   893  	err = autorest.Respond(
   894  		resp,
   895  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   896  		autorest.ByUnmarshallingJSON(&result),
   897  		autorest.ByClosing())
   898  	result.Response = autorest.Response{Response: resp}
   899  	return
   900  }
   901  
   902  // GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB
   903  // database account with the provided name.
   904  // Parameters:
   905  // resourceGroupName - the name of the resource group. The name is case insensitive.
   906  // accountName - cosmos DB database account name.
   907  // databaseName - cosmos DB database name.
   908  // collectionName - cosmos DB collection name.
   909  func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) {
   910  	if tracing.IsEnabled() {
   911  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput")
   912  		defer func() {
   913  			sc := -1
   914  			if result.Response.Response != nil {
   915  				sc = result.Response.Response.StatusCode
   916  			}
   917  			tracing.EndSpan(ctx, sc, err)
   918  		}()
   919  	}
   920  	if err := validation.Validate([]validation.Validation{
   921  		{TargetValue: client.SubscriptionID,
   922  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   923  		{TargetValue: resourceGroupName,
   924  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   925  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   926  		{TargetValue: accountName,
   927  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   928  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   929  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   930  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error())
   931  	}
   932  
   933  	req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName)
   934  	if err != nil {
   935  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request")
   936  		return
   937  	}
   938  
   939  	resp, err := client.GetMongoDBCollectionThroughputSender(req)
   940  	if err != nil {
   941  		result.Response = autorest.Response{Response: resp}
   942  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request")
   943  		return
   944  	}
   945  
   946  	result, err = client.GetMongoDBCollectionThroughputResponder(resp)
   947  	if err != nil {
   948  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request")
   949  		return
   950  	}
   951  
   952  	return
   953  }
   954  
   955  // GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request.
   956  func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) {
   957  	pathParameters := map[string]interface{}{
   958  		"accountName":       autorest.Encode("path", accountName),
   959  		"collectionName":    autorest.Encode("path", collectionName),
   960  		"databaseName":      autorest.Encode("path", databaseName),
   961  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   962  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   963  	}
   964  
   965  	const APIVersion = "2022-08-15"
   966  	queryParameters := map[string]interface{}{
   967  		"api-version": APIVersion,
   968  	}
   969  
   970  	preparer := autorest.CreatePreparer(
   971  		autorest.AsGet(),
   972  		autorest.WithBaseURL(client.BaseURI),
   973  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters),
   974  		autorest.WithQueryParameters(queryParameters))
   975  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   976  }
   977  
   978  // GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the
   979  // http.Response Body if it receives an error.
   980  func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) {
   981  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   982  }
   983  
   984  // GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always
   985  // closes the http.Response Body.
   986  func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
   987  	err = autorest.Respond(
   988  		resp,
   989  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   990  		autorest.ByUnmarshallingJSON(&result),
   991  		autorest.ByClosing())
   992  	result.Response = autorest.Response{Response: resp}
   993  	return
   994  }
   995  
   996  // GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided
   997  // name.
   998  // Parameters:
   999  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1000  // accountName - cosmos DB database account name.
  1001  // databaseName - cosmos DB database name.
  1002  func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) {
  1003  	if tracing.IsEnabled() {
  1004  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase")
  1005  		defer func() {
  1006  			sc := -1
  1007  			if result.Response.Response != nil {
  1008  				sc = result.Response.Response.StatusCode
  1009  			}
  1010  			tracing.EndSpan(ctx, sc, err)
  1011  		}()
  1012  	}
  1013  	if err := validation.Validate([]validation.Validation{
  1014  		{TargetValue: client.SubscriptionID,
  1015  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1016  		{TargetValue: resourceGroupName,
  1017  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1018  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1019  		{TargetValue: accountName,
  1020  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1021  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1022  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1023  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error())
  1024  	}
  1025  
  1026  	req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
  1027  	if err != nil {
  1028  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request")
  1029  		return
  1030  	}
  1031  
  1032  	resp, err := client.GetMongoDBDatabaseSender(req)
  1033  	if err != nil {
  1034  		result.Response = autorest.Response{Response: resp}
  1035  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request")
  1036  		return
  1037  	}
  1038  
  1039  	result, err = client.GetMongoDBDatabaseResponder(resp)
  1040  	if err != nil {
  1041  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request")
  1042  		return
  1043  	}
  1044  
  1045  	return
  1046  }
  1047  
  1048  // GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request.
  1049  func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  1050  	pathParameters := map[string]interface{}{
  1051  		"accountName":       autorest.Encode("path", accountName),
  1052  		"databaseName":      autorest.Encode("path", databaseName),
  1053  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1054  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1055  	}
  1056  
  1057  	const APIVersion = "2022-08-15"
  1058  	queryParameters := map[string]interface{}{
  1059  		"api-version": APIVersion,
  1060  	}
  1061  
  1062  	preparer := autorest.CreatePreparer(
  1063  		autorest.AsGet(),
  1064  		autorest.WithBaseURL(client.BaseURI),
  1065  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters),
  1066  		autorest.WithQueryParameters(queryParameters))
  1067  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1068  }
  1069  
  1070  // GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the
  1071  // http.Response Body if it receives an error.
  1072  func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) {
  1073  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1074  }
  1075  
  1076  // GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always
  1077  // closes the http.Response Body.
  1078  func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) {
  1079  	err = autorest.Respond(
  1080  		resp,
  1081  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1082  		autorest.ByUnmarshallingJSON(&result),
  1083  		autorest.ByClosing())
  1084  	result.Response = autorest.Response{Response: resp}
  1085  	return
  1086  }
  1087  
  1088  // GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB
  1089  // database account with the provided name.
  1090  // Parameters:
  1091  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1092  // accountName - cosmos DB database account name.
  1093  // databaseName - cosmos DB database name.
  1094  func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) {
  1095  	if tracing.IsEnabled() {
  1096  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput")
  1097  		defer func() {
  1098  			sc := -1
  1099  			if result.Response.Response != nil {
  1100  				sc = result.Response.Response.StatusCode
  1101  			}
  1102  			tracing.EndSpan(ctx, sc, err)
  1103  		}()
  1104  	}
  1105  	if err := validation.Validate([]validation.Validation{
  1106  		{TargetValue: client.SubscriptionID,
  1107  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1108  		{TargetValue: resourceGroupName,
  1109  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1110  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1111  		{TargetValue: accountName,
  1112  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1113  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1114  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1115  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error())
  1116  	}
  1117  
  1118  	req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName)
  1119  	if err != nil {
  1120  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request")
  1121  		return
  1122  	}
  1123  
  1124  	resp, err := client.GetMongoDBDatabaseThroughputSender(req)
  1125  	if err != nil {
  1126  		result.Response = autorest.Response{Response: resp}
  1127  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request")
  1128  		return
  1129  	}
  1130  
  1131  	result, err = client.GetMongoDBDatabaseThroughputResponder(resp)
  1132  	if err != nil {
  1133  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request")
  1134  		return
  1135  	}
  1136  
  1137  	return
  1138  }
  1139  
  1140  // GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request.
  1141  func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  1142  	pathParameters := map[string]interface{}{
  1143  		"accountName":       autorest.Encode("path", accountName),
  1144  		"databaseName":      autorest.Encode("path", databaseName),
  1145  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1146  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1147  	}
  1148  
  1149  	const APIVersion = "2022-08-15"
  1150  	queryParameters := map[string]interface{}{
  1151  		"api-version": APIVersion,
  1152  	}
  1153  
  1154  	preparer := autorest.CreatePreparer(
  1155  		autorest.AsGet(),
  1156  		autorest.WithBaseURL(client.BaseURI),
  1157  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters),
  1158  		autorest.WithQueryParameters(queryParameters))
  1159  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1160  }
  1161  
  1162  // GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the
  1163  // http.Response Body if it receives an error.
  1164  func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) {
  1165  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1166  }
  1167  
  1168  // GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always
  1169  // closes the http.Response Body.
  1170  func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1171  	err = autorest.Respond(
  1172  		resp,
  1173  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1174  		autorest.ByUnmarshallingJSON(&result),
  1175  		autorest.ByClosing())
  1176  	result.Response = autorest.Response{Response: resp}
  1177  	return
  1178  }
  1179  
  1180  // GetMongoRoleDefinition retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given
  1181  // Id.
  1182  // Parameters:
  1183  // mongoRoleDefinitionID - the ID for the Role Definition {dbName.roleName}.
  1184  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1185  // accountName - cosmos DB database account name.
  1186  func (client MongoDBResourcesClient) GetMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string) (result MongoRoleDefinitionGetResults, err error) {
  1187  	if tracing.IsEnabled() {
  1188  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoRoleDefinition")
  1189  		defer func() {
  1190  			sc := -1
  1191  			if result.Response.Response != nil {
  1192  				sc = result.Response.Response.StatusCode
  1193  			}
  1194  			tracing.EndSpan(ctx, sc, err)
  1195  		}()
  1196  	}
  1197  	if err := validation.Validate([]validation.Validation{
  1198  		{TargetValue: client.SubscriptionID,
  1199  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1200  		{TargetValue: resourceGroupName,
  1201  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1202  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1203  		{TargetValue: accountName,
  1204  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1205  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1206  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1207  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoRoleDefinition", err.Error())
  1208  	}
  1209  
  1210  	req, err := client.GetMongoRoleDefinitionPreparer(ctx, mongoRoleDefinitionID, resourceGroupName, accountName)
  1211  	if err != nil {
  1212  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoRoleDefinition", nil, "Failure preparing request")
  1213  		return
  1214  	}
  1215  
  1216  	resp, err := client.GetMongoRoleDefinitionSender(req)
  1217  	if err != nil {
  1218  		result.Response = autorest.Response{Response: resp}
  1219  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoRoleDefinition", resp, "Failure sending request")
  1220  		return
  1221  	}
  1222  
  1223  	result, err = client.GetMongoRoleDefinitionResponder(resp)
  1224  	if err != nil {
  1225  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoRoleDefinition", resp, "Failure responding to request")
  1226  		return
  1227  	}
  1228  
  1229  	return
  1230  }
  1231  
  1232  // GetMongoRoleDefinitionPreparer prepares the GetMongoRoleDefinition request.
  1233  func (client MongoDBResourcesClient) GetMongoRoleDefinitionPreparer(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) {
  1234  	pathParameters := map[string]interface{}{
  1235  		"accountName":           autorest.Encode("path", accountName),
  1236  		"mongoRoleDefinitionId": autorest.Encode("path", mongoRoleDefinitionID),
  1237  		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
  1238  		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
  1239  	}
  1240  
  1241  	const APIVersion = "2022-08-15"
  1242  	queryParameters := map[string]interface{}{
  1243  		"api-version": APIVersion,
  1244  	}
  1245  
  1246  	preparer := autorest.CreatePreparer(
  1247  		autorest.AsGet(),
  1248  		autorest.WithBaseURL(client.BaseURI),
  1249  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}", pathParameters),
  1250  		autorest.WithQueryParameters(queryParameters))
  1251  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1252  }
  1253  
  1254  // GetMongoRoleDefinitionSender sends the GetMongoRoleDefinition request. The method will close the
  1255  // http.Response Body if it receives an error.
  1256  func (client MongoDBResourcesClient) GetMongoRoleDefinitionSender(req *http.Request) (*http.Response, error) {
  1257  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1258  }
  1259  
  1260  // GetMongoRoleDefinitionResponder handles the response to the GetMongoRoleDefinition request. The method always
  1261  // closes the http.Response Body.
  1262  func (client MongoDBResourcesClient) GetMongoRoleDefinitionResponder(resp *http.Response) (result MongoRoleDefinitionGetResults, err error) {
  1263  	err = autorest.Respond(
  1264  		resp,
  1265  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1266  		autorest.ByUnmarshallingJSON(&result),
  1267  		autorest.ByClosing())
  1268  	result.Response = autorest.Response{Response: resp}
  1269  	return
  1270  }
  1271  
  1272  // GetMongoUserDefinition retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given
  1273  // Id.
  1274  // Parameters:
  1275  // mongoUserDefinitionID - the ID for the User Definition {dbName.userName}.
  1276  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1277  // accountName - cosmos DB database account name.
  1278  func (client MongoDBResourcesClient) GetMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string) (result MongoUserDefinitionGetResults, err error) {
  1279  	if tracing.IsEnabled() {
  1280  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoUserDefinition")
  1281  		defer func() {
  1282  			sc := -1
  1283  			if result.Response.Response != nil {
  1284  				sc = result.Response.Response.StatusCode
  1285  			}
  1286  			tracing.EndSpan(ctx, sc, err)
  1287  		}()
  1288  	}
  1289  	if err := validation.Validate([]validation.Validation{
  1290  		{TargetValue: client.SubscriptionID,
  1291  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1292  		{TargetValue: resourceGroupName,
  1293  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1294  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1295  		{TargetValue: accountName,
  1296  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1297  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1298  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1299  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoUserDefinition", err.Error())
  1300  	}
  1301  
  1302  	req, err := client.GetMongoUserDefinitionPreparer(ctx, mongoUserDefinitionID, resourceGroupName, accountName)
  1303  	if err != nil {
  1304  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoUserDefinition", nil, "Failure preparing request")
  1305  		return
  1306  	}
  1307  
  1308  	resp, err := client.GetMongoUserDefinitionSender(req)
  1309  	if err != nil {
  1310  		result.Response = autorest.Response{Response: resp}
  1311  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoUserDefinition", resp, "Failure sending request")
  1312  		return
  1313  	}
  1314  
  1315  	result, err = client.GetMongoUserDefinitionResponder(resp)
  1316  	if err != nil {
  1317  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoUserDefinition", resp, "Failure responding to request")
  1318  		return
  1319  	}
  1320  
  1321  	return
  1322  }
  1323  
  1324  // GetMongoUserDefinitionPreparer prepares the GetMongoUserDefinition request.
  1325  func (client MongoDBResourcesClient) GetMongoUserDefinitionPreparer(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) {
  1326  	pathParameters := map[string]interface{}{
  1327  		"accountName":           autorest.Encode("path", accountName),
  1328  		"mongoUserDefinitionId": autorest.Encode("path", mongoUserDefinitionID),
  1329  		"resourceGroupName":     autorest.Encode("path", resourceGroupName),
  1330  		"subscriptionId":        autorest.Encode("path", client.SubscriptionID),
  1331  	}
  1332  
  1333  	const APIVersion = "2022-08-15"
  1334  	queryParameters := map[string]interface{}{
  1335  		"api-version": APIVersion,
  1336  	}
  1337  
  1338  	preparer := autorest.CreatePreparer(
  1339  		autorest.AsGet(),
  1340  		autorest.WithBaseURL(client.BaseURI),
  1341  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}", pathParameters),
  1342  		autorest.WithQueryParameters(queryParameters))
  1343  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1344  }
  1345  
  1346  // GetMongoUserDefinitionSender sends the GetMongoUserDefinition request. The method will close the
  1347  // http.Response Body if it receives an error.
  1348  func (client MongoDBResourcesClient) GetMongoUserDefinitionSender(req *http.Request) (*http.Response, error) {
  1349  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1350  }
  1351  
  1352  // GetMongoUserDefinitionResponder handles the response to the GetMongoUserDefinition request. The method always
  1353  // closes the http.Response Body.
  1354  func (client MongoDBResourcesClient) GetMongoUserDefinitionResponder(resp *http.Response) (result MongoUserDefinitionGetResults, err error) {
  1355  	err = autorest.Respond(
  1356  		resp,
  1357  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1358  		autorest.ByUnmarshallingJSON(&result),
  1359  		autorest.ByClosing())
  1360  	result.Response = autorest.Response{Response: resp}
  1361  	return
  1362  }
  1363  
  1364  // ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account.
  1365  // Parameters:
  1366  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1367  // accountName - cosmos DB database account name.
  1368  // databaseName - cosmos DB database name.
  1369  func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) {
  1370  	if tracing.IsEnabled() {
  1371  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections")
  1372  		defer func() {
  1373  			sc := -1
  1374  			if result.Response.Response != nil {
  1375  				sc = result.Response.Response.StatusCode
  1376  			}
  1377  			tracing.EndSpan(ctx, sc, err)
  1378  		}()
  1379  	}
  1380  	if err := validation.Validate([]validation.Validation{
  1381  		{TargetValue: client.SubscriptionID,
  1382  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1383  		{TargetValue: resourceGroupName,
  1384  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1385  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1386  		{TargetValue: accountName,
  1387  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1388  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1389  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1390  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error())
  1391  	}
  1392  
  1393  	req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName)
  1394  	if err != nil {
  1395  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request")
  1396  		return
  1397  	}
  1398  
  1399  	resp, err := client.ListMongoDBCollectionsSender(req)
  1400  	if err != nil {
  1401  		result.Response = autorest.Response{Response: resp}
  1402  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request")
  1403  		return
  1404  	}
  1405  
  1406  	result, err = client.ListMongoDBCollectionsResponder(resp)
  1407  	if err != nil {
  1408  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request")
  1409  		return
  1410  	}
  1411  
  1412  	return
  1413  }
  1414  
  1415  // ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request.
  1416  func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  1417  	pathParameters := map[string]interface{}{
  1418  		"accountName":       autorest.Encode("path", accountName),
  1419  		"databaseName":      autorest.Encode("path", databaseName),
  1420  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1421  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1422  	}
  1423  
  1424  	const APIVersion = "2022-08-15"
  1425  	queryParameters := map[string]interface{}{
  1426  		"api-version": APIVersion,
  1427  	}
  1428  
  1429  	preparer := autorest.CreatePreparer(
  1430  		autorest.AsGet(),
  1431  		autorest.WithBaseURL(client.BaseURI),
  1432  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters),
  1433  		autorest.WithQueryParameters(queryParameters))
  1434  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1435  }
  1436  
  1437  // ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the
  1438  // http.Response Body if it receives an error.
  1439  func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) {
  1440  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1441  }
  1442  
  1443  // ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always
  1444  // closes the http.Response Body.
  1445  func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) {
  1446  	err = autorest.Respond(
  1447  		resp,
  1448  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1449  		autorest.ByUnmarshallingJSON(&result),
  1450  		autorest.ByClosing())
  1451  	result.Response = autorest.Response{Response: resp}
  1452  	return
  1453  }
  1454  
  1455  // ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account.
  1456  // Parameters:
  1457  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1458  // accountName - cosmos DB database account name.
  1459  func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) {
  1460  	if tracing.IsEnabled() {
  1461  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases")
  1462  		defer func() {
  1463  			sc := -1
  1464  			if result.Response.Response != nil {
  1465  				sc = result.Response.Response.StatusCode
  1466  			}
  1467  			tracing.EndSpan(ctx, sc, err)
  1468  		}()
  1469  	}
  1470  	if err := validation.Validate([]validation.Validation{
  1471  		{TargetValue: client.SubscriptionID,
  1472  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1473  		{TargetValue: resourceGroupName,
  1474  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1475  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1476  		{TargetValue: accountName,
  1477  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1478  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1479  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1480  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error())
  1481  	}
  1482  
  1483  	req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName)
  1484  	if err != nil {
  1485  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request")
  1486  		return
  1487  	}
  1488  
  1489  	resp, err := client.ListMongoDBDatabasesSender(req)
  1490  	if err != nil {
  1491  		result.Response = autorest.Response{Response: resp}
  1492  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request")
  1493  		return
  1494  	}
  1495  
  1496  	result, err = client.ListMongoDBDatabasesResponder(resp)
  1497  	if err != nil {
  1498  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request")
  1499  		return
  1500  	}
  1501  
  1502  	return
  1503  }
  1504  
  1505  // ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request.
  1506  func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
  1507  	pathParameters := map[string]interface{}{
  1508  		"accountName":       autorest.Encode("path", accountName),
  1509  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1510  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1511  	}
  1512  
  1513  	const APIVersion = "2022-08-15"
  1514  	queryParameters := map[string]interface{}{
  1515  		"api-version": APIVersion,
  1516  	}
  1517  
  1518  	preparer := autorest.CreatePreparer(
  1519  		autorest.AsGet(),
  1520  		autorest.WithBaseURL(client.BaseURI),
  1521  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters),
  1522  		autorest.WithQueryParameters(queryParameters))
  1523  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1524  }
  1525  
  1526  // ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the
  1527  // http.Response Body if it receives an error.
  1528  func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) {
  1529  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1530  }
  1531  
  1532  // ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always
  1533  // closes the http.Response Body.
  1534  func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) {
  1535  	err = autorest.Respond(
  1536  		resp,
  1537  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1538  		autorest.ByUnmarshallingJSON(&result),
  1539  		autorest.ByClosing())
  1540  	result.Response = autorest.Response{Response: resp}
  1541  	return
  1542  }
  1543  
  1544  // ListMongoRoleDefinitions retrieves the list of all Azure Cosmos DB Mongo Role Definitions.
  1545  // Parameters:
  1546  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1547  // accountName - cosmos DB database account name.
  1548  func (client MongoDBResourcesClient) ListMongoRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MongoRoleDefinitionListResult, err error) {
  1549  	if tracing.IsEnabled() {
  1550  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoRoleDefinitions")
  1551  		defer func() {
  1552  			sc := -1
  1553  			if result.Response.Response != nil {
  1554  				sc = result.Response.Response.StatusCode
  1555  			}
  1556  			tracing.EndSpan(ctx, sc, err)
  1557  		}()
  1558  	}
  1559  	if err := validation.Validate([]validation.Validation{
  1560  		{TargetValue: client.SubscriptionID,
  1561  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1562  		{TargetValue: resourceGroupName,
  1563  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1564  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1565  		{TargetValue: accountName,
  1566  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1567  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1568  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1569  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoRoleDefinitions", err.Error())
  1570  	}
  1571  
  1572  	req, err := client.ListMongoRoleDefinitionsPreparer(ctx, resourceGroupName, accountName)
  1573  	if err != nil {
  1574  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoRoleDefinitions", nil, "Failure preparing request")
  1575  		return
  1576  	}
  1577  
  1578  	resp, err := client.ListMongoRoleDefinitionsSender(req)
  1579  	if err != nil {
  1580  		result.Response = autorest.Response{Response: resp}
  1581  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoRoleDefinitions", resp, "Failure sending request")
  1582  		return
  1583  	}
  1584  
  1585  	result, err = client.ListMongoRoleDefinitionsResponder(resp)
  1586  	if err != nil {
  1587  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoRoleDefinitions", resp, "Failure responding to request")
  1588  		return
  1589  	}
  1590  
  1591  	return
  1592  }
  1593  
  1594  // ListMongoRoleDefinitionsPreparer prepares the ListMongoRoleDefinitions request.
  1595  func (client MongoDBResourcesClient) ListMongoRoleDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
  1596  	pathParameters := map[string]interface{}{
  1597  		"accountName":       autorest.Encode("path", accountName),
  1598  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1599  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1600  	}
  1601  
  1602  	const APIVersion = "2022-08-15"
  1603  	queryParameters := map[string]interface{}{
  1604  		"api-version": APIVersion,
  1605  	}
  1606  
  1607  	preparer := autorest.CreatePreparer(
  1608  		autorest.AsGet(),
  1609  		autorest.WithBaseURL(client.BaseURI),
  1610  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions", pathParameters),
  1611  		autorest.WithQueryParameters(queryParameters))
  1612  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1613  }
  1614  
  1615  // ListMongoRoleDefinitionsSender sends the ListMongoRoleDefinitions request. The method will close the
  1616  // http.Response Body if it receives an error.
  1617  func (client MongoDBResourcesClient) ListMongoRoleDefinitionsSender(req *http.Request) (*http.Response, error) {
  1618  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1619  }
  1620  
  1621  // ListMongoRoleDefinitionsResponder handles the response to the ListMongoRoleDefinitions request. The method always
  1622  // closes the http.Response Body.
  1623  func (client MongoDBResourcesClient) ListMongoRoleDefinitionsResponder(resp *http.Response) (result MongoRoleDefinitionListResult, err error) {
  1624  	err = autorest.Respond(
  1625  		resp,
  1626  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1627  		autorest.ByUnmarshallingJSON(&result),
  1628  		autorest.ByClosing())
  1629  	result.Response = autorest.Response{Response: resp}
  1630  	return
  1631  }
  1632  
  1633  // ListMongoUserDefinitions retrieves the list of all Azure Cosmos DB Mongo User Definition.
  1634  // Parameters:
  1635  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1636  // accountName - cosmos DB database account name.
  1637  func (client MongoDBResourcesClient) ListMongoUserDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MongoUserDefinitionListResult, err error) {
  1638  	if tracing.IsEnabled() {
  1639  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoUserDefinitions")
  1640  		defer func() {
  1641  			sc := -1
  1642  			if result.Response.Response != nil {
  1643  				sc = result.Response.Response.StatusCode
  1644  			}
  1645  			tracing.EndSpan(ctx, sc, err)
  1646  		}()
  1647  	}
  1648  	if err := validation.Validate([]validation.Validation{
  1649  		{TargetValue: client.SubscriptionID,
  1650  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1651  		{TargetValue: resourceGroupName,
  1652  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1653  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1654  		{TargetValue: accountName,
  1655  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1656  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1657  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1658  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoUserDefinitions", err.Error())
  1659  	}
  1660  
  1661  	req, err := client.ListMongoUserDefinitionsPreparer(ctx, resourceGroupName, accountName)
  1662  	if err != nil {
  1663  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoUserDefinitions", nil, "Failure preparing request")
  1664  		return
  1665  	}
  1666  
  1667  	resp, err := client.ListMongoUserDefinitionsSender(req)
  1668  	if err != nil {
  1669  		result.Response = autorest.Response{Response: resp}
  1670  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoUserDefinitions", resp, "Failure sending request")
  1671  		return
  1672  	}
  1673  
  1674  	result, err = client.ListMongoUserDefinitionsResponder(resp)
  1675  	if err != nil {
  1676  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoUserDefinitions", resp, "Failure responding to request")
  1677  		return
  1678  	}
  1679  
  1680  	return
  1681  }
  1682  
  1683  // ListMongoUserDefinitionsPreparer prepares the ListMongoUserDefinitions request.
  1684  func (client MongoDBResourcesClient) ListMongoUserDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
  1685  	pathParameters := map[string]interface{}{
  1686  		"accountName":       autorest.Encode("path", accountName),
  1687  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1688  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1689  	}
  1690  
  1691  	const APIVersion = "2022-08-15"
  1692  	queryParameters := map[string]interface{}{
  1693  		"api-version": APIVersion,
  1694  	}
  1695  
  1696  	preparer := autorest.CreatePreparer(
  1697  		autorest.AsGet(),
  1698  		autorest.WithBaseURL(client.BaseURI),
  1699  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions", pathParameters),
  1700  		autorest.WithQueryParameters(queryParameters))
  1701  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1702  }
  1703  
  1704  // ListMongoUserDefinitionsSender sends the ListMongoUserDefinitions request. The method will close the
  1705  // http.Response Body if it receives an error.
  1706  func (client MongoDBResourcesClient) ListMongoUserDefinitionsSender(req *http.Request) (*http.Response, error) {
  1707  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1708  }
  1709  
  1710  // ListMongoUserDefinitionsResponder handles the response to the ListMongoUserDefinitions request. The method always
  1711  // closes the http.Response Body.
  1712  func (client MongoDBResourcesClient) ListMongoUserDefinitionsResponder(resp *http.Response) (result MongoUserDefinitionListResult, err error) {
  1713  	err = autorest.Respond(
  1714  		resp,
  1715  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1716  		autorest.ByUnmarshallingJSON(&result),
  1717  		autorest.ByClosing())
  1718  	result.Response = autorest.Response{Response: resp}
  1719  	return
  1720  }
  1721  
  1722  // MigrateMongoDBCollectionToAutoscale migrate an Azure Cosmos DB MongoDB collection from manual throughput to
  1723  // autoscale
  1724  // Parameters:
  1725  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1726  // accountName - cosmos DB database account name.
  1727  // databaseName - cosmos DB database name.
  1728  // collectionName - cosmos DB collection name.
  1729  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) {
  1730  	if tracing.IsEnabled() {
  1731  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToAutoscale")
  1732  		defer func() {
  1733  			sc := -1
  1734  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1735  				sc = result.FutureAPI.Response().StatusCode
  1736  			}
  1737  			tracing.EndSpan(ctx, sc, err)
  1738  		}()
  1739  	}
  1740  	if err := validation.Validate([]validation.Validation{
  1741  		{TargetValue: client.SubscriptionID,
  1742  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1743  		{TargetValue: resourceGroupName,
  1744  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1745  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1746  		{TargetValue: accountName,
  1747  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1748  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1749  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1750  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", err.Error())
  1751  	}
  1752  
  1753  	req, err := client.MigrateMongoDBCollectionToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, collectionName)
  1754  	if err != nil {
  1755  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", nil, "Failure preparing request")
  1756  		return
  1757  	}
  1758  
  1759  	result, err = client.MigrateMongoDBCollectionToAutoscaleSender(req)
  1760  	if err != nil {
  1761  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", result.Response(), "Failure sending request")
  1762  		return
  1763  	}
  1764  
  1765  	return
  1766  }
  1767  
  1768  // MigrateMongoDBCollectionToAutoscalePreparer prepares the MigrateMongoDBCollectionToAutoscale request.
  1769  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) {
  1770  	pathParameters := map[string]interface{}{
  1771  		"accountName":       autorest.Encode("path", accountName),
  1772  		"collectionName":    autorest.Encode("path", collectionName),
  1773  		"databaseName":      autorest.Encode("path", databaseName),
  1774  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1775  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1776  	}
  1777  
  1778  	const APIVersion = "2022-08-15"
  1779  	queryParameters := map[string]interface{}{
  1780  		"api-version": APIVersion,
  1781  	}
  1782  
  1783  	preparer := autorest.CreatePreparer(
  1784  		autorest.AsPost(),
  1785  		autorest.WithBaseURL(client.BaseURI),
  1786  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale", pathParameters),
  1787  		autorest.WithQueryParameters(queryParameters))
  1788  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1789  }
  1790  
  1791  // MigrateMongoDBCollectionToAutoscaleSender sends the MigrateMongoDBCollectionToAutoscale request. The method will close the
  1792  // http.Response Body if it receives an error.
  1793  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) {
  1794  	var resp *http.Response
  1795  	future.FutureAPI = &azure.Future{}
  1796  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1797  	if err != nil {
  1798  		return
  1799  	}
  1800  	var azf azure.Future
  1801  	azf, err = azure.NewFutureFromResponse(resp)
  1802  	future.FutureAPI = &azf
  1803  	future.Result = future.result
  1804  	return
  1805  }
  1806  
  1807  // MigrateMongoDBCollectionToAutoscaleResponder handles the response to the MigrateMongoDBCollectionToAutoscale request. The method always
  1808  // closes the http.Response Body.
  1809  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1810  	err = autorest.Respond(
  1811  		resp,
  1812  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1813  		autorest.ByUnmarshallingJSON(&result),
  1814  		autorest.ByClosing())
  1815  	result.Response = autorest.Response{Response: resp}
  1816  	return
  1817  }
  1818  
  1819  // MigrateMongoDBCollectionToManualThroughput migrate an Azure Cosmos DB MongoDB collection from autoscale to manual
  1820  // throughput
  1821  // Parameters:
  1822  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1823  // accountName - cosmos DB database account name.
  1824  // databaseName - cosmos DB database name.
  1825  // collectionName - cosmos DB collection name.
  1826  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) {
  1827  	if tracing.IsEnabled() {
  1828  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToManualThroughput")
  1829  		defer func() {
  1830  			sc := -1
  1831  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1832  				sc = result.FutureAPI.Response().StatusCode
  1833  			}
  1834  			tracing.EndSpan(ctx, sc, err)
  1835  		}()
  1836  	}
  1837  	if err := validation.Validate([]validation.Validation{
  1838  		{TargetValue: client.SubscriptionID,
  1839  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1840  		{TargetValue: resourceGroupName,
  1841  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1842  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1843  		{TargetValue: accountName,
  1844  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1845  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1846  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1847  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", err.Error())
  1848  	}
  1849  
  1850  	req, err := client.MigrateMongoDBCollectionToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName)
  1851  	if err != nil {
  1852  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", nil, "Failure preparing request")
  1853  		return
  1854  	}
  1855  
  1856  	result, err = client.MigrateMongoDBCollectionToManualThroughputSender(req)
  1857  	if err != nil {
  1858  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", result.Response(), "Failure sending request")
  1859  		return
  1860  	}
  1861  
  1862  	return
  1863  }
  1864  
  1865  // MigrateMongoDBCollectionToManualThroughputPreparer prepares the MigrateMongoDBCollectionToManualThroughput request.
  1866  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) {
  1867  	pathParameters := map[string]interface{}{
  1868  		"accountName":       autorest.Encode("path", accountName),
  1869  		"collectionName":    autorest.Encode("path", collectionName),
  1870  		"databaseName":      autorest.Encode("path", databaseName),
  1871  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1872  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1873  	}
  1874  
  1875  	const APIVersion = "2022-08-15"
  1876  	queryParameters := map[string]interface{}{
  1877  		"api-version": APIVersion,
  1878  	}
  1879  
  1880  	preparer := autorest.CreatePreparer(
  1881  		autorest.AsPost(),
  1882  		autorest.WithBaseURL(client.BaseURI),
  1883  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
  1884  		autorest.WithQueryParameters(queryParameters))
  1885  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1886  }
  1887  
  1888  // MigrateMongoDBCollectionToManualThroughputSender sends the MigrateMongoDBCollectionToManualThroughput request. The method will close the
  1889  // http.Response Body if it receives an error.
  1890  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) {
  1891  	var resp *http.Response
  1892  	future.FutureAPI = &azure.Future{}
  1893  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1894  	if err != nil {
  1895  		return
  1896  	}
  1897  	var azf azure.Future
  1898  	azf, err = azure.NewFutureFromResponse(resp)
  1899  	future.FutureAPI = &azf
  1900  	future.Result = future.result
  1901  	return
  1902  }
  1903  
  1904  // MigrateMongoDBCollectionToManualThroughputResponder handles the response to the MigrateMongoDBCollectionToManualThroughput request. The method always
  1905  // closes the http.Response Body.
  1906  func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1907  	err = autorest.Respond(
  1908  		resp,
  1909  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1910  		autorest.ByUnmarshallingJSON(&result),
  1911  		autorest.ByClosing())
  1912  	result.Response = autorest.Response{Response: resp}
  1913  	return
  1914  }
  1915  
  1916  // MigrateMongoDBDatabaseToAutoscale migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale
  1917  // Parameters:
  1918  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1919  // accountName - cosmos DB database account name.
  1920  // databaseName - cosmos DB database name.
  1921  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) {
  1922  	if tracing.IsEnabled() {
  1923  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToAutoscale")
  1924  		defer func() {
  1925  			sc := -1
  1926  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1927  				sc = result.FutureAPI.Response().StatusCode
  1928  			}
  1929  			tracing.EndSpan(ctx, sc, err)
  1930  		}()
  1931  	}
  1932  	if err := validation.Validate([]validation.Validation{
  1933  		{TargetValue: client.SubscriptionID,
  1934  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1935  		{TargetValue: resourceGroupName,
  1936  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1937  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1938  		{TargetValue: accountName,
  1939  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1940  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1941  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1942  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", err.Error())
  1943  	}
  1944  
  1945  	req, err := client.MigrateMongoDBDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName)
  1946  	if err != nil {
  1947  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", nil, "Failure preparing request")
  1948  		return
  1949  	}
  1950  
  1951  	result, err = client.MigrateMongoDBDatabaseToAutoscaleSender(req)
  1952  	if err != nil {
  1953  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", result.Response(), "Failure sending request")
  1954  		return
  1955  	}
  1956  
  1957  	return
  1958  }
  1959  
  1960  // MigrateMongoDBDatabaseToAutoscalePreparer prepares the MigrateMongoDBDatabaseToAutoscale request.
  1961  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  1962  	pathParameters := map[string]interface{}{
  1963  		"accountName":       autorest.Encode("path", accountName),
  1964  		"databaseName":      autorest.Encode("path", databaseName),
  1965  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1966  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1967  	}
  1968  
  1969  	const APIVersion = "2022-08-15"
  1970  	queryParameters := map[string]interface{}{
  1971  		"api-version": APIVersion,
  1972  	}
  1973  
  1974  	preparer := autorest.CreatePreparer(
  1975  		autorest.AsPost(),
  1976  		autorest.WithBaseURL(client.BaseURI),
  1977  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters),
  1978  		autorest.WithQueryParameters(queryParameters))
  1979  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1980  }
  1981  
  1982  // MigrateMongoDBDatabaseToAutoscaleSender sends the MigrateMongoDBDatabaseToAutoscale request. The method will close the
  1983  // http.Response Body if it receives an error.
  1984  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) {
  1985  	var resp *http.Response
  1986  	future.FutureAPI = &azure.Future{}
  1987  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1988  	if err != nil {
  1989  		return
  1990  	}
  1991  	var azf azure.Future
  1992  	azf, err = azure.NewFutureFromResponse(resp)
  1993  	future.FutureAPI = &azf
  1994  	future.Result = future.result
  1995  	return
  1996  }
  1997  
  1998  // MigrateMongoDBDatabaseToAutoscaleResponder handles the response to the MigrateMongoDBDatabaseToAutoscale request. The method always
  1999  // closes the http.Response Body.
  2000  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  2001  	err = autorest.Respond(
  2002  		resp,
  2003  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  2004  		autorest.ByUnmarshallingJSON(&result),
  2005  		autorest.ByClosing())
  2006  	result.Response = autorest.Response{Response: resp}
  2007  	return
  2008  }
  2009  
  2010  // MigrateMongoDBDatabaseToManualThroughput migrate an Azure Cosmos DB MongoDB database from autoscale to manual
  2011  // throughput
  2012  // Parameters:
  2013  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2014  // accountName - cosmos DB database account name.
  2015  // databaseName - cosmos DB database name.
  2016  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) {
  2017  	if tracing.IsEnabled() {
  2018  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToManualThroughput")
  2019  		defer func() {
  2020  			sc := -1
  2021  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  2022  				sc = result.FutureAPI.Response().StatusCode
  2023  			}
  2024  			tracing.EndSpan(ctx, sc, err)
  2025  		}()
  2026  	}
  2027  	if err := validation.Validate([]validation.Validation{
  2028  		{TargetValue: client.SubscriptionID,
  2029  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2030  		{TargetValue: resourceGroupName,
  2031  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2032  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2033  		{TargetValue: accountName,
  2034  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2035  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2036  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2037  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", err.Error())
  2038  	}
  2039  
  2040  	req, err := client.MigrateMongoDBDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName)
  2041  	if err != nil {
  2042  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", nil, "Failure preparing request")
  2043  		return
  2044  	}
  2045  
  2046  	result, err = client.MigrateMongoDBDatabaseToManualThroughputSender(req)
  2047  	if err != nil {
  2048  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", result.Response(), "Failure sending request")
  2049  		return
  2050  	}
  2051  
  2052  	return
  2053  }
  2054  
  2055  // MigrateMongoDBDatabaseToManualThroughputPreparer prepares the MigrateMongoDBDatabaseToManualThroughput request.
  2056  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  2057  	pathParameters := map[string]interface{}{
  2058  		"accountName":       autorest.Encode("path", accountName),
  2059  		"databaseName":      autorest.Encode("path", databaseName),
  2060  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2061  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2062  	}
  2063  
  2064  	const APIVersion = "2022-08-15"
  2065  	queryParameters := map[string]interface{}{
  2066  		"api-version": APIVersion,
  2067  	}
  2068  
  2069  	preparer := autorest.CreatePreparer(
  2070  		autorest.AsPost(),
  2071  		autorest.WithBaseURL(client.BaseURI),
  2072  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
  2073  		autorest.WithQueryParameters(queryParameters))
  2074  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2075  }
  2076  
  2077  // MigrateMongoDBDatabaseToManualThroughputSender sends the MigrateMongoDBDatabaseToManualThroughput request. The method will close the
  2078  // http.Response Body if it receives an error.
  2079  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) {
  2080  	var resp *http.Response
  2081  	future.FutureAPI = &azure.Future{}
  2082  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2083  	if err != nil {
  2084  		return
  2085  	}
  2086  	var azf azure.Future
  2087  	azf, err = azure.NewFutureFromResponse(resp)
  2088  	future.FutureAPI = &azf
  2089  	future.Result = future.result
  2090  	return
  2091  }
  2092  
  2093  // MigrateMongoDBDatabaseToManualThroughputResponder handles the response to the MigrateMongoDBDatabaseToManualThroughput request. The method always
  2094  // closes the http.Response Body.
  2095  func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  2096  	err = autorest.Respond(
  2097  		resp,
  2098  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  2099  		autorest.ByUnmarshallingJSON(&result),
  2100  		autorest.ByClosing())
  2101  	result.Response = autorest.Response{Response: resp}
  2102  	return
  2103  }
  2104  
  2105  // RetrieveContinuousBackupInformation retrieves continuous backup information for a Mongodb collection.
  2106  // Parameters:
  2107  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2108  // accountName - cosmos DB database account name.
  2109  // databaseName - cosmos DB database name.
  2110  // collectionName - cosmos DB collection name.
  2111  // location - the name of the continuous backup restore location.
  2112  func (client MongoDBResourcesClient) RetrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, location ContinuousBackupRestoreLocation) (result MongoDBResourcesRetrieveContinuousBackupInformationFuture, err error) {
  2113  	if tracing.IsEnabled() {
  2114  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.RetrieveContinuousBackupInformation")
  2115  		defer func() {
  2116  			sc := -1
  2117  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  2118  				sc = result.FutureAPI.Response().StatusCode
  2119  			}
  2120  			tracing.EndSpan(ctx, sc, err)
  2121  		}()
  2122  	}
  2123  	if err := validation.Validate([]validation.Validation{
  2124  		{TargetValue: client.SubscriptionID,
  2125  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2126  		{TargetValue: resourceGroupName,
  2127  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2128  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2129  		{TargetValue: accountName,
  2130  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2131  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2132  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2133  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "RetrieveContinuousBackupInformation", err.Error())
  2134  	}
  2135  
  2136  	req, err := client.RetrieveContinuousBackupInformationPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, location)
  2137  	if err != nil {
  2138  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "RetrieveContinuousBackupInformation", nil, "Failure preparing request")
  2139  		return
  2140  	}
  2141  
  2142  	result, err = client.RetrieveContinuousBackupInformationSender(req)
  2143  	if err != nil {
  2144  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "RetrieveContinuousBackupInformation", result.Response(), "Failure sending request")
  2145  		return
  2146  	}
  2147  
  2148  	return
  2149  }
  2150  
  2151  // RetrieveContinuousBackupInformationPreparer prepares the RetrieveContinuousBackupInformation request.
  2152  func (client MongoDBResourcesClient) RetrieveContinuousBackupInformationPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, location ContinuousBackupRestoreLocation) (*http.Request, error) {
  2153  	pathParameters := map[string]interface{}{
  2154  		"accountName":       autorest.Encode("path", accountName),
  2155  		"collectionName":    autorest.Encode("path", collectionName),
  2156  		"databaseName":      autorest.Encode("path", databaseName),
  2157  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2158  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2159  	}
  2160  
  2161  	const APIVersion = "2022-08-15"
  2162  	queryParameters := map[string]interface{}{
  2163  		"api-version": APIVersion,
  2164  	}
  2165  
  2166  	preparer := autorest.CreatePreparer(
  2167  		autorest.AsContentType("application/json; charset=utf-8"),
  2168  		autorest.AsPost(),
  2169  		autorest.WithBaseURL(client.BaseURI),
  2170  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation", pathParameters),
  2171  		autorest.WithJSON(location),
  2172  		autorest.WithQueryParameters(queryParameters))
  2173  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2174  }
  2175  
  2176  // RetrieveContinuousBackupInformationSender sends the RetrieveContinuousBackupInformation request. The method will close the
  2177  // http.Response Body if it receives an error.
  2178  func (client MongoDBResourcesClient) RetrieveContinuousBackupInformationSender(req *http.Request) (future MongoDBResourcesRetrieveContinuousBackupInformationFuture, err error) {
  2179  	var resp *http.Response
  2180  	future.FutureAPI = &azure.Future{}
  2181  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2182  	if err != nil {
  2183  		return
  2184  	}
  2185  	var azf azure.Future
  2186  	azf, err = azure.NewFutureFromResponse(resp)
  2187  	future.FutureAPI = &azf
  2188  	future.Result = future.result
  2189  	return
  2190  }
  2191  
  2192  // RetrieveContinuousBackupInformationResponder handles the response to the RetrieveContinuousBackupInformation request. The method always
  2193  // closes the http.Response Body.
  2194  func (client MongoDBResourcesClient) RetrieveContinuousBackupInformationResponder(resp *http.Response) (result BackupInformation, err error) {
  2195  	err = autorest.Respond(
  2196  		resp,
  2197  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  2198  		autorest.ByUnmarshallingJSON(&result),
  2199  		autorest.ByClosing())
  2200  	result.Response = autorest.Response{Response: resp}
  2201  	return
  2202  }
  2203  
  2204  // UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection
  2205  // Parameters:
  2206  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2207  // accountName - cosmos DB database account name.
  2208  // databaseName - cosmos DB database name.
  2209  // collectionName - cosmos DB collection name.
  2210  // updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB
  2211  // collection.
  2212  func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) {
  2213  	if tracing.IsEnabled() {
  2214  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput")
  2215  		defer func() {
  2216  			sc := -1
  2217  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  2218  				sc = result.FutureAPI.Response().StatusCode
  2219  			}
  2220  			tracing.EndSpan(ctx, sc, err)
  2221  		}()
  2222  	}
  2223  	if err := validation.Validate([]validation.Validation{
  2224  		{TargetValue: client.SubscriptionID,
  2225  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2226  		{TargetValue: resourceGroupName,
  2227  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2228  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2229  		{TargetValue: accountName,
  2230  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2231  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2232  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
  2233  		{TargetValue: updateThroughputParameters,
  2234  			Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
  2235  				Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
  2236  					Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
  2237  						Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
  2238  					}},
  2239  				}}}}}); err != nil {
  2240  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error())
  2241  	}
  2242  
  2243  	req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters)
  2244  	if err != nil {
  2245  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request")
  2246  		return
  2247  	}
  2248  
  2249  	result, err = client.UpdateMongoDBCollectionThroughputSender(req)
  2250  	if err != nil {
  2251  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request")
  2252  		return
  2253  	}
  2254  
  2255  	return
  2256  }
  2257  
  2258  // UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request.
  2259  func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
  2260  	pathParameters := map[string]interface{}{
  2261  		"accountName":       autorest.Encode("path", accountName),
  2262  		"collectionName":    autorest.Encode("path", collectionName),
  2263  		"databaseName":      autorest.Encode("path", databaseName),
  2264  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2265  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2266  	}
  2267  
  2268  	const APIVersion = "2022-08-15"
  2269  	queryParameters := map[string]interface{}{
  2270  		"api-version": APIVersion,
  2271  	}
  2272  
  2273  	preparer := autorest.CreatePreparer(
  2274  		autorest.AsContentType("application/json; charset=utf-8"),
  2275  		autorest.AsPut(),
  2276  		autorest.WithBaseURL(client.BaseURI),
  2277  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters),
  2278  		autorest.WithJSON(updateThroughputParameters),
  2279  		autorest.WithQueryParameters(queryParameters))
  2280  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2281  }
  2282  
  2283  // UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the
  2284  // http.Response Body if it receives an error.
  2285  func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) {
  2286  	var resp *http.Response
  2287  	future.FutureAPI = &azure.Future{}
  2288  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2289  	if err != nil {
  2290  		return
  2291  	}
  2292  	var azf azure.Future
  2293  	azf, err = azure.NewFutureFromResponse(resp)
  2294  	future.FutureAPI = &azf
  2295  	future.Result = future.result
  2296  	return
  2297  }
  2298  
  2299  // UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always
  2300  // closes the http.Response Body.
  2301  func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  2302  	err = autorest.Respond(
  2303  		resp,
  2304  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  2305  		autorest.ByUnmarshallingJSON(&result),
  2306  		autorest.ByClosing())
  2307  	result.Response = autorest.Response{Response: resp}
  2308  	return
  2309  }
  2310  
  2311  // UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database
  2312  // Parameters:
  2313  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2314  // accountName - cosmos DB database account name.
  2315  // databaseName - cosmos DB database name.
  2316  // updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB
  2317  // database.
  2318  func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) {
  2319  	if tracing.IsEnabled() {
  2320  		ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput")
  2321  		defer func() {
  2322  			sc := -1
  2323  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  2324  				sc = result.FutureAPI.Response().StatusCode
  2325  			}
  2326  			tracing.EndSpan(ctx, sc, err)
  2327  		}()
  2328  	}
  2329  	if err := validation.Validate([]validation.Validation{
  2330  		{TargetValue: client.SubscriptionID,
  2331  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2332  		{TargetValue: resourceGroupName,
  2333  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2334  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2335  		{TargetValue: accountName,
  2336  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2337  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2338  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
  2339  		{TargetValue: updateThroughputParameters,
  2340  			Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
  2341  				Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
  2342  					Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
  2343  						Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
  2344  					}},
  2345  				}}}}}); err != nil {
  2346  		return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error())
  2347  	}
  2348  
  2349  	req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters)
  2350  	if err != nil {
  2351  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request")
  2352  		return
  2353  	}
  2354  
  2355  	result, err = client.UpdateMongoDBDatabaseThroughputSender(req)
  2356  	if err != nil {
  2357  		err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request")
  2358  		return
  2359  	}
  2360  
  2361  	return
  2362  }
  2363  
  2364  // UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request.
  2365  func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
  2366  	pathParameters := map[string]interface{}{
  2367  		"accountName":       autorest.Encode("path", accountName),
  2368  		"databaseName":      autorest.Encode("path", databaseName),
  2369  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2370  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2371  	}
  2372  
  2373  	const APIVersion = "2022-08-15"
  2374  	queryParameters := map[string]interface{}{
  2375  		"api-version": APIVersion,
  2376  	}
  2377  
  2378  	preparer := autorest.CreatePreparer(
  2379  		autorest.AsContentType("application/json; charset=utf-8"),
  2380  		autorest.AsPut(),
  2381  		autorest.WithBaseURL(client.BaseURI),
  2382  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters),
  2383  		autorest.WithJSON(updateThroughputParameters),
  2384  		autorest.WithQueryParameters(queryParameters))
  2385  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2386  }
  2387  
  2388  // UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the
  2389  // http.Response Body if it receives an error.
  2390  func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) {
  2391  	var resp *http.Response
  2392  	future.FutureAPI = &azure.Future{}
  2393  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2394  	if err != nil {
  2395  		return
  2396  	}
  2397  	var azf azure.Future
  2398  	azf, err = azure.NewFutureFromResponse(resp)
  2399  	future.FutureAPI = &azf
  2400  	future.Result = future.result
  2401  	return
  2402  }
  2403  
  2404  // UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always
  2405  // closes the http.Response Body.
  2406  func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  2407  	err = autorest.Respond(
  2408  		resp,
  2409  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  2410  		autorest.ByUnmarshallingJSON(&result),
  2411  		autorest.ByClosing())
  2412  	result.Response = autorest.Response{Response: resp}
  2413  	return
  2414  }
  2415  

View as plain text