...

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

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

View as plain text