...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2021-04-01-preview/documentdb/sqlresources.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2021-04-01-preview/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  // SQLResourcesClient is the client for the SQLResources methods of the Documentdb service.
    19  type SQLResourcesClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewSQLResourcesClient creates an instance of the SQLResourcesClient client.
    24  func NewSQLResourcesClient(subscriptionID string) SQLResourcesClient {
    25  	return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient client using a custom endpoint.  Use
    29  // this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
    30  func NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) SQLResourcesClient {
    31  	return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)}
    32  }
    33  
    34  // CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container
    35  // Parameters:
    36  // resourceGroupName - the name of the resource group. The name is case insensitive.
    37  // accountName - cosmos DB database account name.
    38  // databaseName - cosmos DB database name.
    39  // containerName - cosmos DB container name.
    40  // createUpdateSQLContainerParameters - the parameters to provide for the current SQL container.
    41  func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) {
    42  	if tracing.IsEnabled() {
    43  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer")
    44  		defer func() {
    45  			sc := -1
    46  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
    47  				sc = result.FutureAPI.Response().StatusCode
    48  			}
    49  			tracing.EndSpan(ctx, sc, err)
    50  		}()
    51  	}
    52  	if err := validation.Validate([]validation.Validation{
    53  		{TargetValue: client.SubscriptionID,
    54  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
    55  		{TargetValue: resourceGroupName,
    56  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
    57  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
    58  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, 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: createUpdateSQLContainerParameters,
    64  			Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true,
    65  				Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
    66  					Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil},
    67  						{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false,
    68  							Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false,
    69  								Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil},
    70  									{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
    71  								}},
    72  							}},
    73  					}},
    74  				}}}}}); err != nil {
    75  		return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error())
    76  	}
    77  
    78  	req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters)
    79  	if err != nil {
    80  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request")
    81  		return
    82  	}
    83  
    84  	result, err = client.CreateUpdateSQLContainerSender(req)
    85  	if err != nil {
    86  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request")
    87  		return
    88  	}
    89  
    90  	return
    91  }
    92  
    93  // CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request.
    94  func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) {
    95  	pathParameters := map[string]interface{}{
    96  		"accountName":       autorest.Encode("path", accountName),
    97  		"containerName":     autorest.Encode("path", containerName),
    98  		"databaseName":      autorest.Encode("path", databaseName),
    99  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   100  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   101  	}
   102  
   103  	const APIVersion = "2021-04-01-preview"
   104  	queryParameters := map[string]interface{}{
   105  		"api-version": APIVersion,
   106  	}
   107  
   108  	preparer := autorest.CreatePreparer(
   109  		autorest.AsContentType("application/json; charset=utf-8"),
   110  		autorest.AsPut(),
   111  		autorest.WithBaseURL(client.BaseURI),
   112  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters),
   113  		autorest.WithJSON(createUpdateSQLContainerParameters),
   114  		autorest.WithQueryParameters(queryParameters))
   115  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   116  }
   117  
   118  // CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the
   119  // http.Response Body if it receives an error.
   120  func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, err error) {
   121  	var resp *http.Response
   122  	future.FutureAPI = &azure.Future{}
   123  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   124  	if err != nil {
   125  		return
   126  	}
   127  	var azf azure.Future
   128  	azf, err = azure.NewFutureFromResponse(resp)
   129  	future.FutureAPI = &azf
   130  	future.Result = future.result
   131  	return
   132  }
   133  
   134  // CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always
   135  // closes the http.Response Body.
   136  func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) {
   137  	err = autorest.Respond(
   138  		resp,
   139  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   140  		autorest.ByUnmarshallingJSON(&result),
   141  		autorest.ByClosing())
   142  	result.Response = autorest.Response{Response: resp}
   143  	return
   144  }
   145  
   146  // CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database
   147  // Parameters:
   148  // resourceGroupName - the name of the resource group. The name is case insensitive.
   149  // accountName - cosmos DB database account name.
   150  // databaseName - cosmos DB database name.
   151  // createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database.
   152  func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) {
   153  	if tracing.IsEnabled() {
   154  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase")
   155  		defer func() {
   156  			sc := -1
   157  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   158  				sc = result.FutureAPI.Response().StatusCode
   159  			}
   160  			tracing.EndSpan(ctx, sc, err)
   161  		}()
   162  	}
   163  	if err := validation.Validate([]validation.Validation{
   164  		{TargetValue: client.SubscriptionID,
   165  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   166  		{TargetValue: resourceGroupName,
   167  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   168  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   169  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   170  		{TargetValue: accountName,
   171  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   172  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   173  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
   174  		{TargetValue: createUpdateSQLDatabaseParameters,
   175  			Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true,
   176  				Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
   177  					Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
   178  				}}}}}); err != nil {
   179  		return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error())
   180  	}
   181  
   182  	req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters)
   183  	if err != nil {
   184  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request")
   185  		return
   186  	}
   187  
   188  	result, err = client.CreateUpdateSQLDatabaseSender(req)
   189  	if err != nil {
   190  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request")
   191  		return
   192  	}
   193  
   194  	return
   195  }
   196  
   197  // CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request.
   198  func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) {
   199  	pathParameters := map[string]interface{}{
   200  		"accountName":       autorest.Encode("path", accountName),
   201  		"databaseName":      autorest.Encode("path", databaseName),
   202  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   203  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   204  	}
   205  
   206  	const APIVersion = "2021-04-01-preview"
   207  	queryParameters := map[string]interface{}{
   208  		"api-version": APIVersion,
   209  	}
   210  
   211  	preparer := autorest.CreatePreparer(
   212  		autorest.AsContentType("application/json; charset=utf-8"),
   213  		autorest.AsPut(),
   214  		autorest.WithBaseURL(client.BaseURI),
   215  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters),
   216  		autorest.WithJSON(createUpdateSQLDatabaseParameters),
   217  		autorest.WithQueryParameters(queryParameters))
   218  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   219  }
   220  
   221  // CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the
   222  // http.Response Body if it receives an error.
   223  func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, err error) {
   224  	var resp *http.Response
   225  	future.FutureAPI = &azure.Future{}
   226  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   227  	if err != nil {
   228  		return
   229  	}
   230  	var azf azure.Future
   231  	azf, err = azure.NewFutureFromResponse(resp)
   232  	future.FutureAPI = &azf
   233  	future.Result = future.result
   234  	return
   235  }
   236  
   237  // CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always
   238  // closes the http.Response Body.
   239  func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) {
   240  	err = autorest.Respond(
   241  		resp,
   242  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   243  		autorest.ByUnmarshallingJSON(&result),
   244  		autorest.ByClosing())
   245  	result.Response = autorest.Response{Response: resp}
   246  	return
   247  }
   248  
   249  // CreateUpdateSQLRoleAssignment creates or updates an Azure Cosmos DB SQL Role Assignment.
   250  // Parameters:
   251  // roleAssignmentID - the GUID for the Role Assignment.
   252  // resourceGroupName - the name of the resource group. The name is case insensitive.
   253  // accountName - cosmos DB database account name.
   254  // createUpdateSQLRoleAssignmentParameters - the properties required to create or update a Role Assignment.
   255  func (client SQLResourcesClient) CreateUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) {
   256  	if tracing.IsEnabled() {
   257  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleAssignment")
   258  		defer func() {
   259  			sc := -1
   260  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   261  				sc = result.FutureAPI.Response().StatusCode
   262  			}
   263  			tracing.EndSpan(ctx, sc, err)
   264  		}()
   265  	}
   266  	if err := validation.Validate([]validation.Validation{
   267  		{TargetValue: client.SubscriptionID,
   268  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   269  		{TargetValue: resourceGroupName,
   270  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   271  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   272  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   273  		{TargetValue: accountName,
   274  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   275  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   276  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   277  		return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", err.Error())
   278  	}
   279  
   280  	req, err := client.CreateUpdateSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName, createUpdateSQLRoleAssignmentParameters)
   281  	if err != nil {
   282  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", nil, "Failure preparing request")
   283  		return
   284  	}
   285  
   286  	result, err = client.CreateUpdateSQLRoleAssignmentSender(req)
   287  	if err != nil {
   288  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", result.Response(), "Failure sending request")
   289  		return
   290  	}
   291  
   292  	return
   293  }
   294  
   295  // CreateUpdateSQLRoleAssignmentPreparer prepares the CreateUpdateSQLRoleAssignment request.
   296  func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (*http.Request, error) {
   297  	pathParameters := map[string]interface{}{
   298  		"accountName":       autorest.Encode("path", accountName),
   299  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   300  		"roleAssignmentId":  autorest.Encode("path", roleAssignmentID),
   301  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   302  	}
   303  
   304  	const APIVersion = "2021-04-01-preview"
   305  	queryParameters := map[string]interface{}{
   306  		"api-version": APIVersion,
   307  	}
   308  
   309  	preparer := autorest.CreatePreparer(
   310  		autorest.AsContentType("application/json; charset=utf-8"),
   311  		autorest.AsPut(),
   312  		autorest.WithBaseURL(client.BaseURI),
   313  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters),
   314  		autorest.WithJSON(createUpdateSQLRoleAssignmentParameters),
   315  		autorest.WithQueryParameters(queryParameters))
   316  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   317  }
   318  
   319  // CreateUpdateSQLRoleAssignmentSender sends the CreateUpdateSQLRoleAssignment request. The method will close the
   320  // http.Response Body if it receives an error.
   321  func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) {
   322  	var resp *http.Response
   323  	future.FutureAPI = &azure.Future{}
   324  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   325  	if err != nil {
   326  		return
   327  	}
   328  	var azf azure.Future
   329  	azf, err = azure.NewFutureFromResponse(resp)
   330  	future.FutureAPI = &azf
   331  	future.Result = future.result
   332  	return
   333  }
   334  
   335  // CreateUpdateSQLRoleAssignmentResponder handles the response to the CreateUpdateSQLRoleAssignment request. The method always
   336  // closes the http.Response Body.
   337  func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) {
   338  	err = autorest.Respond(
   339  		resp,
   340  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   341  		autorest.ByUnmarshallingJSON(&result),
   342  		autorest.ByClosing())
   343  	result.Response = autorest.Response{Response: resp}
   344  	return
   345  }
   346  
   347  // CreateUpdateSQLRoleDefinition creates or updates an Azure Cosmos DB SQL Role Definition.
   348  // Parameters:
   349  // roleDefinitionID - the GUID for the Role Definition.
   350  // resourceGroupName - the name of the resource group. The name is case insensitive.
   351  // accountName - cosmos DB database account name.
   352  // createUpdateSQLRoleDefinitionParameters - the properties required to create or update a Role Definition.
   353  func (client SQLResourcesClient) CreateUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) {
   354  	if tracing.IsEnabled() {
   355  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleDefinition")
   356  		defer func() {
   357  			sc := -1
   358  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   359  				sc = result.FutureAPI.Response().StatusCode
   360  			}
   361  			tracing.EndSpan(ctx, sc, err)
   362  		}()
   363  	}
   364  	if err := validation.Validate([]validation.Validation{
   365  		{TargetValue: client.SubscriptionID,
   366  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   367  		{TargetValue: resourceGroupName,
   368  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   369  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   370  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   371  		{TargetValue: accountName,
   372  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   373  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   374  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   375  		return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", err.Error())
   376  	}
   377  
   378  	req, err := client.CreateUpdateSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName, createUpdateSQLRoleDefinitionParameters)
   379  	if err != nil {
   380  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", nil, "Failure preparing request")
   381  		return
   382  	}
   383  
   384  	result, err = client.CreateUpdateSQLRoleDefinitionSender(req)
   385  	if err != nil {
   386  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", result.Response(), "Failure sending request")
   387  		return
   388  	}
   389  
   390  	return
   391  }
   392  
   393  // CreateUpdateSQLRoleDefinitionPreparer prepares the CreateUpdateSQLRoleDefinition request.
   394  func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (*http.Request, error) {
   395  	pathParameters := map[string]interface{}{
   396  		"accountName":       autorest.Encode("path", accountName),
   397  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   398  		"roleDefinitionId":  autorest.Encode("path", roleDefinitionID),
   399  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   400  	}
   401  
   402  	const APIVersion = "2021-04-01-preview"
   403  	queryParameters := map[string]interface{}{
   404  		"api-version": APIVersion,
   405  	}
   406  
   407  	preparer := autorest.CreatePreparer(
   408  		autorest.AsContentType("application/json; charset=utf-8"),
   409  		autorest.AsPut(),
   410  		autorest.WithBaseURL(client.BaseURI),
   411  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters),
   412  		autorest.WithJSON(createUpdateSQLRoleDefinitionParameters),
   413  		autorest.WithQueryParameters(queryParameters))
   414  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   415  }
   416  
   417  // CreateUpdateSQLRoleDefinitionSender sends the CreateUpdateSQLRoleDefinition request. The method will close the
   418  // http.Response Body if it receives an error.
   419  func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) {
   420  	var resp *http.Response
   421  	future.FutureAPI = &azure.Future{}
   422  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   423  	if err != nil {
   424  		return
   425  	}
   426  	var azf azure.Future
   427  	azf, err = azure.NewFutureFromResponse(resp)
   428  	future.FutureAPI = &azf
   429  	future.Result = future.result
   430  	return
   431  }
   432  
   433  // CreateUpdateSQLRoleDefinitionResponder handles the response to the CreateUpdateSQLRoleDefinition request. The method always
   434  // closes the http.Response Body.
   435  func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) {
   436  	err = autorest.Respond(
   437  		resp,
   438  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   439  		autorest.ByUnmarshallingJSON(&result),
   440  		autorest.ByClosing())
   441  	result.Response = autorest.Response{Response: resp}
   442  	return
   443  }
   444  
   445  // CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure
   446  // Parameters:
   447  // resourceGroupName - the name of the resource group. The name is case insensitive.
   448  // accountName - cosmos DB database account name.
   449  // databaseName - cosmos DB database name.
   450  // containerName - cosmos DB container name.
   451  // storedProcedureName - cosmos DB storedProcedure name.
   452  // createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure.
   453  func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) {
   454  	if tracing.IsEnabled() {
   455  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure")
   456  		defer func() {
   457  			sc := -1
   458  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   459  				sc = result.FutureAPI.Response().StatusCode
   460  			}
   461  			tracing.EndSpan(ctx, sc, err)
   462  		}()
   463  	}
   464  	if err := validation.Validate([]validation.Validation{
   465  		{TargetValue: client.SubscriptionID,
   466  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   467  		{TargetValue: resourceGroupName,
   468  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   469  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   470  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   471  		{TargetValue: accountName,
   472  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   473  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   474  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
   475  		{TargetValue: createUpdateSQLStoredProcedureParameters,
   476  			Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true,
   477  				Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
   478  					Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
   479  				}}}}}); err != nil {
   480  		return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error())
   481  	}
   482  
   483  	req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters)
   484  	if err != nil {
   485  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request")
   486  		return
   487  	}
   488  
   489  	result, err = client.CreateUpdateSQLStoredProcedureSender(req)
   490  	if err != nil {
   491  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request")
   492  		return
   493  	}
   494  
   495  	return
   496  }
   497  
   498  // CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request.
   499  func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) {
   500  	pathParameters := map[string]interface{}{
   501  		"accountName":         autorest.Encode("path", accountName),
   502  		"containerName":       autorest.Encode("path", containerName),
   503  		"databaseName":        autorest.Encode("path", databaseName),
   504  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
   505  		"storedProcedureName": autorest.Encode("path", storedProcedureName),
   506  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
   507  	}
   508  
   509  	const APIVersion = "2021-04-01-preview"
   510  	queryParameters := map[string]interface{}{
   511  		"api-version": APIVersion,
   512  	}
   513  
   514  	preparer := autorest.CreatePreparer(
   515  		autorest.AsContentType("application/json; charset=utf-8"),
   516  		autorest.AsPut(),
   517  		autorest.WithBaseURL(client.BaseURI),
   518  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters),
   519  		autorest.WithJSON(createUpdateSQLStoredProcedureParameters),
   520  		autorest.WithQueryParameters(queryParameters))
   521  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   522  }
   523  
   524  // CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the
   525  // http.Response Body if it receives an error.
   526  func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) {
   527  	var resp *http.Response
   528  	future.FutureAPI = &azure.Future{}
   529  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   530  	if err != nil {
   531  		return
   532  	}
   533  	var azf azure.Future
   534  	azf, err = azure.NewFutureFromResponse(resp)
   535  	future.FutureAPI = &azf
   536  	future.Result = future.result
   537  	return
   538  }
   539  
   540  // CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always
   541  // closes the http.Response Body.
   542  func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) {
   543  	err = autorest.Respond(
   544  		resp,
   545  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   546  		autorest.ByUnmarshallingJSON(&result),
   547  		autorest.ByClosing())
   548  	result.Response = autorest.Response{Response: resp}
   549  	return
   550  }
   551  
   552  // CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger
   553  // Parameters:
   554  // resourceGroupName - the name of the resource group. The name is case insensitive.
   555  // accountName - cosmos DB database account name.
   556  // databaseName - cosmos DB database name.
   557  // containerName - cosmos DB container name.
   558  // triggerName - cosmos DB trigger name.
   559  // createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger.
   560  func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) {
   561  	if tracing.IsEnabled() {
   562  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger")
   563  		defer func() {
   564  			sc := -1
   565  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   566  				sc = result.FutureAPI.Response().StatusCode
   567  			}
   568  			tracing.EndSpan(ctx, sc, err)
   569  		}()
   570  	}
   571  	if err := validation.Validate([]validation.Validation{
   572  		{TargetValue: client.SubscriptionID,
   573  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   574  		{TargetValue: resourceGroupName,
   575  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   576  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   577  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   578  		{TargetValue: accountName,
   579  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   580  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   581  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
   582  		{TargetValue: createUpdateSQLTriggerParameters,
   583  			Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true,
   584  				Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
   585  					Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
   586  				}}}}}); err != nil {
   587  		return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error())
   588  	}
   589  
   590  	req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters)
   591  	if err != nil {
   592  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request")
   593  		return
   594  	}
   595  
   596  	result, err = client.CreateUpdateSQLTriggerSender(req)
   597  	if err != nil {
   598  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request")
   599  		return
   600  	}
   601  
   602  	return
   603  }
   604  
   605  // CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request.
   606  func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) {
   607  	pathParameters := map[string]interface{}{
   608  		"accountName":       autorest.Encode("path", accountName),
   609  		"containerName":     autorest.Encode("path", containerName),
   610  		"databaseName":      autorest.Encode("path", databaseName),
   611  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   612  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   613  		"triggerName":       autorest.Encode("path", triggerName),
   614  	}
   615  
   616  	const APIVersion = "2021-04-01-preview"
   617  	queryParameters := map[string]interface{}{
   618  		"api-version": APIVersion,
   619  	}
   620  
   621  	preparer := autorest.CreatePreparer(
   622  		autorest.AsContentType("application/json; charset=utf-8"),
   623  		autorest.AsPut(),
   624  		autorest.WithBaseURL(client.BaseURI),
   625  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters),
   626  		autorest.WithJSON(createUpdateSQLTriggerParameters),
   627  		autorest.WithQueryParameters(queryParameters))
   628  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   629  }
   630  
   631  // CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the
   632  // http.Response Body if it receives an error.
   633  func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, err error) {
   634  	var resp *http.Response
   635  	future.FutureAPI = &azure.Future{}
   636  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   637  	if err != nil {
   638  		return
   639  	}
   640  	var azf azure.Future
   641  	azf, err = azure.NewFutureFromResponse(resp)
   642  	future.FutureAPI = &azf
   643  	future.Result = future.result
   644  	return
   645  }
   646  
   647  // CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always
   648  // closes the http.Response Body.
   649  func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) {
   650  	err = autorest.Respond(
   651  		resp,
   652  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   653  		autorest.ByUnmarshallingJSON(&result),
   654  		autorest.ByClosing())
   655  	result.Response = autorest.Response{Response: resp}
   656  	return
   657  }
   658  
   659  // CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction
   660  // Parameters:
   661  // resourceGroupName - the name of the resource group. The name is case insensitive.
   662  // accountName - cosmos DB database account name.
   663  // databaseName - cosmos DB database name.
   664  // containerName - cosmos DB container name.
   665  // userDefinedFunctionName - cosmos DB userDefinedFunction name.
   666  // createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL
   667  // userDefinedFunction.
   668  func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) {
   669  	if tracing.IsEnabled() {
   670  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction")
   671  		defer func() {
   672  			sc := -1
   673  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   674  				sc = result.FutureAPI.Response().StatusCode
   675  			}
   676  			tracing.EndSpan(ctx, sc, err)
   677  		}()
   678  	}
   679  	if err := validation.Validate([]validation.Validation{
   680  		{TargetValue: client.SubscriptionID,
   681  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   682  		{TargetValue: resourceGroupName,
   683  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   684  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   685  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   686  		{TargetValue: accountName,
   687  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   688  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   689  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
   690  		{TargetValue: createUpdateSQLUserDefinedFunctionParameters,
   691  			Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true,
   692  				Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
   693  					Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
   694  				}}}}}); err != nil {
   695  		return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error())
   696  	}
   697  
   698  	req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters)
   699  	if err != nil {
   700  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request")
   701  		return
   702  	}
   703  
   704  	result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req)
   705  	if err != nil {
   706  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request")
   707  		return
   708  	}
   709  
   710  	return
   711  }
   712  
   713  // CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request.
   714  func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) {
   715  	pathParameters := map[string]interface{}{
   716  		"accountName":             autorest.Encode("path", accountName),
   717  		"containerName":           autorest.Encode("path", containerName),
   718  		"databaseName":            autorest.Encode("path", databaseName),
   719  		"resourceGroupName":       autorest.Encode("path", resourceGroupName),
   720  		"subscriptionId":          autorest.Encode("path", client.SubscriptionID),
   721  		"userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName),
   722  	}
   723  
   724  	const APIVersion = "2021-04-01-preview"
   725  	queryParameters := map[string]interface{}{
   726  		"api-version": APIVersion,
   727  	}
   728  
   729  	preparer := autorest.CreatePreparer(
   730  		autorest.AsContentType("application/json; charset=utf-8"),
   731  		autorest.AsPut(),
   732  		autorest.WithBaseURL(client.BaseURI),
   733  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters),
   734  		autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters),
   735  		autorest.WithQueryParameters(queryParameters))
   736  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   737  }
   738  
   739  // CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the
   740  // http.Response Body if it receives an error.
   741  func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) {
   742  	var resp *http.Response
   743  	future.FutureAPI = &azure.Future{}
   744  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   745  	if err != nil {
   746  		return
   747  	}
   748  	var azf azure.Future
   749  	azf, err = azure.NewFutureFromResponse(resp)
   750  	future.FutureAPI = &azf
   751  	future.Result = future.result
   752  	return
   753  }
   754  
   755  // CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always
   756  // closes the http.Response Body.
   757  func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) {
   758  	err = autorest.Respond(
   759  		resp,
   760  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   761  		autorest.ByUnmarshallingJSON(&result),
   762  		autorest.ByClosing())
   763  	result.Response = autorest.Response{Response: resp}
   764  	return
   765  }
   766  
   767  // DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container.
   768  // Parameters:
   769  // resourceGroupName - the name of the resource group. The name is case insensitive.
   770  // accountName - cosmos DB database account name.
   771  // databaseName - cosmos DB database name.
   772  // containerName - cosmos DB container name.
   773  func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) {
   774  	if tracing.IsEnabled() {
   775  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer")
   776  		defer func() {
   777  			sc := -1
   778  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   779  				sc = result.FutureAPI.Response().StatusCode
   780  			}
   781  			tracing.EndSpan(ctx, sc, err)
   782  		}()
   783  	}
   784  	if err := validation.Validate([]validation.Validation{
   785  		{TargetValue: client.SubscriptionID,
   786  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   787  		{TargetValue: resourceGroupName,
   788  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   789  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   790  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   791  		{TargetValue: accountName,
   792  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   793  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   794  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   795  		return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error())
   796  	}
   797  
   798  	req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
   799  	if err != nil {
   800  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request")
   801  		return
   802  	}
   803  
   804  	result, err = client.DeleteSQLContainerSender(req)
   805  	if err != nil {
   806  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request")
   807  		return
   808  	}
   809  
   810  	return
   811  }
   812  
   813  // DeleteSQLContainerPreparer prepares the DeleteSQLContainer request.
   814  func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
   815  	pathParameters := map[string]interface{}{
   816  		"accountName":       autorest.Encode("path", accountName),
   817  		"containerName":     autorest.Encode("path", containerName),
   818  		"databaseName":      autorest.Encode("path", databaseName),
   819  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   820  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   821  	}
   822  
   823  	const APIVersion = "2021-04-01-preview"
   824  	queryParameters := map[string]interface{}{
   825  		"api-version": APIVersion,
   826  	}
   827  
   828  	preparer := autorest.CreatePreparer(
   829  		autorest.AsDelete(),
   830  		autorest.WithBaseURL(client.BaseURI),
   831  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters),
   832  		autorest.WithQueryParameters(queryParameters))
   833  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   834  }
   835  
   836  // DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the
   837  // http.Response Body if it receives an error.
   838  func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, err error) {
   839  	var resp *http.Response
   840  	future.FutureAPI = &azure.Future{}
   841  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   842  	if err != nil {
   843  		return
   844  	}
   845  	var azf azure.Future
   846  	azf, err = azure.NewFutureFromResponse(resp)
   847  	future.FutureAPI = &azf
   848  	future.Result = future.result
   849  	return
   850  }
   851  
   852  // DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always
   853  // closes the http.Response Body.
   854  func (client SQLResourcesClient) DeleteSQLContainerResponder(resp *http.Response) (result autorest.Response, err error) {
   855  	err = autorest.Respond(
   856  		resp,
   857  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   858  		autorest.ByClosing())
   859  	result.Response = resp
   860  	return
   861  }
   862  
   863  // DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database.
   864  // Parameters:
   865  // resourceGroupName - the name of the resource group. The name is case insensitive.
   866  // accountName - cosmos DB database account name.
   867  // databaseName - cosmos DB database name.
   868  func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) {
   869  	if tracing.IsEnabled() {
   870  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase")
   871  		defer func() {
   872  			sc := -1
   873  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   874  				sc = result.FutureAPI.Response().StatusCode
   875  			}
   876  			tracing.EndSpan(ctx, sc, err)
   877  		}()
   878  	}
   879  	if err := validation.Validate([]validation.Validation{
   880  		{TargetValue: client.SubscriptionID,
   881  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   882  		{TargetValue: resourceGroupName,
   883  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   884  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   885  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   886  		{TargetValue: accountName,
   887  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   888  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   889  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   890  		return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error())
   891  	}
   892  
   893  	req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
   894  	if err != nil {
   895  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request")
   896  		return
   897  	}
   898  
   899  	result, err = client.DeleteSQLDatabaseSender(req)
   900  	if err != nil {
   901  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request")
   902  		return
   903  	}
   904  
   905  	return
   906  }
   907  
   908  // DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request.
   909  func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
   910  	pathParameters := map[string]interface{}{
   911  		"accountName":       autorest.Encode("path", accountName),
   912  		"databaseName":      autorest.Encode("path", databaseName),
   913  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   914  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   915  	}
   916  
   917  	const APIVersion = "2021-04-01-preview"
   918  	queryParameters := map[string]interface{}{
   919  		"api-version": APIVersion,
   920  	}
   921  
   922  	preparer := autorest.CreatePreparer(
   923  		autorest.AsDelete(),
   924  		autorest.WithBaseURL(client.BaseURI),
   925  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters),
   926  		autorest.WithQueryParameters(queryParameters))
   927  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   928  }
   929  
   930  // DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the
   931  // http.Response Body if it receives an error.
   932  func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, err error) {
   933  	var resp *http.Response
   934  	future.FutureAPI = &azure.Future{}
   935  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   936  	if err != nil {
   937  		return
   938  	}
   939  	var azf azure.Future
   940  	azf, err = azure.NewFutureFromResponse(resp)
   941  	future.FutureAPI = &azf
   942  	future.Result = future.result
   943  	return
   944  }
   945  
   946  // DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always
   947  // closes the http.Response Body.
   948  func (client SQLResourcesClient) DeleteSQLDatabaseResponder(resp *http.Response) (result autorest.Response, err error) {
   949  	err = autorest.Respond(
   950  		resp,
   951  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   952  		autorest.ByClosing())
   953  	result.Response = resp
   954  	return
   955  }
   956  
   957  // DeleteSQLRoleAssignment deletes an existing Azure Cosmos DB SQL Role Assignment.
   958  // Parameters:
   959  // roleAssignmentID - the GUID for the Role Assignment.
   960  // resourceGroupName - the name of the resource group. The name is case insensitive.
   961  // accountName - cosmos DB database account name.
   962  func (client SQLResourcesClient) DeleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleAssignmentFuture, err error) {
   963  	if tracing.IsEnabled() {
   964  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleAssignment")
   965  		defer func() {
   966  			sc := -1
   967  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   968  				sc = result.FutureAPI.Response().StatusCode
   969  			}
   970  			tracing.EndSpan(ctx, sc, err)
   971  		}()
   972  	}
   973  	if err := validation.Validate([]validation.Validation{
   974  		{TargetValue: client.SubscriptionID,
   975  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   976  		{TargetValue: resourceGroupName,
   977  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   978  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   979  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   980  		{TargetValue: accountName,
   981  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   982  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   983  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   984  		return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", err.Error())
   985  	}
   986  
   987  	req, err := client.DeleteSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName)
   988  	if err != nil {
   989  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", nil, "Failure preparing request")
   990  		return
   991  	}
   992  
   993  	result, err = client.DeleteSQLRoleAssignmentSender(req)
   994  	if err != nil {
   995  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", result.Response(), "Failure sending request")
   996  		return
   997  	}
   998  
   999  	return
  1000  }
  1001  
  1002  // DeleteSQLRoleAssignmentPreparer prepares the DeleteSQLRoleAssignment request.
  1003  func (client SQLResourcesClient) DeleteSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) {
  1004  	pathParameters := map[string]interface{}{
  1005  		"accountName":       autorest.Encode("path", accountName),
  1006  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1007  		"roleAssignmentId":  autorest.Encode("path", roleAssignmentID),
  1008  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1009  	}
  1010  
  1011  	const APIVersion = "2021-04-01-preview"
  1012  	queryParameters := map[string]interface{}{
  1013  		"api-version": APIVersion,
  1014  	}
  1015  
  1016  	preparer := autorest.CreatePreparer(
  1017  		autorest.AsDelete(),
  1018  		autorest.WithBaseURL(client.BaseURI),
  1019  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters),
  1020  		autorest.WithQueryParameters(queryParameters))
  1021  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1022  }
  1023  
  1024  // DeleteSQLRoleAssignmentSender sends the DeleteSQLRoleAssignment request. The method will close the
  1025  // http.Response Body if it receives an error.
  1026  func (client SQLResourcesClient) DeleteSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesDeleteSQLRoleAssignmentFuture, err error) {
  1027  	var resp *http.Response
  1028  	future.FutureAPI = &azure.Future{}
  1029  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1030  	if err != nil {
  1031  		return
  1032  	}
  1033  	var azf azure.Future
  1034  	azf, err = azure.NewFutureFromResponse(resp)
  1035  	future.FutureAPI = &azf
  1036  	future.Result = future.result
  1037  	return
  1038  }
  1039  
  1040  // DeleteSQLRoleAssignmentResponder handles the response to the DeleteSQLRoleAssignment request. The method always
  1041  // closes the http.Response Body.
  1042  func (client SQLResourcesClient) DeleteSQLRoleAssignmentResponder(resp *http.Response) (result autorest.Response, err error) {
  1043  	err = autorest.Respond(
  1044  		resp,
  1045  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1046  		autorest.ByClosing())
  1047  	result.Response = resp
  1048  	return
  1049  }
  1050  
  1051  // DeleteSQLRoleDefinition deletes an existing Azure Cosmos DB SQL Role Definition.
  1052  // Parameters:
  1053  // roleDefinitionID - the GUID for the Role Definition.
  1054  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1055  // accountName - cosmos DB database account name.
  1056  func (client SQLResourcesClient) DeleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleDefinitionFuture, err error) {
  1057  	if tracing.IsEnabled() {
  1058  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleDefinition")
  1059  		defer func() {
  1060  			sc := -1
  1061  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1062  				sc = result.FutureAPI.Response().StatusCode
  1063  			}
  1064  			tracing.EndSpan(ctx, sc, err)
  1065  		}()
  1066  	}
  1067  	if err := validation.Validate([]validation.Validation{
  1068  		{TargetValue: client.SubscriptionID,
  1069  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1070  		{TargetValue: resourceGroupName,
  1071  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1072  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1073  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1074  		{TargetValue: accountName,
  1075  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1076  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1077  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1078  		return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", err.Error())
  1079  	}
  1080  
  1081  	req, err := client.DeleteSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName)
  1082  	if err != nil {
  1083  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", nil, "Failure preparing request")
  1084  		return
  1085  	}
  1086  
  1087  	result, err = client.DeleteSQLRoleDefinitionSender(req)
  1088  	if err != nil {
  1089  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", result.Response(), "Failure sending request")
  1090  		return
  1091  	}
  1092  
  1093  	return
  1094  }
  1095  
  1096  // DeleteSQLRoleDefinitionPreparer prepares the DeleteSQLRoleDefinition request.
  1097  func (client SQLResourcesClient) DeleteSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) {
  1098  	pathParameters := map[string]interface{}{
  1099  		"accountName":       autorest.Encode("path", accountName),
  1100  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1101  		"roleDefinitionId":  autorest.Encode("path", roleDefinitionID),
  1102  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1103  	}
  1104  
  1105  	const APIVersion = "2021-04-01-preview"
  1106  	queryParameters := map[string]interface{}{
  1107  		"api-version": APIVersion,
  1108  	}
  1109  
  1110  	preparer := autorest.CreatePreparer(
  1111  		autorest.AsDelete(),
  1112  		autorest.WithBaseURL(client.BaseURI),
  1113  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters),
  1114  		autorest.WithQueryParameters(queryParameters))
  1115  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1116  }
  1117  
  1118  // DeleteSQLRoleDefinitionSender sends the DeleteSQLRoleDefinition request. The method will close the
  1119  // http.Response Body if it receives an error.
  1120  func (client SQLResourcesClient) DeleteSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesDeleteSQLRoleDefinitionFuture, err error) {
  1121  	var resp *http.Response
  1122  	future.FutureAPI = &azure.Future{}
  1123  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1124  	if err != nil {
  1125  		return
  1126  	}
  1127  	var azf azure.Future
  1128  	azf, err = azure.NewFutureFromResponse(resp)
  1129  	future.FutureAPI = &azf
  1130  	future.Result = future.result
  1131  	return
  1132  }
  1133  
  1134  // DeleteSQLRoleDefinitionResponder handles the response to the DeleteSQLRoleDefinition request. The method always
  1135  // closes the http.Response Body.
  1136  func (client SQLResourcesClient) DeleteSQLRoleDefinitionResponder(resp *http.Response) (result autorest.Response, err error) {
  1137  	err = autorest.Respond(
  1138  		resp,
  1139  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1140  		autorest.ByClosing())
  1141  	result.Response = resp
  1142  	return
  1143  }
  1144  
  1145  // DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure.
  1146  // Parameters:
  1147  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1148  // accountName - cosmos DB database account name.
  1149  // databaseName - cosmos DB database name.
  1150  // containerName - cosmos DB container name.
  1151  // storedProcedureName - cosmos DB storedProcedure name.
  1152  func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) {
  1153  	if tracing.IsEnabled() {
  1154  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure")
  1155  		defer func() {
  1156  			sc := -1
  1157  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1158  				sc = result.FutureAPI.Response().StatusCode
  1159  			}
  1160  			tracing.EndSpan(ctx, sc, err)
  1161  		}()
  1162  	}
  1163  	if err := validation.Validate([]validation.Validation{
  1164  		{TargetValue: client.SubscriptionID,
  1165  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1166  		{TargetValue: resourceGroupName,
  1167  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1168  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1169  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1170  		{TargetValue: accountName,
  1171  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1172  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1173  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1174  		return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error())
  1175  	}
  1176  
  1177  	req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName)
  1178  	if err != nil {
  1179  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request")
  1180  		return
  1181  	}
  1182  
  1183  	result, err = client.DeleteSQLStoredProcedureSender(req)
  1184  	if err != nil {
  1185  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request")
  1186  		return
  1187  	}
  1188  
  1189  	return
  1190  }
  1191  
  1192  // DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request.
  1193  func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) {
  1194  	pathParameters := map[string]interface{}{
  1195  		"accountName":         autorest.Encode("path", accountName),
  1196  		"containerName":       autorest.Encode("path", containerName),
  1197  		"databaseName":        autorest.Encode("path", databaseName),
  1198  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
  1199  		"storedProcedureName": autorest.Encode("path", storedProcedureName),
  1200  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
  1201  	}
  1202  
  1203  	const APIVersion = "2021-04-01-preview"
  1204  	queryParameters := map[string]interface{}{
  1205  		"api-version": APIVersion,
  1206  	}
  1207  
  1208  	preparer := autorest.CreatePreparer(
  1209  		autorest.AsDelete(),
  1210  		autorest.WithBaseURL(client.BaseURI),
  1211  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters),
  1212  		autorest.WithQueryParameters(queryParameters))
  1213  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1214  }
  1215  
  1216  // DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the
  1217  // http.Response Body if it receives an error.
  1218  func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, err error) {
  1219  	var resp *http.Response
  1220  	future.FutureAPI = &azure.Future{}
  1221  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1222  	if err != nil {
  1223  		return
  1224  	}
  1225  	var azf azure.Future
  1226  	azf, err = azure.NewFutureFromResponse(resp)
  1227  	future.FutureAPI = &azf
  1228  	future.Result = future.result
  1229  	return
  1230  }
  1231  
  1232  // DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always
  1233  // closes the http.Response Body.
  1234  func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(resp *http.Response) (result autorest.Response, err error) {
  1235  	err = autorest.Respond(
  1236  		resp,
  1237  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1238  		autorest.ByClosing())
  1239  	result.Response = resp
  1240  	return
  1241  }
  1242  
  1243  // DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger.
  1244  // Parameters:
  1245  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1246  // accountName - cosmos DB database account name.
  1247  // databaseName - cosmos DB database name.
  1248  // containerName - cosmos DB container name.
  1249  // triggerName - cosmos DB trigger name.
  1250  func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) {
  1251  	if tracing.IsEnabled() {
  1252  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger")
  1253  		defer func() {
  1254  			sc := -1
  1255  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1256  				sc = result.FutureAPI.Response().StatusCode
  1257  			}
  1258  			tracing.EndSpan(ctx, sc, err)
  1259  		}()
  1260  	}
  1261  	if err := validation.Validate([]validation.Validation{
  1262  		{TargetValue: client.SubscriptionID,
  1263  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1264  		{TargetValue: resourceGroupName,
  1265  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1266  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1267  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1268  		{TargetValue: accountName,
  1269  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1270  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1271  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1272  		return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error())
  1273  	}
  1274  
  1275  	req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName)
  1276  	if err != nil {
  1277  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request")
  1278  		return
  1279  	}
  1280  
  1281  	result, err = client.DeleteSQLTriggerSender(req)
  1282  	if err != nil {
  1283  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request")
  1284  		return
  1285  	}
  1286  
  1287  	return
  1288  }
  1289  
  1290  // DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request.
  1291  func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) {
  1292  	pathParameters := map[string]interface{}{
  1293  		"accountName":       autorest.Encode("path", accountName),
  1294  		"containerName":     autorest.Encode("path", containerName),
  1295  		"databaseName":      autorest.Encode("path", databaseName),
  1296  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1297  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1298  		"triggerName":       autorest.Encode("path", triggerName),
  1299  	}
  1300  
  1301  	const APIVersion = "2021-04-01-preview"
  1302  	queryParameters := map[string]interface{}{
  1303  		"api-version": APIVersion,
  1304  	}
  1305  
  1306  	preparer := autorest.CreatePreparer(
  1307  		autorest.AsDelete(),
  1308  		autorest.WithBaseURL(client.BaseURI),
  1309  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters),
  1310  		autorest.WithQueryParameters(queryParameters))
  1311  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1312  }
  1313  
  1314  // DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the
  1315  // http.Response Body if it receives an error.
  1316  func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, err error) {
  1317  	var resp *http.Response
  1318  	future.FutureAPI = &azure.Future{}
  1319  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1320  	if err != nil {
  1321  		return
  1322  	}
  1323  	var azf azure.Future
  1324  	azf, err = azure.NewFutureFromResponse(resp)
  1325  	future.FutureAPI = &azf
  1326  	future.Result = future.result
  1327  	return
  1328  }
  1329  
  1330  // DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always
  1331  // closes the http.Response Body.
  1332  func (client SQLResourcesClient) DeleteSQLTriggerResponder(resp *http.Response) (result autorest.Response, err error) {
  1333  	err = autorest.Respond(
  1334  		resp,
  1335  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1336  		autorest.ByClosing())
  1337  	result.Response = resp
  1338  	return
  1339  }
  1340  
  1341  // DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction.
  1342  // Parameters:
  1343  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1344  // accountName - cosmos DB database account name.
  1345  // databaseName - cosmos DB database name.
  1346  // containerName - cosmos DB container name.
  1347  // userDefinedFunctionName - cosmos DB userDefinedFunction name.
  1348  func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) {
  1349  	if tracing.IsEnabled() {
  1350  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction")
  1351  		defer func() {
  1352  			sc := -1
  1353  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1354  				sc = result.FutureAPI.Response().StatusCode
  1355  			}
  1356  			tracing.EndSpan(ctx, sc, err)
  1357  		}()
  1358  	}
  1359  	if err := validation.Validate([]validation.Validation{
  1360  		{TargetValue: client.SubscriptionID,
  1361  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1362  		{TargetValue: resourceGroupName,
  1363  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1364  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1365  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1366  		{TargetValue: accountName,
  1367  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1368  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1369  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1370  		return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error())
  1371  	}
  1372  
  1373  	req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName)
  1374  	if err != nil {
  1375  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request")
  1376  		return
  1377  	}
  1378  
  1379  	result, err = client.DeleteSQLUserDefinedFunctionSender(req)
  1380  	if err != nil {
  1381  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request")
  1382  		return
  1383  	}
  1384  
  1385  	return
  1386  }
  1387  
  1388  // DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request.
  1389  func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) {
  1390  	pathParameters := map[string]interface{}{
  1391  		"accountName":             autorest.Encode("path", accountName),
  1392  		"containerName":           autorest.Encode("path", containerName),
  1393  		"databaseName":            autorest.Encode("path", databaseName),
  1394  		"resourceGroupName":       autorest.Encode("path", resourceGroupName),
  1395  		"subscriptionId":          autorest.Encode("path", client.SubscriptionID),
  1396  		"userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName),
  1397  	}
  1398  
  1399  	const APIVersion = "2021-04-01-preview"
  1400  	queryParameters := map[string]interface{}{
  1401  		"api-version": APIVersion,
  1402  	}
  1403  
  1404  	preparer := autorest.CreatePreparer(
  1405  		autorest.AsDelete(),
  1406  		autorest.WithBaseURL(client.BaseURI),
  1407  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters),
  1408  		autorest.WithQueryParameters(queryParameters))
  1409  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1410  }
  1411  
  1412  // DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the
  1413  // http.Response Body if it receives an error.
  1414  func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) {
  1415  	var resp *http.Response
  1416  	future.FutureAPI = &azure.Future{}
  1417  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1418  	if err != nil {
  1419  		return
  1420  	}
  1421  	var azf azure.Future
  1422  	azf, err = azure.NewFutureFromResponse(resp)
  1423  	future.FutureAPI = &azf
  1424  	future.Result = future.result
  1425  	return
  1426  }
  1427  
  1428  // DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always
  1429  // closes the http.Response Body.
  1430  func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(resp *http.Response) (result autorest.Response, err error) {
  1431  	err = autorest.Respond(
  1432  		resp,
  1433  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
  1434  		autorest.ByClosing())
  1435  	result.Response = resp
  1436  	return
  1437  }
  1438  
  1439  // GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account.
  1440  // Parameters:
  1441  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1442  // accountName - cosmos DB database account name.
  1443  // databaseName - cosmos DB database name.
  1444  // containerName - cosmos DB container name.
  1445  func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) {
  1446  	if tracing.IsEnabled() {
  1447  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer")
  1448  		defer func() {
  1449  			sc := -1
  1450  			if result.Response.Response != nil {
  1451  				sc = result.Response.Response.StatusCode
  1452  			}
  1453  			tracing.EndSpan(ctx, sc, err)
  1454  		}()
  1455  	}
  1456  	if err := validation.Validate([]validation.Validation{
  1457  		{TargetValue: client.SubscriptionID,
  1458  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1459  		{TargetValue: resourceGroupName,
  1460  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1461  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1462  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1463  		{TargetValue: accountName,
  1464  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1465  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1466  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1467  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error())
  1468  	}
  1469  
  1470  	req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
  1471  	if err != nil {
  1472  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request")
  1473  		return
  1474  	}
  1475  
  1476  	resp, err := client.GetSQLContainerSender(req)
  1477  	if err != nil {
  1478  		result.Response = autorest.Response{Response: resp}
  1479  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request")
  1480  		return
  1481  	}
  1482  
  1483  	result, err = client.GetSQLContainerResponder(resp)
  1484  	if err != nil {
  1485  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request")
  1486  		return
  1487  	}
  1488  
  1489  	return
  1490  }
  1491  
  1492  // GetSQLContainerPreparer prepares the GetSQLContainer request.
  1493  func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
  1494  	pathParameters := map[string]interface{}{
  1495  		"accountName":       autorest.Encode("path", accountName),
  1496  		"containerName":     autorest.Encode("path", containerName),
  1497  		"databaseName":      autorest.Encode("path", databaseName),
  1498  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1499  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1500  	}
  1501  
  1502  	const APIVersion = "2021-04-01-preview"
  1503  	queryParameters := map[string]interface{}{
  1504  		"api-version": APIVersion,
  1505  	}
  1506  
  1507  	preparer := autorest.CreatePreparer(
  1508  		autorest.AsGet(),
  1509  		autorest.WithBaseURL(client.BaseURI),
  1510  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters),
  1511  		autorest.WithQueryParameters(queryParameters))
  1512  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1513  }
  1514  
  1515  // GetSQLContainerSender sends the GetSQLContainer request. The method will close the
  1516  // http.Response Body if it receives an error.
  1517  func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) {
  1518  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1519  }
  1520  
  1521  // GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always
  1522  // closes the http.Response Body.
  1523  func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) {
  1524  	err = autorest.Respond(
  1525  		resp,
  1526  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1527  		autorest.ByUnmarshallingJSON(&result),
  1528  		autorest.ByClosing())
  1529  	result.Response = autorest.Response{Response: resp}
  1530  	return
  1531  }
  1532  
  1533  // GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database
  1534  // account.
  1535  // Parameters:
  1536  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1537  // accountName - cosmos DB database account name.
  1538  // databaseName - cosmos DB database name.
  1539  // containerName - cosmos DB container name.
  1540  func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) {
  1541  	if tracing.IsEnabled() {
  1542  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput")
  1543  		defer func() {
  1544  			sc := -1
  1545  			if result.Response.Response != nil {
  1546  				sc = result.Response.Response.StatusCode
  1547  			}
  1548  			tracing.EndSpan(ctx, sc, err)
  1549  		}()
  1550  	}
  1551  	if err := validation.Validate([]validation.Validation{
  1552  		{TargetValue: client.SubscriptionID,
  1553  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1554  		{TargetValue: resourceGroupName,
  1555  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1556  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1557  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1558  		{TargetValue: accountName,
  1559  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1560  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1561  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1562  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error())
  1563  	}
  1564  
  1565  	req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
  1566  	if err != nil {
  1567  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request")
  1568  		return
  1569  	}
  1570  
  1571  	resp, err := client.GetSQLContainerThroughputSender(req)
  1572  	if err != nil {
  1573  		result.Response = autorest.Response{Response: resp}
  1574  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request")
  1575  		return
  1576  	}
  1577  
  1578  	result, err = client.GetSQLContainerThroughputResponder(resp)
  1579  	if err != nil {
  1580  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request")
  1581  		return
  1582  	}
  1583  
  1584  	return
  1585  }
  1586  
  1587  // GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request.
  1588  func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
  1589  	pathParameters := map[string]interface{}{
  1590  		"accountName":       autorest.Encode("path", accountName),
  1591  		"containerName":     autorest.Encode("path", containerName),
  1592  		"databaseName":      autorest.Encode("path", databaseName),
  1593  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1594  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1595  	}
  1596  
  1597  	const APIVersion = "2021-04-01-preview"
  1598  	queryParameters := map[string]interface{}{
  1599  		"api-version": APIVersion,
  1600  	}
  1601  
  1602  	preparer := autorest.CreatePreparer(
  1603  		autorest.AsGet(),
  1604  		autorest.WithBaseURL(client.BaseURI),
  1605  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters),
  1606  		autorest.WithQueryParameters(queryParameters))
  1607  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1608  }
  1609  
  1610  // GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the
  1611  // http.Response Body if it receives an error.
  1612  func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) {
  1613  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1614  }
  1615  
  1616  // GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always
  1617  // closes the http.Response Body.
  1618  func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1619  	err = autorest.Respond(
  1620  		resp,
  1621  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1622  		autorest.ByUnmarshallingJSON(&result),
  1623  		autorest.ByClosing())
  1624  	result.Response = autorest.Response{Response: resp}
  1625  	return
  1626  }
  1627  
  1628  // GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name.
  1629  // Parameters:
  1630  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1631  // accountName - cosmos DB database account name.
  1632  // databaseName - cosmos DB database name.
  1633  func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) {
  1634  	if tracing.IsEnabled() {
  1635  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase")
  1636  		defer func() {
  1637  			sc := -1
  1638  			if result.Response.Response != nil {
  1639  				sc = result.Response.Response.StatusCode
  1640  			}
  1641  			tracing.EndSpan(ctx, sc, err)
  1642  		}()
  1643  	}
  1644  	if err := validation.Validate([]validation.Validation{
  1645  		{TargetValue: client.SubscriptionID,
  1646  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1647  		{TargetValue: resourceGroupName,
  1648  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1649  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1650  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1651  		{TargetValue: accountName,
  1652  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1653  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1654  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1655  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error())
  1656  	}
  1657  
  1658  	req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
  1659  	if err != nil {
  1660  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request")
  1661  		return
  1662  	}
  1663  
  1664  	resp, err := client.GetSQLDatabaseSender(req)
  1665  	if err != nil {
  1666  		result.Response = autorest.Response{Response: resp}
  1667  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request")
  1668  		return
  1669  	}
  1670  
  1671  	result, err = client.GetSQLDatabaseResponder(resp)
  1672  	if err != nil {
  1673  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request")
  1674  		return
  1675  	}
  1676  
  1677  	return
  1678  }
  1679  
  1680  // GetSQLDatabasePreparer prepares the GetSQLDatabase request.
  1681  func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  1682  	pathParameters := map[string]interface{}{
  1683  		"accountName":       autorest.Encode("path", accountName),
  1684  		"databaseName":      autorest.Encode("path", databaseName),
  1685  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1686  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1687  	}
  1688  
  1689  	const APIVersion = "2021-04-01-preview"
  1690  	queryParameters := map[string]interface{}{
  1691  		"api-version": APIVersion,
  1692  	}
  1693  
  1694  	preparer := autorest.CreatePreparer(
  1695  		autorest.AsGet(),
  1696  		autorest.WithBaseURL(client.BaseURI),
  1697  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters),
  1698  		autorest.WithQueryParameters(queryParameters))
  1699  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1700  }
  1701  
  1702  // GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the
  1703  // http.Response Body if it receives an error.
  1704  func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) {
  1705  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1706  }
  1707  
  1708  // GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always
  1709  // closes the http.Response Body.
  1710  func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) {
  1711  	err = autorest.Respond(
  1712  		resp,
  1713  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1714  		autorest.ByUnmarshallingJSON(&result),
  1715  		autorest.ByClosing())
  1716  	result.Response = autorest.Response{Response: resp}
  1717  	return
  1718  }
  1719  
  1720  // GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database
  1721  // account with the provided name.
  1722  // Parameters:
  1723  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1724  // accountName - cosmos DB database account name.
  1725  // databaseName - cosmos DB database name.
  1726  func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) {
  1727  	if tracing.IsEnabled() {
  1728  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput")
  1729  		defer func() {
  1730  			sc := -1
  1731  			if result.Response.Response != nil {
  1732  				sc = result.Response.Response.StatusCode
  1733  			}
  1734  			tracing.EndSpan(ctx, sc, err)
  1735  		}()
  1736  	}
  1737  	if err := validation.Validate([]validation.Validation{
  1738  		{TargetValue: client.SubscriptionID,
  1739  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1740  		{TargetValue: resourceGroupName,
  1741  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1742  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1743  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1744  		{TargetValue: accountName,
  1745  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1746  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1747  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1748  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error())
  1749  	}
  1750  
  1751  	req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName)
  1752  	if err != nil {
  1753  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request")
  1754  		return
  1755  	}
  1756  
  1757  	resp, err := client.GetSQLDatabaseThroughputSender(req)
  1758  	if err != nil {
  1759  		result.Response = autorest.Response{Response: resp}
  1760  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request")
  1761  		return
  1762  	}
  1763  
  1764  	result, err = client.GetSQLDatabaseThroughputResponder(resp)
  1765  	if err != nil {
  1766  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request")
  1767  		return
  1768  	}
  1769  
  1770  	return
  1771  }
  1772  
  1773  // GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request.
  1774  func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  1775  	pathParameters := map[string]interface{}{
  1776  		"accountName":       autorest.Encode("path", accountName),
  1777  		"databaseName":      autorest.Encode("path", databaseName),
  1778  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1779  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1780  	}
  1781  
  1782  	const APIVersion = "2021-04-01-preview"
  1783  	queryParameters := map[string]interface{}{
  1784  		"api-version": APIVersion,
  1785  	}
  1786  
  1787  	preparer := autorest.CreatePreparer(
  1788  		autorest.AsGet(),
  1789  		autorest.WithBaseURL(client.BaseURI),
  1790  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters),
  1791  		autorest.WithQueryParameters(queryParameters))
  1792  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1793  }
  1794  
  1795  // GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the
  1796  // http.Response Body if it receives an error.
  1797  func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) {
  1798  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1799  }
  1800  
  1801  // GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always
  1802  // closes the http.Response Body.
  1803  func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1804  	err = autorest.Respond(
  1805  		resp,
  1806  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1807  		autorest.ByUnmarshallingJSON(&result),
  1808  		autorest.ByClosing())
  1809  	result.Response = autorest.Response{Response: resp}
  1810  	return
  1811  }
  1812  
  1813  // GetSQLRoleAssignment retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id.
  1814  // Parameters:
  1815  // roleAssignmentID - the GUID for the Role Assignment.
  1816  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1817  // accountName - cosmos DB database account name.
  1818  func (client SQLResourcesClient) GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLRoleAssignmentGetResults, err error) {
  1819  	if tracing.IsEnabled() {
  1820  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleAssignment")
  1821  		defer func() {
  1822  			sc := -1
  1823  			if result.Response.Response != nil {
  1824  				sc = result.Response.Response.StatusCode
  1825  			}
  1826  			tracing.EndSpan(ctx, sc, err)
  1827  		}()
  1828  	}
  1829  	if err := validation.Validate([]validation.Validation{
  1830  		{TargetValue: client.SubscriptionID,
  1831  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1832  		{TargetValue: resourceGroupName,
  1833  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1834  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1835  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1836  		{TargetValue: accountName,
  1837  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1838  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1839  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1840  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleAssignment", err.Error())
  1841  	}
  1842  
  1843  	req, err := client.GetSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName)
  1844  	if err != nil {
  1845  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", nil, "Failure preparing request")
  1846  		return
  1847  	}
  1848  
  1849  	resp, err := client.GetSQLRoleAssignmentSender(req)
  1850  	if err != nil {
  1851  		result.Response = autorest.Response{Response: resp}
  1852  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure sending request")
  1853  		return
  1854  	}
  1855  
  1856  	result, err = client.GetSQLRoleAssignmentResponder(resp)
  1857  	if err != nil {
  1858  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure responding to request")
  1859  		return
  1860  	}
  1861  
  1862  	return
  1863  }
  1864  
  1865  // GetSQLRoleAssignmentPreparer prepares the GetSQLRoleAssignment request.
  1866  func (client SQLResourcesClient) GetSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) {
  1867  	pathParameters := map[string]interface{}{
  1868  		"accountName":       autorest.Encode("path", accountName),
  1869  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1870  		"roleAssignmentId":  autorest.Encode("path", roleAssignmentID),
  1871  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1872  	}
  1873  
  1874  	const APIVersion = "2021-04-01-preview"
  1875  	queryParameters := map[string]interface{}{
  1876  		"api-version": APIVersion,
  1877  	}
  1878  
  1879  	preparer := autorest.CreatePreparer(
  1880  		autorest.AsGet(),
  1881  		autorest.WithBaseURL(client.BaseURI),
  1882  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters),
  1883  		autorest.WithQueryParameters(queryParameters))
  1884  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1885  }
  1886  
  1887  // GetSQLRoleAssignmentSender sends the GetSQLRoleAssignment request. The method will close the
  1888  // http.Response Body if it receives an error.
  1889  func (client SQLResourcesClient) GetSQLRoleAssignmentSender(req *http.Request) (*http.Response, error) {
  1890  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1891  }
  1892  
  1893  // GetSQLRoleAssignmentResponder handles the response to the GetSQLRoleAssignment request. The method always
  1894  // closes the http.Response Body.
  1895  func (client SQLResourcesClient) GetSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) {
  1896  	err = autorest.Respond(
  1897  		resp,
  1898  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1899  		autorest.ByUnmarshallingJSON(&result),
  1900  		autorest.ByClosing())
  1901  	result.Response = autorest.Response{Response: resp}
  1902  	return
  1903  }
  1904  
  1905  // GetSQLRoleDefinition retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id.
  1906  // Parameters:
  1907  // roleDefinitionID - the GUID for the Role Definition.
  1908  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1909  // accountName - cosmos DB database account name.
  1910  func (client SQLResourcesClient) GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLRoleDefinitionGetResults, err error) {
  1911  	if tracing.IsEnabled() {
  1912  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleDefinition")
  1913  		defer func() {
  1914  			sc := -1
  1915  			if result.Response.Response != nil {
  1916  				sc = result.Response.Response.StatusCode
  1917  			}
  1918  			tracing.EndSpan(ctx, sc, err)
  1919  		}()
  1920  	}
  1921  	if err := validation.Validate([]validation.Validation{
  1922  		{TargetValue: client.SubscriptionID,
  1923  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1924  		{TargetValue: resourceGroupName,
  1925  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1926  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  1927  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  1928  		{TargetValue: accountName,
  1929  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1930  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1931  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1932  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleDefinition", err.Error())
  1933  	}
  1934  
  1935  	req, err := client.GetSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName)
  1936  	if err != nil {
  1937  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", nil, "Failure preparing request")
  1938  		return
  1939  	}
  1940  
  1941  	resp, err := client.GetSQLRoleDefinitionSender(req)
  1942  	if err != nil {
  1943  		result.Response = autorest.Response{Response: resp}
  1944  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure sending request")
  1945  		return
  1946  	}
  1947  
  1948  	result, err = client.GetSQLRoleDefinitionResponder(resp)
  1949  	if err != nil {
  1950  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure responding to request")
  1951  		return
  1952  	}
  1953  
  1954  	return
  1955  }
  1956  
  1957  // GetSQLRoleDefinitionPreparer prepares the GetSQLRoleDefinition request.
  1958  func (client SQLResourcesClient) GetSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) {
  1959  	pathParameters := map[string]interface{}{
  1960  		"accountName":       autorest.Encode("path", accountName),
  1961  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1962  		"roleDefinitionId":  autorest.Encode("path", roleDefinitionID),
  1963  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1964  	}
  1965  
  1966  	const APIVersion = "2021-04-01-preview"
  1967  	queryParameters := map[string]interface{}{
  1968  		"api-version": APIVersion,
  1969  	}
  1970  
  1971  	preparer := autorest.CreatePreparer(
  1972  		autorest.AsGet(),
  1973  		autorest.WithBaseURL(client.BaseURI),
  1974  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters),
  1975  		autorest.WithQueryParameters(queryParameters))
  1976  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1977  }
  1978  
  1979  // GetSQLRoleDefinitionSender sends the GetSQLRoleDefinition request. The method will close the
  1980  // http.Response Body if it receives an error.
  1981  func (client SQLResourcesClient) GetSQLRoleDefinitionSender(req *http.Request) (*http.Response, error) {
  1982  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1983  }
  1984  
  1985  // GetSQLRoleDefinitionResponder handles the response to the GetSQLRoleDefinition request. The method always
  1986  // closes the http.Response Body.
  1987  func (client SQLResourcesClient) GetSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) {
  1988  	err = autorest.Respond(
  1989  		resp,
  1990  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1991  		autorest.ByUnmarshallingJSON(&result),
  1992  		autorest.ByClosing())
  1993  	result.Response = autorest.Response{Response: resp}
  1994  	return
  1995  }
  1996  
  1997  // GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account.
  1998  // Parameters:
  1999  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2000  // accountName - cosmos DB database account name.
  2001  // databaseName - cosmos DB database name.
  2002  // containerName - cosmos DB container name.
  2003  // storedProcedureName - cosmos DB storedProcedure name.
  2004  func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) {
  2005  	if tracing.IsEnabled() {
  2006  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure")
  2007  		defer func() {
  2008  			sc := -1
  2009  			if result.Response.Response != nil {
  2010  				sc = result.Response.Response.StatusCode
  2011  			}
  2012  			tracing.EndSpan(ctx, sc, err)
  2013  		}()
  2014  	}
  2015  	if err := validation.Validate([]validation.Validation{
  2016  		{TargetValue: client.SubscriptionID,
  2017  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2018  		{TargetValue: resourceGroupName,
  2019  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2020  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2021  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2022  		{TargetValue: accountName,
  2023  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2024  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2025  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2026  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error())
  2027  	}
  2028  
  2029  	req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName)
  2030  	if err != nil {
  2031  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request")
  2032  		return
  2033  	}
  2034  
  2035  	resp, err := client.GetSQLStoredProcedureSender(req)
  2036  	if err != nil {
  2037  		result.Response = autorest.Response{Response: resp}
  2038  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request")
  2039  		return
  2040  	}
  2041  
  2042  	result, err = client.GetSQLStoredProcedureResponder(resp)
  2043  	if err != nil {
  2044  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request")
  2045  		return
  2046  	}
  2047  
  2048  	return
  2049  }
  2050  
  2051  // GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request.
  2052  func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) {
  2053  	pathParameters := map[string]interface{}{
  2054  		"accountName":         autorest.Encode("path", accountName),
  2055  		"containerName":       autorest.Encode("path", containerName),
  2056  		"databaseName":        autorest.Encode("path", databaseName),
  2057  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
  2058  		"storedProcedureName": autorest.Encode("path", storedProcedureName),
  2059  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
  2060  	}
  2061  
  2062  	const APIVersion = "2021-04-01-preview"
  2063  	queryParameters := map[string]interface{}{
  2064  		"api-version": APIVersion,
  2065  	}
  2066  
  2067  	preparer := autorest.CreatePreparer(
  2068  		autorest.AsGet(),
  2069  		autorest.WithBaseURL(client.BaseURI),
  2070  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters),
  2071  		autorest.WithQueryParameters(queryParameters))
  2072  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2073  }
  2074  
  2075  // GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the
  2076  // http.Response Body if it receives an error.
  2077  func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) {
  2078  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2079  }
  2080  
  2081  // GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always
  2082  // closes the http.Response Body.
  2083  func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) {
  2084  	err = autorest.Respond(
  2085  		resp,
  2086  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2087  		autorest.ByUnmarshallingJSON(&result),
  2088  		autorest.ByClosing())
  2089  	result.Response = autorest.Response{Response: resp}
  2090  	return
  2091  }
  2092  
  2093  // GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account.
  2094  // Parameters:
  2095  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2096  // accountName - cosmos DB database account name.
  2097  // databaseName - cosmos DB database name.
  2098  // containerName - cosmos DB container name.
  2099  // triggerName - cosmos DB trigger name.
  2100  func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) {
  2101  	if tracing.IsEnabled() {
  2102  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger")
  2103  		defer func() {
  2104  			sc := -1
  2105  			if result.Response.Response != nil {
  2106  				sc = result.Response.Response.StatusCode
  2107  			}
  2108  			tracing.EndSpan(ctx, sc, err)
  2109  		}()
  2110  	}
  2111  	if err := validation.Validate([]validation.Validation{
  2112  		{TargetValue: client.SubscriptionID,
  2113  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2114  		{TargetValue: resourceGroupName,
  2115  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2116  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2117  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2118  		{TargetValue: accountName,
  2119  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2120  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2121  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2122  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error())
  2123  	}
  2124  
  2125  	req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName)
  2126  	if err != nil {
  2127  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request")
  2128  		return
  2129  	}
  2130  
  2131  	resp, err := client.GetSQLTriggerSender(req)
  2132  	if err != nil {
  2133  		result.Response = autorest.Response{Response: resp}
  2134  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request")
  2135  		return
  2136  	}
  2137  
  2138  	result, err = client.GetSQLTriggerResponder(resp)
  2139  	if err != nil {
  2140  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request")
  2141  		return
  2142  	}
  2143  
  2144  	return
  2145  }
  2146  
  2147  // GetSQLTriggerPreparer prepares the GetSQLTrigger request.
  2148  func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) {
  2149  	pathParameters := map[string]interface{}{
  2150  		"accountName":       autorest.Encode("path", accountName),
  2151  		"containerName":     autorest.Encode("path", containerName),
  2152  		"databaseName":      autorest.Encode("path", databaseName),
  2153  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2154  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2155  		"triggerName":       autorest.Encode("path", triggerName),
  2156  	}
  2157  
  2158  	const APIVersion = "2021-04-01-preview"
  2159  	queryParameters := map[string]interface{}{
  2160  		"api-version": APIVersion,
  2161  	}
  2162  
  2163  	preparer := autorest.CreatePreparer(
  2164  		autorest.AsGet(),
  2165  		autorest.WithBaseURL(client.BaseURI),
  2166  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters),
  2167  		autorest.WithQueryParameters(queryParameters))
  2168  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2169  }
  2170  
  2171  // GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the
  2172  // http.Response Body if it receives an error.
  2173  func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) {
  2174  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2175  }
  2176  
  2177  // GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always
  2178  // closes the http.Response Body.
  2179  func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) {
  2180  	err = autorest.Respond(
  2181  		resp,
  2182  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2183  		autorest.ByUnmarshallingJSON(&result),
  2184  		autorest.ByClosing())
  2185  	result.Response = autorest.Response{Response: resp}
  2186  	return
  2187  }
  2188  
  2189  // GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account.
  2190  // Parameters:
  2191  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2192  // accountName - cosmos DB database account name.
  2193  // databaseName - cosmos DB database name.
  2194  // containerName - cosmos DB container name.
  2195  // userDefinedFunctionName - cosmos DB userDefinedFunction name.
  2196  func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) {
  2197  	if tracing.IsEnabled() {
  2198  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction")
  2199  		defer func() {
  2200  			sc := -1
  2201  			if result.Response.Response != nil {
  2202  				sc = result.Response.Response.StatusCode
  2203  			}
  2204  			tracing.EndSpan(ctx, sc, err)
  2205  		}()
  2206  	}
  2207  	if err := validation.Validate([]validation.Validation{
  2208  		{TargetValue: client.SubscriptionID,
  2209  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2210  		{TargetValue: resourceGroupName,
  2211  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2212  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2213  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2214  		{TargetValue: accountName,
  2215  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2216  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2217  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2218  		return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error())
  2219  	}
  2220  
  2221  	req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName)
  2222  	if err != nil {
  2223  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request")
  2224  		return
  2225  	}
  2226  
  2227  	resp, err := client.GetSQLUserDefinedFunctionSender(req)
  2228  	if err != nil {
  2229  		result.Response = autorest.Response{Response: resp}
  2230  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request")
  2231  		return
  2232  	}
  2233  
  2234  	result, err = client.GetSQLUserDefinedFunctionResponder(resp)
  2235  	if err != nil {
  2236  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request")
  2237  		return
  2238  	}
  2239  
  2240  	return
  2241  }
  2242  
  2243  // GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request.
  2244  func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) {
  2245  	pathParameters := map[string]interface{}{
  2246  		"accountName":             autorest.Encode("path", accountName),
  2247  		"containerName":           autorest.Encode("path", containerName),
  2248  		"databaseName":            autorest.Encode("path", databaseName),
  2249  		"resourceGroupName":       autorest.Encode("path", resourceGroupName),
  2250  		"subscriptionId":          autorest.Encode("path", client.SubscriptionID),
  2251  		"userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName),
  2252  	}
  2253  
  2254  	const APIVersion = "2021-04-01-preview"
  2255  	queryParameters := map[string]interface{}{
  2256  		"api-version": APIVersion,
  2257  	}
  2258  
  2259  	preparer := autorest.CreatePreparer(
  2260  		autorest.AsGet(),
  2261  		autorest.WithBaseURL(client.BaseURI),
  2262  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters),
  2263  		autorest.WithQueryParameters(queryParameters))
  2264  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2265  }
  2266  
  2267  // GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the
  2268  // http.Response Body if it receives an error.
  2269  func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) {
  2270  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2271  }
  2272  
  2273  // GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always
  2274  // closes the http.Response Body.
  2275  func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) {
  2276  	err = autorest.Respond(
  2277  		resp,
  2278  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2279  		autorest.ByUnmarshallingJSON(&result),
  2280  		autorest.ByClosing())
  2281  	result.Response = autorest.Response{Response: resp}
  2282  	return
  2283  }
  2284  
  2285  // ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account.
  2286  // Parameters:
  2287  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2288  // accountName - cosmos DB database account name.
  2289  // databaseName - cosmos DB database name.
  2290  func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) {
  2291  	if tracing.IsEnabled() {
  2292  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers")
  2293  		defer func() {
  2294  			sc := -1
  2295  			if result.Response.Response != nil {
  2296  				sc = result.Response.Response.StatusCode
  2297  			}
  2298  			tracing.EndSpan(ctx, sc, err)
  2299  		}()
  2300  	}
  2301  	if err := validation.Validate([]validation.Validation{
  2302  		{TargetValue: client.SubscriptionID,
  2303  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2304  		{TargetValue: resourceGroupName,
  2305  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2306  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2307  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2308  		{TargetValue: accountName,
  2309  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2310  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2311  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2312  		return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error())
  2313  	}
  2314  
  2315  	req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName)
  2316  	if err != nil {
  2317  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request")
  2318  		return
  2319  	}
  2320  
  2321  	resp, err := client.ListSQLContainersSender(req)
  2322  	if err != nil {
  2323  		result.Response = autorest.Response{Response: resp}
  2324  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request")
  2325  		return
  2326  	}
  2327  
  2328  	result, err = client.ListSQLContainersResponder(resp)
  2329  	if err != nil {
  2330  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request")
  2331  		return
  2332  	}
  2333  
  2334  	return
  2335  }
  2336  
  2337  // ListSQLContainersPreparer prepares the ListSQLContainers request.
  2338  func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  2339  	pathParameters := map[string]interface{}{
  2340  		"accountName":       autorest.Encode("path", accountName),
  2341  		"databaseName":      autorest.Encode("path", databaseName),
  2342  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2343  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2344  	}
  2345  
  2346  	const APIVersion = "2021-04-01-preview"
  2347  	queryParameters := map[string]interface{}{
  2348  		"api-version": APIVersion,
  2349  	}
  2350  
  2351  	preparer := autorest.CreatePreparer(
  2352  		autorest.AsGet(),
  2353  		autorest.WithBaseURL(client.BaseURI),
  2354  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters),
  2355  		autorest.WithQueryParameters(queryParameters))
  2356  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2357  }
  2358  
  2359  // ListSQLContainersSender sends the ListSQLContainers request. The method will close the
  2360  // http.Response Body if it receives an error.
  2361  func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) {
  2362  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2363  }
  2364  
  2365  // ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always
  2366  // closes the http.Response Body.
  2367  func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) {
  2368  	err = autorest.Respond(
  2369  		resp,
  2370  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2371  		autorest.ByUnmarshallingJSON(&result),
  2372  		autorest.ByClosing())
  2373  	result.Response = autorest.Response{Response: resp}
  2374  	return
  2375  }
  2376  
  2377  // ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account.
  2378  // Parameters:
  2379  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2380  // accountName - cosmos DB database account name.
  2381  func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) {
  2382  	if tracing.IsEnabled() {
  2383  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases")
  2384  		defer func() {
  2385  			sc := -1
  2386  			if result.Response.Response != nil {
  2387  				sc = result.Response.Response.StatusCode
  2388  			}
  2389  			tracing.EndSpan(ctx, sc, err)
  2390  		}()
  2391  	}
  2392  	if err := validation.Validate([]validation.Validation{
  2393  		{TargetValue: client.SubscriptionID,
  2394  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2395  		{TargetValue: resourceGroupName,
  2396  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2397  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2398  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2399  		{TargetValue: accountName,
  2400  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2401  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2402  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2403  		return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error())
  2404  	}
  2405  
  2406  	req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName)
  2407  	if err != nil {
  2408  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request")
  2409  		return
  2410  	}
  2411  
  2412  	resp, err := client.ListSQLDatabasesSender(req)
  2413  	if err != nil {
  2414  		result.Response = autorest.Response{Response: resp}
  2415  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request")
  2416  		return
  2417  	}
  2418  
  2419  	result, err = client.ListSQLDatabasesResponder(resp)
  2420  	if err != nil {
  2421  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request")
  2422  		return
  2423  	}
  2424  
  2425  	return
  2426  }
  2427  
  2428  // ListSQLDatabasesPreparer prepares the ListSQLDatabases request.
  2429  func (client SQLResourcesClient) ListSQLDatabasesPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
  2430  	pathParameters := map[string]interface{}{
  2431  		"accountName":       autorest.Encode("path", accountName),
  2432  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2433  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2434  	}
  2435  
  2436  	const APIVersion = "2021-04-01-preview"
  2437  	queryParameters := map[string]interface{}{
  2438  		"api-version": APIVersion,
  2439  	}
  2440  
  2441  	preparer := autorest.CreatePreparer(
  2442  		autorest.AsGet(),
  2443  		autorest.WithBaseURL(client.BaseURI),
  2444  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters),
  2445  		autorest.WithQueryParameters(queryParameters))
  2446  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2447  }
  2448  
  2449  // ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the
  2450  // http.Response Body if it receives an error.
  2451  func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) {
  2452  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2453  }
  2454  
  2455  // ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always
  2456  // closes the http.Response Body.
  2457  func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) {
  2458  	err = autorest.Respond(
  2459  		resp,
  2460  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2461  		autorest.ByUnmarshallingJSON(&result),
  2462  		autorest.ByClosing())
  2463  	result.Response = autorest.Response{Response: resp}
  2464  	return
  2465  }
  2466  
  2467  // ListSQLRoleAssignments retrieves the list of all Azure Cosmos DB SQL Role Assignments.
  2468  // Parameters:
  2469  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2470  // accountName - cosmos DB database account name.
  2471  func (client SQLResourcesClient) ListSQLRoleAssignments(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleAssignmentListResult, err error) {
  2472  	if tracing.IsEnabled() {
  2473  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleAssignments")
  2474  		defer func() {
  2475  			sc := -1
  2476  			if result.Response.Response != nil {
  2477  				sc = result.Response.Response.StatusCode
  2478  			}
  2479  			tracing.EndSpan(ctx, sc, err)
  2480  		}()
  2481  	}
  2482  	if err := validation.Validate([]validation.Validation{
  2483  		{TargetValue: client.SubscriptionID,
  2484  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2485  		{TargetValue: resourceGroupName,
  2486  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2487  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2488  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2489  		{TargetValue: accountName,
  2490  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2491  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2492  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2493  		return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleAssignments", err.Error())
  2494  	}
  2495  
  2496  	req, err := client.ListSQLRoleAssignmentsPreparer(ctx, resourceGroupName, accountName)
  2497  	if err != nil {
  2498  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", nil, "Failure preparing request")
  2499  		return
  2500  	}
  2501  
  2502  	resp, err := client.ListSQLRoleAssignmentsSender(req)
  2503  	if err != nil {
  2504  		result.Response = autorest.Response{Response: resp}
  2505  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure sending request")
  2506  		return
  2507  	}
  2508  
  2509  	result, err = client.ListSQLRoleAssignmentsResponder(resp)
  2510  	if err != nil {
  2511  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure responding to request")
  2512  		return
  2513  	}
  2514  
  2515  	return
  2516  }
  2517  
  2518  // ListSQLRoleAssignmentsPreparer prepares the ListSQLRoleAssignments request.
  2519  func (client SQLResourcesClient) ListSQLRoleAssignmentsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
  2520  	pathParameters := map[string]interface{}{
  2521  		"accountName":       autorest.Encode("path", accountName),
  2522  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2523  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2524  	}
  2525  
  2526  	const APIVersion = "2021-04-01-preview"
  2527  	queryParameters := map[string]interface{}{
  2528  		"api-version": APIVersion,
  2529  	}
  2530  
  2531  	preparer := autorest.CreatePreparer(
  2532  		autorest.AsGet(),
  2533  		autorest.WithBaseURL(client.BaseURI),
  2534  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments", pathParameters),
  2535  		autorest.WithQueryParameters(queryParameters))
  2536  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2537  }
  2538  
  2539  // ListSQLRoleAssignmentsSender sends the ListSQLRoleAssignments request. The method will close the
  2540  // http.Response Body if it receives an error.
  2541  func (client SQLResourcesClient) ListSQLRoleAssignmentsSender(req *http.Request) (*http.Response, error) {
  2542  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2543  }
  2544  
  2545  // ListSQLRoleAssignmentsResponder handles the response to the ListSQLRoleAssignments request. The method always
  2546  // closes the http.Response Body.
  2547  func (client SQLResourcesClient) ListSQLRoleAssignmentsResponder(resp *http.Response) (result SQLRoleAssignmentListResult, err error) {
  2548  	err = autorest.Respond(
  2549  		resp,
  2550  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2551  		autorest.ByUnmarshallingJSON(&result),
  2552  		autorest.ByClosing())
  2553  	result.Response = autorest.Response{Response: resp}
  2554  	return
  2555  }
  2556  
  2557  // ListSQLRoleDefinitions retrieves the list of all Azure Cosmos DB SQL Role Definitions.
  2558  // Parameters:
  2559  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2560  // accountName - cosmos DB database account name.
  2561  func (client SQLResourcesClient) ListSQLRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleDefinitionListResult, err error) {
  2562  	if tracing.IsEnabled() {
  2563  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleDefinitions")
  2564  		defer func() {
  2565  			sc := -1
  2566  			if result.Response.Response != nil {
  2567  				sc = result.Response.Response.StatusCode
  2568  			}
  2569  			tracing.EndSpan(ctx, sc, err)
  2570  		}()
  2571  	}
  2572  	if err := validation.Validate([]validation.Validation{
  2573  		{TargetValue: client.SubscriptionID,
  2574  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2575  		{TargetValue: resourceGroupName,
  2576  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2577  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2578  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2579  		{TargetValue: accountName,
  2580  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2581  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2582  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2583  		return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", err.Error())
  2584  	}
  2585  
  2586  	req, err := client.ListSQLRoleDefinitionsPreparer(ctx, resourceGroupName, accountName)
  2587  	if err != nil {
  2588  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", nil, "Failure preparing request")
  2589  		return
  2590  	}
  2591  
  2592  	resp, err := client.ListSQLRoleDefinitionsSender(req)
  2593  	if err != nil {
  2594  		result.Response = autorest.Response{Response: resp}
  2595  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure sending request")
  2596  		return
  2597  	}
  2598  
  2599  	result, err = client.ListSQLRoleDefinitionsResponder(resp)
  2600  	if err != nil {
  2601  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure responding to request")
  2602  		return
  2603  	}
  2604  
  2605  	return
  2606  }
  2607  
  2608  // ListSQLRoleDefinitionsPreparer prepares the ListSQLRoleDefinitions request.
  2609  func (client SQLResourcesClient) ListSQLRoleDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
  2610  	pathParameters := map[string]interface{}{
  2611  		"accountName":       autorest.Encode("path", accountName),
  2612  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2613  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2614  	}
  2615  
  2616  	const APIVersion = "2021-04-01-preview"
  2617  	queryParameters := map[string]interface{}{
  2618  		"api-version": APIVersion,
  2619  	}
  2620  
  2621  	preparer := autorest.CreatePreparer(
  2622  		autorest.AsGet(),
  2623  		autorest.WithBaseURL(client.BaseURI),
  2624  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions", pathParameters),
  2625  		autorest.WithQueryParameters(queryParameters))
  2626  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2627  }
  2628  
  2629  // ListSQLRoleDefinitionsSender sends the ListSQLRoleDefinitions request. The method will close the
  2630  // http.Response Body if it receives an error.
  2631  func (client SQLResourcesClient) ListSQLRoleDefinitionsSender(req *http.Request) (*http.Response, error) {
  2632  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2633  }
  2634  
  2635  // ListSQLRoleDefinitionsResponder handles the response to the ListSQLRoleDefinitions request. The method always
  2636  // closes the http.Response Body.
  2637  func (client SQLResourcesClient) ListSQLRoleDefinitionsResponder(resp *http.Response) (result SQLRoleDefinitionListResult, err error) {
  2638  	err = autorest.Respond(
  2639  		resp,
  2640  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2641  		autorest.ByUnmarshallingJSON(&result),
  2642  		autorest.ByClosing())
  2643  	result.Response = autorest.Response{Response: resp}
  2644  	return
  2645  }
  2646  
  2647  // ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account.
  2648  // Parameters:
  2649  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2650  // accountName - cosmos DB database account name.
  2651  // databaseName - cosmos DB database name.
  2652  // containerName - cosmos DB container name.
  2653  func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) {
  2654  	if tracing.IsEnabled() {
  2655  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures")
  2656  		defer func() {
  2657  			sc := -1
  2658  			if result.Response.Response != nil {
  2659  				sc = result.Response.Response.StatusCode
  2660  			}
  2661  			tracing.EndSpan(ctx, sc, err)
  2662  		}()
  2663  	}
  2664  	if err := validation.Validate([]validation.Validation{
  2665  		{TargetValue: client.SubscriptionID,
  2666  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2667  		{TargetValue: resourceGroupName,
  2668  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2669  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2670  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2671  		{TargetValue: accountName,
  2672  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2673  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2674  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2675  		return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error())
  2676  	}
  2677  
  2678  	req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
  2679  	if err != nil {
  2680  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request")
  2681  		return
  2682  	}
  2683  
  2684  	resp, err := client.ListSQLStoredProceduresSender(req)
  2685  	if err != nil {
  2686  		result.Response = autorest.Response{Response: resp}
  2687  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request")
  2688  		return
  2689  	}
  2690  
  2691  	result, err = client.ListSQLStoredProceduresResponder(resp)
  2692  	if err != nil {
  2693  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request")
  2694  		return
  2695  	}
  2696  
  2697  	return
  2698  }
  2699  
  2700  // ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request.
  2701  func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
  2702  	pathParameters := map[string]interface{}{
  2703  		"accountName":       autorest.Encode("path", accountName),
  2704  		"containerName":     autorest.Encode("path", containerName),
  2705  		"databaseName":      autorest.Encode("path", databaseName),
  2706  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2707  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2708  	}
  2709  
  2710  	const APIVersion = "2021-04-01-preview"
  2711  	queryParameters := map[string]interface{}{
  2712  		"api-version": APIVersion,
  2713  	}
  2714  
  2715  	preparer := autorest.CreatePreparer(
  2716  		autorest.AsGet(),
  2717  		autorest.WithBaseURL(client.BaseURI),
  2718  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters),
  2719  		autorest.WithQueryParameters(queryParameters))
  2720  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2721  }
  2722  
  2723  // ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the
  2724  // http.Response Body if it receives an error.
  2725  func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) {
  2726  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2727  }
  2728  
  2729  // ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always
  2730  // closes the http.Response Body.
  2731  func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) {
  2732  	err = autorest.Respond(
  2733  		resp,
  2734  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2735  		autorest.ByUnmarshallingJSON(&result),
  2736  		autorest.ByClosing())
  2737  	result.Response = autorest.Response{Response: resp}
  2738  	return
  2739  }
  2740  
  2741  // ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account.
  2742  // Parameters:
  2743  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2744  // accountName - cosmos DB database account name.
  2745  // databaseName - cosmos DB database name.
  2746  // containerName - cosmos DB container name.
  2747  func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) {
  2748  	if tracing.IsEnabled() {
  2749  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers")
  2750  		defer func() {
  2751  			sc := -1
  2752  			if result.Response.Response != nil {
  2753  				sc = result.Response.Response.StatusCode
  2754  			}
  2755  			tracing.EndSpan(ctx, sc, err)
  2756  		}()
  2757  	}
  2758  	if err := validation.Validate([]validation.Validation{
  2759  		{TargetValue: client.SubscriptionID,
  2760  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2761  		{TargetValue: resourceGroupName,
  2762  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2763  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2764  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2765  		{TargetValue: accountName,
  2766  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2767  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2768  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2769  		return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error())
  2770  	}
  2771  
  2772  	req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
  2773  	if err != nil {
  2774  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request")
  2775  		return
  2776  	}
  2777  
  2778  	resp, err := client.ListSQLTriggersSender(req)
  2779  	if err != nil {
  2780  		result.Response = autorest.Response{Response: resp}
  2781  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request")
  2782  		return
  2783  	}
  2784  
  2785  	result, err = client.ListSQLTriggersResponder(resp)
  2786  	if err != nil {
  2787  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request")
  2788  		return
  2789  	}
  2790  
  2791  	return
  2792  }
  2793  
  2794  // ListSQLTriggersPreparer prepares the ListSQLTriggers request.
  2795  func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
  2796  	pathParameters := map[string]interface{}{
  2797  		"accountName":       autorest.Encode("path", accountName),
  2798  		"containerName":     autorest.Encode("path", containerName),
  2799  		"databaseName":      autorest.Encode("path", databaseName),
  2800  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2801  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2802  	}
  2803  
  2804  	const APIVersion = "2021-04-01-preview"
  2805  	queryParameters := map[string]interface{}{
  2806  		"api-version": APIVersion,
  2807  	}
  2808  
  2809  	preparer := autorest.CreatePreparer(
  2810  		autorest.AsGet(),
  2811  		autorest.WithBaseURL(client.BaseURI),
  2812  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters),
  2813  		autorest.WithQueryParameters(queryParameters))
  2814  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2815  }
  2816  
  2817  // ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the
  2818  // http.Response Body if it receives an error.
  2819  func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) {
  2820  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2821  }
  2822  
  2823  // ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always
  2824  // closes the http.Response Body.
  2825  func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) {
  2826  	err = autorest.Respond(
  2827  		resp,
  2828  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2829  		autorest.ByUnmarshallingJSON(&result),
  2830  		autorest.ByClosing())
  2831  	result.Response = autorest.Response{Response: resp}
  2832  	return
  2833  }
  2834  
  2835  // ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account.
  2836  // Parameters:
  2837  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2838  // accountName - cosmos DB database account name.
  2839  // databaseName - cosmos DB database name.
  2840  // containerName - cosmos DB container name.
  2841  func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) {
  2842  	if tracing.IsEnabled() {
  2843  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions")
  2844  		defer func() {
  2845  			sc := -1
  2846  			if result.Response.Response != nil {
  2847  				sc = result.Response.Response.StatusCode
  2848  			}
  2849  			tracing.EndSpan(ctx, sc, err)
  2850  		}()
  2851  	}
  2852  	if err := validation.Validate([]validation.Validation{
  2853  		{TargetValue: client.SubscriptionID,
  2854  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2855  		{TargetValue: resourceGroupName,
  2856  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2857  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2858  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2859  		{TargetValue: accountName,
  2860  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2861  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2862  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2863  		return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error())
  2864  	}
  2865  
  2866  	req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
  2867  	if err != nil {
  2868  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request")
  2869  		return
  2870  	}
  2871  
  2872  	resp, err := client.ListSQLUserDefinedFunctionsSender(req)
  2873  	if err != nil {
  2874  		result.Response = autorest.Response{Response: resp}
  2875  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request")
  2876  		return
  2877  	}
  2878  
  2879  	result, err = client.ListSQLUserDefinedFunctionsResponder(resp)
  2880  	if err != nil {
  2881  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request")
  2882  		return
  2883  	}
  2884  
  2885  	return
  2886  }
  2887  
  2888  // ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request.
  2889  func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
  2890  	pathParameters := map[string]interface{}{
  2891  		"accountName":       autorest.Encode("path", accountName),
  2892  		"containerName":     autorest.Encode("path", containerName),
  2893  		"databaseName":      autorest.Encode("path", databaseName),
  2894  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2895  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2896  	}
  2897  
  2898  	const APIVersion = "2021-04-01-preview"
  2899  	queryParameters := map[string]interface{}{
  2900  		"api-version": APIVersion,
  2901  	}
  2902  
  2903  	preparer := autorest.CreatePreparer(
  2904  		autorest.AsGet(),
  2905  		autorest.WithBaseURL(client.BaseURI),
  2906  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters),
  2907  		autorest.WithQueryParameters(queryParameters))
  2908  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2909  }
  2910  
  2911  // ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the
  2912  // http.Response Body if it receives an error.
  2913  func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) {
  2914  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  2915  }
  2916  
  2917  // ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always
  2918  // closes the http.Response Body.
  2919  func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) {
  2920  	err = autorest.Respond(
  2921  		resp,
  2922  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2923  		autorest.ByUnmarshallingJSON(&result),
  2924  		autorest.ByClosing())
  2925  	result.Response = autorest.Response{Response: resp}
  2926  	return
  2927  }
  2928  
  2929  // MigrateSQLContainerToAutoscale migrate an Azure Cosmos DB SQL container from manual throughput to autoscale
  2930  // Parameters:
  2931  // resourceGroupName - the name of the resource group. The name is case insensitive.
  2932  // accountName - cosmos DB database account name.
  2933  // databaseName - cosmos DB database name.
  2934  // containerName - cosmos DB container name.
  2935  func (client SQLResourcesClient) MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) {
  2936  	if tracing.IsEnabled() {
  2937  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToAutoscale")
  2938  		defer func() {
  2939  			sc := -1
  2940  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  2941  				sc = result.FutureAPI.Response().StatusCode
  2942  			}
  2943  			tracing.EndSpan(ctx, sc, err)
  2944  		}()
  2945  	}
  2946  	if err := validation.Validate([]validation.Validation{
  2947  		{TargetValue: client.SubscriptionID,
  2948  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  2949  		{TargetValue: resourceGroupName,
  2950  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  2951  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  2952  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  2953  		{TargetValue: accountName,
  2954  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  2955  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  2956  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  2957  		return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", err.Error())
  2958  	}
  2959  
  2960  	req, err := client.MigrateSQLContainerToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
  2961  	if err != nil {
  2962  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", nil, "Failure preparing request")
  2963  		return
  2964  	}
  2965  
  2966  	result, err = client.MigrateSQLContainerToAutoscaleSender(req)
  2967  	if err != nil {
  2968  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", result.Response(), "Failure sending request")
  2969  		return
  2970  	}
  2971  
  2972  	return
  2973  }
  2974  
  2975  // MigrateSQLContainerToAutoscalePreparer prepares the MigrateSQLContainerToAutoscale request.
  2976  func (client SQLResourcesClient) MigrateSQLContainerToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
  2977  	pathParameters := map[string]interface{}{
  2978  		"accountName":       autorest.Encode("path", accountName),
  2979  		"containerName":     autorest.Encode("path", containerName),
  2980  		"databaseName":      autorest.Encode("path", databaseName),
  2981  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  2982  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  2983  	}
  2984  
  2985  	const APIVersion = "2021-04-01-preview"
  2986  	queryParameters := map[string]interface{}{
  2987  		"api-version": APIVersion,
  2988  	}
  2989  
  2990  	preparer := autorest.CreatePreparer(
  2991  		autorest.AsPost(),
  2992  		autorest.WithBaseURL(client.BaseURI),
  2993  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale", pathParameters),
  2994  		autorest.WithQueryParameters(queryParameters))
  2995  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2996  }
  2997  
  2998  // MigrateSQLContainerToAutoscaleSender sends the MigrateSQLContainerToAutoscale request. The method will close the
  2999  // http.Response Body if it receives an error.
  3000  func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) {
  3001  	var resp *http.Response
  3002  	future.FutureAPI = &azure.Future{}
  3003  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3004  	if err != nil {
  3005  		return
  3006  	}
  3007  	var azf azure.Future
  3008  	azf, err = azure.NewFutureFromResponse(resp)
  3009  	future.FutureAPI = &azf
  3010  	future.Result = future.result
  3011  	return
  3012  }
  3013  
  3014  // MigrateSQLContainerToAutoscaleResponder handles the response to the MigrateSQLContainerToAutoscale request. The method always
  3015  // closes the http.Response Body.
  3016  func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  3017  	err = autorest.Respond(
  3018  		resp,
  3019  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3020  		autorest.ByUnmarshallingJSON(&result),
  3021  		autorest.ByClosing())
  3022  	result.Response = autorest.Response{Response: resp}
  3023  	return
  3024  }
  3025  
  3026  // MigrateSQLContainerToManualThroughput migrate an Azure Cosmos DB SQL container from autoscale to manual throughput
  3027  // Parameters:
  3028  // resourceGroupName - the name of the resource group. The name is case insensitive.
  3029  // accountName - cosmos DB database account name.
  3030  // databaseName - cosmos DB database name.
  3031  // containerName - cosmos DB container name.
  3032  func (client SQLResourcesClient) MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) {
  3033  	if tracing.IsEnabled() {
  3034  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToManualThroughput")
  3035  		defer func() {
  3036  			sc := -1
  3037  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3038  				sc = result.FutureAPI.Response().StatusCode
  3039  			}
  3040  			tracing.EndSpan(ctx, sc, err)
  3041  		}()
  3042  	}
  3043  	if err := validation.Validate([]validation.Validation{
  3044  		{TargetValue: client.SubscriptionID,
  3045  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  3046  		{TargetValue: resourceGroupName,
  3047  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3048  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3049  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3050  		{TargetValue: accountName,
  3051  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  3052  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  3053  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  3054  		return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", err.Error())
  3055  	}
  3056  
  3057  	req, err := client.MigrateSQLContainerToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName)
  3058  	if err != nil {
  3059  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", nil, "Failure preparing request")
  3060  		return
  3061  	}
  3062  
  3063  	result, err = client.MigrateSQLContainerToManualThroughputSender(req)
  3064  	if err != nil {
  3065  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", result.Response(), "Failure sending request")
  3066  		return
  3067  	}
  3068  
  3069  	return
  3070  }
  3071  
  3072  // MigrateSQLContainerToManualThroughputPreparer prepares the MigrateSQLContainerToManualThroughput request.
  3073  func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) {
  3074  	pathParameters := map[string]interface{}{
  3075  		"accountName":       autorest.Encode("path", accountName),
  3076  		"containerName":     autorest.Encode("path", containerName),
  3077  		"databaseName":      autorest.Encode("path", databaseName),
  3078  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3079  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3080  	}
  3081  
  3082  	const APIVersion = "2021-04-01-preview"
  3083  	queryParameters := map[string]interface{}{
  3084  		"api-version": APIVersion,
  3085  	}
  3086  
  3087  	preparer := autorest.CreatePreparer(
  3088  		autorest.AsPost(),
  3089  		autorest.WithBaseURL(client.BaseURI),
  3090  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
  3091  		autorest.WithQueryParameters(queryParameters))
  3092  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3093  }
  3094  
  3095  // MigrateSQLContainerToManualThroughputSender sends the MigrateSQLContainerToManualThroughput request. The method will close the
  3096  // http.Response Body if it receives an error.
  3097  func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) {
  3098  	var resp *http.Response
  3099  	future.FutureAPI = &azure.Future{}
  3100  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3101  	if err != nil {
  3102  		return
  3103  	}
  3104  	var azf azure.Future
  3105  	azf, err = azure.NewFutureFromResponse(resp)
  3106  	future.FutureAPI = &azf
  3107  	future.Result = future.result
  3108  	return
  3109  }
  3110  
  3111  // MigrateSQLContainerToManualThroughputResponder handles the response to the MigrateSQLContainerToManualThroughput request. The method always
  3112  // closes the http.Response Body.
  3113  func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  3114  	err = autorest.Respond(
  3115  		resp,
  3116  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3117  		autorest.ByUnmarshallingJSON(&result),
  3118  		autorest.ByClosing())
  3119  	result.Response = autorest.Response{Response: resp}
  3120  	return
  3121  }
  3122  
  3123  // MigrateSQLDatabaseToAutoscale migrate an Azure Cosmos DB SQL database from manual throughput to autoscale
  3124  // Parameters:
  3125  // resourceGroupName - the name of the resource group. The name is case insensitive.
  3126  // accountName - cosmos DB database account name.
  3127  // databaseName - cosmos DB database name.
  3128  func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) {
  3129  	if tracing.IsEnabled() {
  3130  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToAutoscale")
  3131  		defer func() {
  3132  			sc := -1
  3133  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3134  				sc = result.FutureAPI.Response().StatusCode
  3135  			}
  3136  			tracing.EndSpan(ctx, sc, err)
  3137  		}()
  3138  	}
  3139  	if err := validation.Validate([]validation.Validation{
  3140  		{TargetValue: client.SubscriptionID,
  3141  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  3142  		{TargetValue: resourceGroupName,
  3143  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3144  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3145  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3146  		{TargetValue: accountName,
  3147  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  3148  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  3149  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  3150  		return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", err.Error())
  3151  	}
  3152  
  3153  	req, err := client.MigrateSQLDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName)
  3154  	if err != nil {
  3155  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", nil, "Failure preparing request")
  3156  		return
  3157  	}
  3158  
  3159  	result, err = client.MigrateSQLDatabaseToAutoscaleSender(req)
  3160  	if err != nil {
  3161  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", result.Response(), "Failure sending request")
  3162  		return
  3163  	}
  3164  
  3165  	return
  3166  }
  3167  
  3168  // MigrateSQLDatabaseToAutoscalePreparer prepares the MigrateSQLDatabaseToAutoscale request.
  3169  func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  3170  	pathParameters := map[string]interface{}{
  3171  		"accountName":       autorest.Encode("path", accountName),
  3172  		"databaseName":      autorest.Encode("path", databaseName),
  3173  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3174  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3175  	}
  3176  
  3177  	const APIVersion = "2021-04-01-preview"
  3178  	queryParameters := map[string]interface{}{
  3179  		"api-version": APIVersion,
  3180  	}
  3181  
  3182  	preparer := autorest.CreatePreparer(
  3183  		autorest.AsPost(),
  3184  		autorest.WithBaseURL(client.BaseURI),
  3185  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters),
  3186  		autorest.WithQueryParameters(queryParameters))
  3187  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3188  }
  3189  
  3190  // MigrateSQLDatabaseToAutoscaleSender sends the MigrateSQLDatabaseToAutoscale request. The method will close the
  3191  // http.Response Body if it receives an error.
  3192  func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) {
  3193  	var resp *http.Response
  3194  	future.FutureAPI = &azure.Future{}
  3195  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3196  	if err != nil {
  3197  		return
  3198  	}
  3199  	var azf azure.Future
  3200  	azf, err = azure.NewFutureFromResponse(resp)
  3201  	future.FutureAPI = &azf
  3202  	future.Result = future.result
  3203  	return
  3204  }
  3205  
  3206  // MigrateSQLDatabaseToAutoscaleResponder handles the response to the MigrateSQLDatabaseToAutoscale request. The method always
  3207  // closes the http.Response Body.
  3208  func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  3209  	err = autorest.Respond(
  3210  		resp,
  3211  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3212  		autorest.ByUnmarshallingJSON(&result),
  3213  		autorest.ByClosing())
  3214  	result.Response = autorest.Response{Response: resp}
  3215  	return
  3216  }
  3217  
  3218  // MigrateSQLDatabaseToManualThroughput migrate an Azure Cosmos DB SQL database from autoscale to manual throughput
  3219  // Parameters:
  3220  // resourceGroupName - the name of the resource group. The name is case insensitive.
  3221  // accountName - cosmos DB database account name.
  3222  // databaseName - cosmos DB database name.
  3223  func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) {
  3224  	if tracing.IsEnabled() {
  3225  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToManualThroughput")
  3226  		defer func() {
  3227  			sc := -1
  3228  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3229  				sc = result.FutureAPI.Response().StatusCode
  3230  			}
  3231  			tracing.EndSpan(ctx, sc, err)
  3232  		}()
  3233  	}
  3234  	if err := validation.Validate([]validation.Validation{
  3235  		{TargetValue: client.SubscriptionID,
  3236  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  3237  		{TargetValue: resourceGroupName,
  3238  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3239  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3240  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3241  		{TargetValue: accountName,
  3242  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  3243  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  3244  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  3245  		return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", err.Error())
  3246  	}
  3247  
  3248  	req, err := client.MigrateSQLDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName)
  3249  	if err != nil {
  3250  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", nil, "Failure preparing request")
  3251  		return
  3252  	}
  3253  
  3254  	result, err = client.MigrateSQLDatabaseToManualThroughputSender(req)
  3255  	if err != nil {
  3256  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", result.Response(), "Failure sending request")
  3257  		return
  3258  	}
  3259  
  3260  	return
  3261  }
  3262  
  3263  // MigrateSQLDatabaseToManualThroughputPreparer prepares the MigrateSQLDatabaseToManualThroughput request.
  3264  func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
  3265  	pathParameters := map[string]interface{}{
  3266  		"accountName":       autorest.Encode("path", accountName),
  3267  		"databaseName":      autorest.Encode("path", databaseName),
  3268  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3269  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3270  	}
  3271  
  3272  	const APIVersion = "2021-04-01-preview"
  3273  	queryParameters := map[string]interface{}{
  3274  		"api-version": APIVersion,
  3275  	}
  3276  
  3277  	preparer := autorest.CreatePreparer(
  3278  		autorest.AsPost(),
  3279  		autorest.WithBaseURL(client.BaseURI),
  3280  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
  3281  		autorest.WithQueryParameters(queryParameters))
  3282  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3283  }
  3284  
  3285  // MigrateSQLDatabaseToManualThroughputSender sends the MigrateSQLDatabaseToManualThroughput request. The method will close the
  3286  // http.Response Body if it receives an error.
  3287  func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) {
  3288  	var resp *http.Response
  3289  	future.FutureAPI = &azure.Future{}
  3290  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3291  	if err != nil {
  3292  		return
  3293  	}
  3294  	var azf azure.Future
  3295  	azf, err = azure.NewFutureFromResponse(resp)
  3296  	future.FutureAPI = &azf
  3297  	future.Result = future.result
  3298  	return
  3299  }
  3300  
  3301  // MigrateSQLDatabaseToManualThroughputResponder handles the response to the MigrateSQLDatabaseToManualThroughput request. The method always
  3302  // closes the http.Response Body.
  3303  func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  3304  	err = autorest.Respond(
  3305  		resp,
  3306  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3307  		autorest.ByUnmarshallingJSON(&result),
  3308  		autorest.ByClosing())
  3309  	result.Response = autorest.Response{Response: resp}
  3310  	return
  3311  }
  3312  
  3313  // RetrieveContinuousBackupInformation retrieves continuous backup information for a container resource.
  3314  // Parameters:
  3315  // resourceGroupName - the name of the resource group. The name is case insensitive.
  3316  // accountName - cosmos DB database account name.
  3317  // databaseName - cosmos DB database name.
  3318  // containerName - cosmos DB container name.
  3319  // location - the name of the continuous backup restore location.
  3320  func (client SQLResourcesClient) RetrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, location ContinuousBackupRestoreLocation) (result SQLResourcesRetrieveContinuousBackupInformationFuture, err error) {
  3321  	if tracing.IsEnabled() {
  3322  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.RetrieveContinuousBackupInformation")
  3323  		defer func() {
  3324  			sc := -1
  3325  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3326  				sc = result.FutureAPI.Response().StatusCode
  3327  			}
  3328  			tracing.EndSpan(ctx, sc, err)
  3329  		}()
  3330  	}
  3331  	if err := validation.Validate([]validation.Validation{
  3332  		{TargetValue: client.SubscriptionID,
  3333  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  3334  		{TargetValue: resourceGroupName,
  3335  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3336  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3337  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3338  		{TargetValue: accountName,
  3339  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  3340  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  3341  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  3342  		return result, validation.NewError("documentdb.SQLResourcesClient", "RetrieveContinuousBackupInformation", err.Error())
  3343  	}
  3344  
  3345  	req, err := client.RetrieveContinuousBackupInformationPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, location)
  3346  	if err != nil {
  3347  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "RetrieveContinuousBackupInformation", nil, "Failure preparing request")
  3348  		return
  3349  	}
  3350  
  3351  	result, err = client.RetrieveContinuousBackupInformationSender(req)
  3352  	if err != nil {
  3353  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "RetrieveContinuousBackupInformation", result.Response(), "Failure sending request")
  3354  		return
  3355  	}
  3356  
  3357  	return
  3358  }
  3359  
  3360  // RetrieveContinuousBackupInformationPreparer prepares the RetrieveContinuousBackupInformation request.
  3361  func (client SQLResourcesClient) RetrieveContinuousBackupInformationPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, location ContinuousBackupRestoreLocation) (*http.Request, error) {
  3362  	pathParameters := map[string]interface{}{
  3363  		"accountName":       autorest.Encode("path", accountName),
  3364  		"containerName":     autorest.Encode("path", containerName),
  3365  		"databaseName":      autorest.Encode("path", databaseName),
  3366  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3367  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3368  	}
  3369  
  3370  	const APIVersion = "2021-04-01-preview"
  3371  	queryParameters := map[string]interface{}{
  3372  		"api-version": APIVersion,
  3373  	}
  3374  
  3375  	preparer := autorest.CreatePreparer(
  3376  		autorest.AsContentType("application/json; charset=utf-8"),
  3377  		autorest.AsPost(),
  3378  		autorest.WithBaseURL(client.BaseURI),
  3379  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation", pathParameters),
  3380  		autorest.WithJSON(location),
  3381  		autorest.WithQueryParameters(queryParameters))
  3382  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3383  }
  3384  
  3385  // RetrieveContinuousBackupInformationSender sends the RetrieveContinuousBackupInformation request. The method will close the
  3386  // http.Response Body if it receives an error.
  3387  func (client SQLResourcesClient) RetrieveContinuousBackupInformationSender(req *http.Request) (future SQLResourcesRetrieveContinuousBackupInformationFuture, err error) {
  3388  	var resp *http.Response
  3389  	future.FutureAPI = &azure.Future{}
  3390  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3391  	if err != nil {
  3392  		return
  3393  	}
  3394  	var azf azure.Future
  3395  	azf, err = azure.NewFutureFromResponse(resp)
  3396  	future.FutureAPI = &azf
  3397  	future.Result = future.result
  3398  	return
  3399  }
  3400  
  3401  // RetrieveContinuousBackupInformationResponder handles the response to the RetrieveContinuousBackupInformation request. The method always
  3402  // closes the http.Response Body.
  3403  func (client SQLResourcesClient) RetrieveContinuousBackupInformationResponder(resp *http.Response) (result BackupInformation, err error) {
  3404  	err = autorest.Respond(
  3405  		resp,
  3406  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3407  		autorest.ByUnmarshallingJSON(&result),
  3408  		autorest.ByClosing())
  3409  	result.Response = autorest.Response{Response: resp}
  3410  	return
  3411  }
  3412  
  3413  // UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container
  3414  // Parameters:
  3415  // resourceGroupName - the name of the resource group. The name is case insensitive.
  3416  // accountName - cosmos DB database account name.
  3417  // databaseName - cosmos DB database name.
  3418  // containerName - cosmos DB container name.
  3419  // updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container.
  3420  func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) {
  3421  	if tracing.IsEnabled() {
  3422  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput")
  3423  		defer func() {
  3424  			sc := -1
  3425  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3426  				sc = result.FutureAPI.Response().StatusCode
  3427  			}
  3428  			tracing.EndSpan(ctx, sc, err)
  3429  		}()
  3430  	}
  3431  	if err := validation.Validate([]validation.Validation{
  3432  		{TargetValue: client.SubscriptionID,
  3433  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  3434  		{TargetValue: resourceGroupName,
  3435  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3436  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3437  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3438  		{TargetValue: accountName,
  3439  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  3440  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  3441  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
  3442  		{TargetValue: updateThroughputParameters,
  3443  			Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
  3444  				Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
  3445  					Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
  3446  						Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
  3447  					}},
  3448  				}}}}}); err != nil {
  3449  		return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error())
  3450  	}
  3451  
  3452  	req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters)
  3453  	if err != nil {
  3454  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request")
  3455  		return
  3456  	}
  3457  
  3458  	result, err = client.UpdateSQLContainerThroughputSender(req)
  3459  	if err != nil {
  3460  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request")
  3461  		return
  3462  	}
  3463  
  3464  	return
  3465  }
  3466  
  3467  // UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request.
  3468  func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
  3469  	pathParameters := map[string]interface{}{
  3470  		"accountName":       autorest.Encode("path", accountName),
  3471  		"containerName":     autorest.Encode("path", containerName),
  3472  		"databaseName":      autorest.Encode("path", databaseName),
  3473  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3474  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3475  	}
  3476  
  3477  	const APIVersion = "2021-04-01-preview"
  3478  	queryParameters := map[string]interface{}{
  3479  		"api-version": APIVersion,
  3480  	}
  3481  
  3482  	preparer := autorest.CreatePreparer(
  3483  		autorest.AsContentType("application/json; charset=utf-8"),
  3484  		autorest.AsPut(),
  3485  		autorest.WithBaseURL(client.BaseURI),
  3486  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters),
  3487  		autorest.WithJSON(updateThroughputParameters),
  3488  		autorest.WithQueryParameters(queryParameters))
  3489  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3490  }
  3491  
  3492  // UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the
  3493  // http.Response Body if it receives an error.
  3494  func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, err error) {
  3495  	var resp *http.Response
  3496  	future.FutureAPI = &azure.Future{}
  3497  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3498  	if err != nil {
  3499  		return
  3500  	}
  3501  	var azf azure.Future
  3502  	azf, err = azure.NewFutureFromResponse(resp)
  3503  	future.FutureAPI = &azf
  3504  	future.Result = future.result
  3505  	return
  3506  }
  3507  
  3508  // UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always
  3509  // closes the http.Response Body.
  3510  func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  3511  	err = autorest.Respond(
  3512  		resp,
  3513  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3514  		autorest.ByUnmarshallingJSON(&result),
  3515  		autorest.ByClosing())
  3516  	result.Response = autorest.Response{Response: resp}
  3517  	return
  3518  }
  3519  
  3520  // UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database
  3521  // Parameters:
  3522  // resourceGroupName - the name of the resource group. The name is case insensitive.
  3523  // accountName - cosmos DB database account name.
  3524  // databaseName - cosmos DB database name.
  3525  // updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database.
  3526  func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) {
  3527  	if tracing.IsEnabled() {
  3528  		ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput")
  3529  		defer func() {
  3530  			sc := -1
  3531  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  3532  				sc = result.FutureAPI.Response().StatusCode
  3533  			}
  3534  			tracing.EndSpan(ctx, sc, err)
  3535  		}()
  3536  	}
  3537  	if err := validation.Validate([]validation.Validation{
  3538  		{TargetValue: client.SubscriptionID,
  3539  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  3540  		{TargetValue: resourceGroupName,
  3541  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  3542  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
  3543  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
  3544  		{TargetValue: accountName,
  3545  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  3546  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  3547  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
  3548  		{TargetValue: updateThroughputParameters,
  3549  			Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
  3550  				Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
  3551  					Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
  3552  						Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
  3553  					}},
  3554  				}}}}}); err != nil {
  3555  		return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error())
  3556  	}
  3557  
  3558  	req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters)
  3559  	if err != nil {
  3560  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request")
  3561  		return
  3562  	}
  3563  
  3564  	result, err = client.UpdateSQLDatabaseThroughputSender(req)
  3565  	if err != nil {
  3566  		err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request")
  3567  		return
  3568  	}
  3569  
  3570  	return
  3571  }
  3572  
  3573  // UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request.
  3574  func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
  3575  	pathParameters := map[string]interface{}{
  3576  		"accountName":       autorest.Encode("path", accountName),
  3577  		"databaseName":      autorest.Encode("path", databaseName),
  3578  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  3579  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  3580  	}
  3581  
  3582  	const APIVersion = "2021-04-01-preview"
  3583  	queryParameters := map[string]interface{}{
  3584  		"api-version": APIVersion,
  3585  	}
  3586  
  3587  	preparer := autorest.CreatePreparer(
  3588  		autorest.AsContentType("application/json; charset=utf-8"),
  3589  		autorest.AsPut(),
  3590  		autorest.WithBaseURL(client.BaseURI),
  3591  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters),
  3592  		autorest.WithJSON(updateThroughputParameters),
  3593  		autorest.WithQueryParameters(queryParameters))
  3594  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3595  }
  3596  
  3597  // UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the
  3598  // http.Response Body if it receives an error.
  3599  func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) {
  3600  	var resp *http.Response
  3601  	future.FutureAPI = &azure.Future{}
  3602  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  3603  	if err != nil {
  3604  		return
  3605  	}
  3606  	var azf azure.Future
  3607  	azf, err = azure.NewFutureFromResponse(resp)
  3608  	future.FutureAPI = &azf
  3609  	future.Result = future.result
  3610  	return
  3611  }
  3612  
  3613  // UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always
  3614  // closes the http.Response Body.
  3615  func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  3616  	err = autorest.Respond(
  3617  		resp,
  3618  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  3619  		autorest.ByUnmarshallingJSON(&result),
  3620  		autorest.ByClosing())
  3621  	result.Response = autorest.Response{Response: resp}
  3622  	return
  3623  }
  3624  

View as plain text