...

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

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

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

View as plain text