...

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

Documentation: github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-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  // CassandraResourcesClient is the client for the CassandraResources methods of the Documentdb service.
    19  type CassandraResourcesClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client.
    24  func NewCassandraResourcesClient(subscriptionID string) CassandraResourcesClient {
    25  	return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient client using a custom
    29  // endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
    30  // stack).
    31  func NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string) CassandraResourcesClient {
    32  	return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace
    36  // Parameters:
    37  // resourceGroupName - the name of the resource group. The name is case insensitive.
    38  // accountName - cosmos DB database account name.
    39  // keyspaceName - cosmos DB keyspace name.
    40  // createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace.
    41  func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) {
    42  	if tracing.IsEnabled() {
    43  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace")
    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: createUpdateCassandraKeyspaceParameters,
    63  			Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true,
    64  				Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
    65  					Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
    66  				}}}}}); err != nil {
    67  		return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error())
    68  	}
    69  
    70  	req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters)
    71  	if err != nil {
    72  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request")
    73  		return
    74  	}
    75  
    76  	result, err = client.CreateUpdateCassandraKeyspaceSender(req)
    77  	if err != nil {
    78  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request")
    79  		return
    80  	}
    81  
    82  	return
    83  }
    84  
    85  // CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request.
    86  func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) {
    87  	pathParameters := map[string]interface{}{
    88  		"accountName":       autorest.Encode("path", accountName),
    89  		"keyspaceName":      autorest.Encode("path", keyspaceName),
    90  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
    91  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    92  	}
    93  
    94  	const APIVersion = "2021-10-15"
    95  	queryParameters := map[string]interface{}{
    96  		"api-version": APIVersion,
    97  	}
    98  
    99  	preparer := autorest.CreatePreparer(
   100  		autorest.AsContentType("application/json; charset=utf-8"),
   101  		autorest.AsPut(),
   102  		autorest.WithBaseURL(client.BaseURI),
   103  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters),
   104  		autorest.WithJSON(createUpdateCassandraKeyspaceParameters),
   105  		autorest.WithQueryParameters(queryParameters))
   106  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   107  }
   108  
   109  // CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the
   110  // http.Response Body if it receives an error.
   111  func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) {
   112  	var resp *http.Response
   113  	future.FutureAPI = &azure.Future{}
   114  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   115  	if err != nil {
   116  		return
   117  	}
   118  	var azf azure.Future
   119  	azf, err = azure.NewFutureFromResponse(resp)
   120  	future.FutureAPI = &azf
   121  	future.Result = future.result
   122  	return
   123  }
   124  
   125  // CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always
   126  // closes the http.Response Body.
   127  func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) {
   128  	err = autorest.Respond(
   129  		resp,
   130  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   131  		autorest.ByUnmarshallingJSON(&result),
   132  		autorest.ByClosing())
   133  	result.Response = autorest.Response{Response: resp}
   134  	return
   135  }
   136  
   137  // CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table
   138  // Parameters:
   139  // resourceGroupName - the name of the resource group. The name is case insensitive.
   140  // accountName - cosmos DB database account name.
   141  // keyspaceName - cosmos DB keyspace name.
   142  // tableName - cosmos DB table name.
   143  // createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table.
   144  func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) {
   145  	if tracing.IsEnabled() {
   146  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable")
   147  		defer func() {
   148  			sc := -1
   149  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   150  				sc = result.FutureAPI.Response().StatusCode
   151  			}
   152  			tracing.EndSpan(ctx, sc, err)
   153  		}()
   154  	}
   155  	if err := validation.Validate([]validation.Validation{
   156  		{TargetValue: client.SubscriptionID,
   157  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   158  		{TargetValue: resourceGroupName,
   159  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   160  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   161  		{TargetValue: accountName,
   162  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   163  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   164  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
   165  		{TargetValue: createUpdateCassandraTableParameters,
   166  			Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true,
   167  				Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
   168  					Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
   169  				}}}}}); err != nil {
   170  		return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error())
   171  	}
   172  
   173  	req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters)
   174  	if err != nil {
   175  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request")
   176  		return
   177  	}
   178  
   179  	result, err = client.CreateUpdateCassandraTableSender(req)
   180  	if err != nil {
   181  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request")
   182  		return
   183  	}
   184  
   185  	return
   186  }
   187  
   188  // CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request.
   189  func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) {
   190  	pathParameters := map[string]interface{}{
   191  		"accountName":       autorest.Encode("path", accountName),
   192  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   193  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   194  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   195  		"tableName":         autorest.Encode("path", tableName),
   196  	}
   197  
   198  	const APIVersion = "2021-10-15"
   199  	queryParameters := map[string]interface{}{
   200  		"api-version": APIVersion,
   201  	}
   202  
   203  	preparer := autorest.CreatePreparer(
   204  		autorest.AsContentType("application/json; charset=utf-8"),
   205  		autorest.AsPut(),
   206  		autorest.WithBaseURL(client.BaseURI),
   207  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters),
   208  		autorest.WithJSON(createUpdateCassandraTableParameters),
   209  		autorest.WithQueryParameters(queryParameters))
   210  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   211  }
   212  
   213  // CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the
   214  // http.Response Body if it receives an error.
   215  func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, err error) {
   216  	var resp *http.Response
   217  	future.FutureAPI = &azure.Future{}
   218  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   219  	if err != nil {
   220  		return
   221  	}
   222  	var azf azure.Future
   223  	azf, err = azure.NewFutureFromResponse(resp)
   224  	future.FutureAPI = &azf
   225  	future.Result = future.result
   226  	return
   227  }
   228  
   229  // CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always
   230  // closes the http.Response Body.
   231  func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) {
   232  	err = autorest.Respond(
   233  		resp,
   234  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   235  		autorest.ByUnmarshallingJSON(&result),
   236  		autorest.ByClosing())
   237  	result.Response = autorest.Response{Response: resp}
   238  	return
   239  }
   240  
   241  // DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace.
   242  // Parameters:
   243  // resourceGroupName - the name of the resource group. The name is case insensitive.
   244  // accountName - cosmos DB database account name.
   245  // keyspaceName - cosmos DB keyspace name.
   246  func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) {
   247  	if tracing.IsEnabled() {
   248  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace")
   249  		defer func() {
   250  			sc := -1
   251  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   252  				sc = result.FutureAPI.Response().StatusCode
   253  			}
   254  			tracing.EndSpan(ctx, sc, err)
   255  		}()
   256  	}
   257  	if err := validation.Validate([]validation.Validation{
   258  		{TargetValue: client.SubscriptionID,
   259  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   260  		{TargetValue: resourceGroupName,
   261  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   262  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   263  		{TargetValue: accountName,
   264  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   265  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   266  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   267  		return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error())
   268  	}
   269  
   270  	req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName)
   271  	if err != nil {
   272  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request")
   273  		return
   274  	}
   275  
   276  	result, err = client.DeleteCassandraKeyspaceSender(req)
   277  	if err != nil {
   278  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request")
   279  		return
   280  	}
   281  
   282  	return
   283  }
   284  
   285  // DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request.
   286  func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) {
   287  	pathParameters := map[string]interface{}{
   288  		"accountName":       autorest.Encode("path", accountName),
   289  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   290  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   291  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   292  	}
   293  
   294  	const APIVersion = "2021-10-15"
   295  	queryParameters := map[string]interface{}{
   296  		"api-version": APIVersion,
   297  	}
   298  
   299  	preparer := autorest.CreatePreparer(
   300  		autorest.AsDelete(),
   301  		autorest.WithBaseURL(client.BaseURI),
   302  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters),
   303  		autorest.WithQueryParameters(queryParameters))
   304  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   305  }
   306  
   307  // DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the
   308  // http.Response Body if it receives an error.
   309  func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, err error) {
   310  	var resp *http.Response
   311  	future.FutureAPI = &azure.Future{}
   312  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   313  	if err != nil {
   314  		return
   315  	}
   316  	var azf azure.Future
   317  	azf, err = azure.NewFutureFromResponse(resp)
   318  	future.FutureAPI = &azf
   319  	future.Result = future.result
   320  	return
   321  }
   322  
   323  // DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always
   324  // closes the http.Response Body.
   325  func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(resp *http.Response) (result autorest.Response, err error) {
   326  	err = autorest.Respond(
   327  		resp,
   328  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   329  		autorest.ByClosing())
   330  	result.Response = resp
   331  	return
   332  }
   333  
   334  // DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table.
   335  // Parameters:
   336  // resourceGroupName - the name of the resource group. The name is case insensitive.
   337  // accountName - cosmos DB database account name.
   338  // keyspaceName - cosmos DB keyspace name.
   339  // tableName - cosmos DB table name.
   340  func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) {
   341  	if tracing.IsEnabled() {
   342  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable")
   343  		defer func() {
   344  			sc := -1
   345  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   346  				sc = result.FutureAPI.Response().StatusCode
   347  			}
   348  			tracing.EndSpan(ctx, sc, err)
   349  		}()
   350  	}
   351  	if err := validation.Validate([]validation.Validation{
   352  		{TargetValue: client.SubscriptionID,
   353  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   354  		{TargetValue: resourceGroupName,
   355  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   356  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   357  		{TargetValue: accountName,
   358  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   359  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   360  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   361  		return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error())
   362  	}
   363  
   364  	req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName)
   365  	if err != nil {
   366  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request")
   367  		return
   368  	}
   369  
   370  	result, err = client.DeleteCassandraTableSender(req)
   371  	if err != nil {
   372  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request")
   373  		return
   374  	}
   375  
   376  	return
   377  }
   378  
   379  // DeleteCassandraTablePreparer prepares the DeleteCassandraTable request.
   380  func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) {
   381  	pathParameters := map[string]interface{}{
   382  		"accountName":       autorest.Encode("path", accountName),
   383  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   384  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   385  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   386  		"tableName":         autorest.Encode("path", tableName),
   387  	}
   388  
   389  	const APIVersion = "2021-10-15"
   390  	queryParameters := map[string]interface{}{
   391  		"api-version": APIVersion,
   392  	}
   393  
   394  	preparer := autorest.CreatePreparer(
   395  		autorest.AsDelete(),
   396  		autorest.WithBaseURL(client.BaseURI),
   397  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters),
   398  		autorest.WithQueryParameters(queryParameters))
   399  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   400  }
   401  
   402  // DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the
   403  // http.Response Body if it receives an error.
   404  func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, err error) {
   405  	var resp *http.Response
   406  	future.FutureAPI = &azure.Future{}
   407  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   408  	if err != nil {
   409  		return
   410  	}
   411  	var azf azure.Future
   412  	azf, err = azure.NewFutureFromResponse(resp)
   413  	future.FutureAPI = &azf
   414  	future.Result = future.result
   415  	return
   416  }
   417  
   418  // DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always
   419  // closes the http.Response Body.
   420  func (client CassandraResourcesClient) DeleteCassandraTableResponder(resp *http.Response) (result autorest.Response, err error) {
   421  	err = autorest.Respond(
   422  		resp,
   423  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   424  		autorest.ByClosing())
   425  	result.Response = resp
   426  	return
   427  }
   428  
   429  // GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the
   430  // provided name.
   431  // Parameters:
   432  // resourceGroupName - the name of the resource group. The name is case insensitive.
   433  // accountName - cosmos DB database account name.
   434  // keyspaceName - cosmos DB keyspace name.
   435  func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) {
   436  	if tracing.IsEnabled() {
   437  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace")
   438  		defer func() {
   439  			sc := -1
   440  			if result.Response.Response != nil {
   441  				sc = result.Response.Response.StatusCode
   442  			}
   443  			tracing.EndSpan(ctx, sc, err)
   444  		}()
   445  	}
   446  	if err := validation.Validate([]validation.Validation{
   447  		{TargetValue: client.SubscriptionID,
   448  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   449  		{TargetValue: resourceGroupName,
   450  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   451  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   452  		{TargetValue: accountName,
   453  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   454  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   455  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   456  		return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error())
   457  	}
   458  
   459  	req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName)
   460  	if err != nil {
   461  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request")
   462  		return
   463  	}
   464  
   465  	resp, err := client.GetCassandraKeyspaceSender(req)
   466  	if err != nil {
   467  		result.Response = autorest.Response{Response: resp}
   468  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request")
   469  		return
   470  	}
   471  
   472  	result, err = client.GetCassandraKeyspaceResponder(resp)
   473  	if err != nil {
   474  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request")
   475  		return
   476  	}
   477  
   478  	return
   479  }
   480  
   481  // GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request.
   482  func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) {
   483  	pathParameters := map[string]interface{}{
   484  		"accountName":       autorest.Encode("path", accountName),
   485  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   486  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   487  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   488  	}
   489  
   490  	const APIVersion = "2021-10-15"
   491  	queryParameters := map[string]interface{}{
   492  		"api-version": APIVersion,
   493  	}
   494  
   495  	preparer := autorest.CreatePreparer(
   496  		autorest.AsGet(),
   497  		autorest.WithBaseURL(client.BaseURI),
   498  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters),
   499  		autorest.WithQueryParameters(queryParameters))
   500  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   501  }
   502  
   503  // GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the
   504  // http.Response Body if it receives an error.
   505  func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) {
   506  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   507  }
   508  
   509  // GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always
   510  // closes the http.Response Body.
   511  func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) {
   512  	err = autorest.Respond(
   513  		resp,
   514  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   515  		autorest.ByUnmarshallingJSON(&result),
   516  		autorest.ByClosing())
   517  	result.Response = autorest.Response{Response: resp}
   518  	return
   519  }
   520  
   521  // GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB
   522  // database account with the provided name.
   523  // Parameters:
   524  // resourceGroupName - the name of the resource group. The name is case insensitive.
   525  // accountName - cosmos DB database account name.
   526  // keyspaceName - cosmos DB keyspace name.
   527  func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) {
   528  	if tracing.IsEnabled() {
   529  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput")
   530  		defer func() {
   531  			sc := -1
   532  			if result.Response.Response != nil {
   533  				sc = result.Response.Response.StatusCode
   534  			}
   535  			tracing.EndSpan(ctx, sc, err)
   536  		}()
   537  	}
   538  	if err := validation.Validate([]validation.Validation{
   539  		{TargetValue: client.SubscriptionID,
   540  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   541  		{TargetValue: resourceGroupName,
   542  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   543  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   544  		{TargetValue: accountName,
   545  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   546  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   547  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   548  		return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error())
   549  	}
   550  
   551  	req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName)
   552  	if err != nil {
   553  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request")
   554  		return
   555  	}
   556  
   557  	resp, err := client.GetCassandraKeyspaceThroughputSender(req)
   558  	if err != nil {
   559  		result.Response = autorest.Response{Response: resp}
   560  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request")
   561  		return
   562  	}
   563  
   564  	result, err = client.GetCassandraKeyspaceThroughputResponder(resp)
   565  	if err != nil {
   566  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request")
   567  		return
   568  	}
   569  
   570  	return
   571  }
   572  
   573  // GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request.
   574  func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) {
   575  	pathParameters := map[string]interface{}{
   576  		"accountName":       autorest.Encode("path", accountName),
   577  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   578  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   579  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   580  	}
   581  
   582  	const APIVersion = "2021-10-15"
   583  	queryParameters := map[string]interface{}{
   584  		"api-version": APIVersion,
   585  	}
   586  
   587  	preparer := autorest.CreatePreparer(
   588  		autorest.AsGet(),
   589  		autorest.WithBaseURL(client.BaseURI),
   590  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters),
   591  		autorest.WithQueryParameters(queryParameters))
   592  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   593  }
   594  
   595  // GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the
   596  // http.Response Body if it receives an error.
   597  func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) {
   598  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   599  }
   600  
   601  // GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always
   602  // closes the http.Response Body.
   603  func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
   604  	err = autorest.Respond(
   605  		resp,
   606  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   607  		autorest.ByUnmarshallingJSON(&result),
   608  		autorest.ByClosing())
   609  	result.Response = autorest.Response{Response: resp}
   610  	return
   611  }
   612  
   613  // GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account.
   614  // Parameters:
   615  // resourceGroupName - the name of the resource group. The name is case insensitive.
   616  // accountName - cosmos DB database account name.
   617  // keyspaceName - cosmos DB keyspace name.
   618  // tableName - cosmos DB table name.
   619  func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) {
   620  	if tracing.IsEnabled() {
   621  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable")
   622  		defer func() {
   623  			sc := -1
   624  			if result.Response.Response != nil {
   625  				sc = result.Response.Response.StatusCode
   626  			}
   627  			tracing.EndSpan(ctx, sc, err)
   628  		}()
   629  	}
   630  	if err := validation.Validate([]validation.Validation{
   631  		{TargetValue: client.SubscriptionID,
   632  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   633  		{TargetValue: resourceGroupName,
   634  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   635  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   636  		{TargetValue: accountName,
   637  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   638  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   639  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   640  		return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error())
   641  	}
   642  
   643  	req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName)
   644  	if err != nil {
   645  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request")
   646  		return
   647  	}
   648  
   649  	resp, err := client.GetCassandraTableSender(req)
   650  	if err != nil {
   651  		result.Response = autorest.Response{Response: resp}
   652  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request")
   653  		return
   654  	}
   655  
   656  	result, err = client.GetCassandraTableResponder(resp)
   657  	if err != nil {
   658  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request")
   659  		return
   660  	}
   661  
   662  	return
   663  }
   664  
   665  // GetCassandraTablePreparer prepares the GetCassandraTable request.
   666  func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) {
   667  	pathParameters := map[string]interface{}{
   668  		"accountName":       autorest.Encode("path", accountName),
   669  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   670  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   671  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   672  		"tableName":         autorest.Encode("path", tableName),
   673  	}
   674  
   675  	const APIVersion = "2021-10-15"
   676  	queryParameters := map[string]interface{}{
   677  		"api-version": APIVersion,
   678  	}
   679  
   680  	preparer := autorest.CreatePreparer(
   681  		autorest.AsGet(),
   682  		autorest.WithBaseURL(client.BaseURI),
   683  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters),
   684  		autorest.WithQueryParameters(queryParameters))
   685  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   686  }
   687  
   688  // GetCassandraTableSender sends the GetCassandraTable request. The method will close the
   689  // http.Response Body if it receives an error.
   690  func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) {
   691  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   692  }
   693  
   694  // GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always
   695  // closes the http.Response Body.
   696  func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) {
   697  	err = autorest.Respond(
   698  		resp,
   699  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   700  		autorest.ByUnmarshallingJSON(&result),
   701  		autorest.ByClosing())
   702  	result.Response = autorest.Response{Response: resp}
   703  	return
   704  }
   705  
   706  // GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB
   707  // database account with the provided name.
   708  // Parameters:
   709  // resourceGroupName - the name of the resource group. The name is case insensitive.
   710  // accountName - cosmos DB database account name.
   711  // keyspaceName - cosmos DB keyspace name.
   712  // tableName - cosmos DB table name.
   713  func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) {
   714  	if tracing.IsEnabled() {
   715  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput")
   716  		defer func() {
   717  			sc := -1
   718  			if result.Response.Response != nil {
   719  				sc = result.Response.Response.StatusCode
   720  			}
   721  			tracing.EndSpan(ctx, sc, err)
   722  		}()
   723  	}
   724  	if err := validation.Validate([]validation.Validation{
   725  		{TargetValue: client.SubscriptionID,
   726  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   727  		{TargetValue: resourceGroupName,
   728  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   729  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   730  		{TargetValue: accountName,
   731  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   732  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   733  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   734  		return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error())
   735  	}
   736  
   737  	req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName)
   738  	if err != nil {
   739  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request")
   740  		return
   741  	}
   742  
   743  	resp, err := client.GetCassandraTableThroughputSender(req)
   744  	if err != nil {
   745  		result.Response = autorest.Response{Response: resp}
   746  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request")
   747  		return
   748  	}
   749  
   750  	result, err = client.GetCassandraTableThroughputResponder(resp)
   751  	if err != nil {
   752  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request")
   753  		return
   754  	}
   755  
   756  	return
   757  }
   758  
   759  // GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request.
   760  func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) {
   761  	pathParameters := map[string]interface{}{
   762  		"accountName":       autorest.Encode("path", accountName),
   763  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   764  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   765  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   766  		"tableName":         autorest.Encode("path", tableName),
   767  	}
   768  
   769  	const APIVersion = "2021-10-15"
   770  	queryParameters := map[string]interface{}{
   771  		"api-version": APIVersion,
   772  	}
   773  
   774  	preparer := autorest.CreatePreparer(
   775  		autorest.AsGet(),
   776  		autorest.WithBaseURL(client.BaseURI),
   777  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters),
   778  		autorest.WithQueryParameters(queryParameters))
   779  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   780  }
   781  
   782  // GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the
   783  // http.Response Body if it receives an error.
   784  func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) {
   785  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   786  }
   787  
   788  // GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always
   789  // closes the http.Response Body.
   790  func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
   791  	err = autorest.Respond(
   792  		resp,
   793  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   794  		autorest.ByUnmarshallingJSON(&result),
   795  		autorest.ByClosing())
   796  	result.Response = autorest.Response{Response: resp}
   797  	return
   798  }
   799  
   800  // ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account.
   801  // Parameters:
   802  // resourceGroupName - the name of the resource group. The name is case insensitive.
   803  // accountName - cosmos DB database account name.
   804  func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) {
   805  	if tracing.IsEnabled() {
   806  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces")
   807  		defer func() {
   808  			sc := -1
   809  			if result.Response.Response != nil {
   810  				sc = result.Response.Response.StatusCode
   811  			}
   812  			tracing.EndSpan(ctx, sc, err)
   813  		}()
   814  	}
   815  	if err := validation.Validate([]validation.Validation{
   816  		{TargetValue: client.SubscriptionID,
   817  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   818  		{TargetValue: resourceGroupName,
   819  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   820  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   821  		{TargetValue: accountName,
   822  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   823  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   824  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   825  		return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error())
   826  	}
   827  
   828  	req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName)
   829  	if err != nil {
   830  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request")
   831  		return
   832  	}
   833  
   834  	resp, err := client.ListCassandraKeyspacesSender(req)
   835  	if err != nil {
   836  		result.Response = autorest.Response{Response: resp}
   837  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request")
   838  		return
   839  	}
   840  
   841  	result, err = client.ListCassandraKeyspacesResponder(resp)
   842  	if err != nil {
   843  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request")
   844  		return
   845  	}
   846  
   847  	return
   848  }
   849  
   850  // ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request.
   851  func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
   852  	pathParameters := map[string]interface{}{
   853  		"accountName":       autorest.Encode("path", accountName),
   854  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   855  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   856  	}
   857  
   858  	const APIVersion = "2021-10-15"
   859  	queryParameters := map[string]interface{}{
   860  		"api-version": APIVersion,
   861  	}
   862  
   863  	preparer := autorest.CreatePreparer(
   864  		autorest.AsGet(),
   865  		autorest.WithBaseURL(client.BaseURI),
   866  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters),
   867  		autorest.WithQueryParameters(queryParameters))
   868  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   869  }
   870  
   871  // ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the
   872  // http.Response Body if it receives an error.
   873  func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) {
   874  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   875  }
   876  
   877  // ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always
   878  // closes the http.Response Body.
   879  func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) {
   880  	err = autorest.Respond(
   881  		resp,
   882  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   883  		autorest.ByUnmarshallingJSON(&result),
   884  		autorest.ByClosing())
   885  	result.Response = autorest.Response{Response: resp}
   886  	return
   887  }
   888  
   889  // ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account.
   890  // Parameters:
   891  // resourceGroupName - the name of the resource group. The name is case insensitive.
   892  // accountName - cosmos DB database account name.
   893  // keyspaceName - cosmos DB keyspace name.
   894  func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) {
   895  	if tracing.IsEnabled() {
   896  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables")
   897  		defer func() {
   898  			sc := -1
   899  			if result.Response.Response != nil {
   900  				sc = result.Response.Response.StatusCode
   901  			}
   902  			tracing.EndSpan(ctx, sc, err)
   903  		}()
   904  	}
   905  	if err := validation.Validate([]validation.Validation{
   906  		{TargetValue: client.SubscriptionID,
   907  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   908  		{TargetValue: resourceGroupName,
   909  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   910  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   911  		{TargetValue: accountName,
   912  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   913  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
   914  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
   915  		return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error())
   916  	}
   917  
   918  	req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName)
   919  	if err != nil {
   920  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request")
   921  		return
   922  	}
   923  
   924  	resp, err := client.ListCassandraTablesSender(req)
   925  	if err != nil {
   926  		result.Response = autorest.Response{Response: resp}
   927  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request")
   928  		return
   929  	}
   930  
   931  	result, err = client.ListCassandraTablesResponder(resp)
   932  	if err != nil {
   933  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request")
   934  		return
   935  	}
   936  
   937  	return
   938  }
   939  
   940  // ListCassandraTablesPreparer prepares the ListCassandraTables request.
   941  func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) {
   942  	pathParameters := map[string]interface{}{
   943  		"accountName":       autorest.Encode("path", accountName),
   944  		"keyspaceName":      autorest.Encode("path", keyspaceName),
   945  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   946  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   947  	}
   948  
   949  	const APIVersion = "2021-10-15"
   950  	queryParameters := map[string]interface{}{
   951  		"api-version": APIVersion,
   952  	}
   953  
   954  	preparer := autorest.CreatePreparer(
   955  		autorest.AsGet(),
   956  		autorest.WithBaseURL(client.BaseURI),
   957  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters),
   958  		autorest.WithQueryParameters(queryParameters))
   959  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   960  }
   961  
   962  // ListCassandraTablesSender sends the ListCassandraTables request. The method will close the
   963  // http.Response Body if it receives an error.
   964  func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) {
   965  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   966  }
   967  
   968  // ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always
   969  // closes the http.Response Body.
   970  func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) {
   971  	err = autorest.Respond(
   972  		resp,
   973  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   974  		autorest.ByUnmarshallingJSON(&result),
   975  		autorest.ByClosing())
   976  	result.Response = autorest.Response{Response: resp}
   977  	return
   978  }
   979  
   980  // MigrateCassandraKeyspaceToAutoscale migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to
   981  // autoscale
   982  // Parameters:
   983  // resourceGroupName - the name of the resource group. The name is case insensitive.
   984  // accountName - cosmos DB database account name.
   985  // keyspaceName - cosmos DB keyspace name.
   986  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) {
   987  	if tracing.IsEnabled() {
   988  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToAutoscale")
   989  		defer func() {
   990  			sc := -1
   991  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   992  				sc = result.FutureAPI.Response().StatusCode
   993  			}
   994  			tracing.EndSpan(ctx, sc, err)
   995  		}()
   996  	}
   997  	if err := validation.Validate([]validation.Validation{
   998  		{TargetValue: client.SubscriptionID,
   999  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1000  		{TargetValue: resourceGroupName,
  1001  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1002  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1003  		{TargetValue: accountName,
  1004  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1005  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1006  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1007  		return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", err.Error())
  1008  	}
  1009  
  1010  	req, err := client.MigrateCassandraKeyspaceToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName)
  1011  	if err != nil {
  1012  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", nil, "Failure preparing request")
  1013  		return
  1014  	}
  1015  
  1016  	result, err = client.MigrateCassandraKeyspaceToAutoscaleSender(req)
  1017  	if err != nil {
  1018  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", result.Response(), "Failure sending request")
  1019  		return
  1020  	}
  1021  
  1022  	return
  1023  }
  1024  
  1025  // MigrateCassandraKeyspaceToAutoscalePreparer prepares the MigrateCassandraKeyspaceToAutoscale request.
  1026  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) {
  1027  	pathParameters := map[string]interface{}{
  1028  		"accountName":       autorest.Encode("path", accountName),
  1029  		"keyspaceName":      autorest.Encode("path", keyspaceName),
  1030  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1031  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1032  	}
  1033  
  1034  	const APIVersion = "2021-10-15"
  1035  	queryParameters := map[string]interface{}{
  1036  		"api-version": APIVersion,
  1037  	}
  1038  
  1039  	preparer := autorest.CreatePreparer(
  1040  		autorest.AsPost(),
  1041  		autorest.WithBaseURL(client.BaseURI),
  1042  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale", pathParameters),
  1043  		autorest.WithQueryParameters(queryParameters))
  1044  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1045  }
  1046  
  1047  // MigrateCassandraKeyspaceToAutoscaleSender sends the MigrateCassandraKeyspaceToAutoscale request. The method will close the
  1048  // http.Response Body if it receives an error.
  1049  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) {
  1050  	var resp *http.Response
  1051  	future.FutureAPI = &azure.Future{}
  1052  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1053  	if err != nil {
  1054  		return
  1055  	}
  1056  	var azf azure.Future
  1057  	azf, err = azure.NewFutureFromResponse(resp)
  1058  	future.FutureAPI = &azf
  1059  	future.Result = future.result
  1060  	return
  1061  }
  1062  
  1063  // MigrateCassandraKeyspaceToAutoscaleResponder handles the response to the MigrateCassandraKeyspaceToAutoscale request. The method always
  1064  // closes the http.Response Body.
  1065  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1066  	err = autorest.Respond(
  1067  		resp,
  1068  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1069  		autorest.ByUnmarshallingJSON(&result),
  1070  		autorest.ByClosing())
  1071  	result.Response = autorest.Response{Response: resp}
  1072  	return
  1073  }
  1074  
  1075  // MigrateCassandraKeyspaceToManualThroughput migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual
  1076  // throughput
  1077  // Parameters:
  1078  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1079  // accountName - cosmos DB database account name.
  1080  // keyspaceName - cosmos DB keyspace name.
  1081  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) {
  1082  	if tracing.IsEnabled() {
  1083  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToManualThroughput")
  1084  		defer func() {
  1085  			sc := -1
  1086  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1087  				sc = result.FutureAPI.Response().StatusCode
  1088  			}
  1089  			tracing.EndSpan(ctx, sc, err)
  1090  		}()
  1091  	}
  1092  	if err := validation.Validate([]validation.Validation{
  1093  		{TargetValue: client.SubscriptionID,
  1094  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1095  		{TargetValue: resourceGroupName,
  1096  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1097  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1098  		{TargetValue: accountName,
  1099  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1100  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1101  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1102  		return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", err.Error())
  1103  	}
  1104  
  1105  	req, err := client.MigrateCassandraKeyspaceToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName)
  1106  	if err != nil {
  1107  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", nil, "Failure preparing request")
  1108  		return
  1109  	}
  1110  
  1111  	result, err = client.MigrateCassandraKeyspaceToManualThroughputSender(req)
  1112  	if err != nil {
  1113  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", result.Response(), "Failure sending request")
  1114  		return
  1115  	}
  1116  
  1117  	return
  1118  }
  1119  
  1120  // MigrateCassandraKeyspaceToManualThroughputPreparer prepares the MigrateCassandraKeyspaceToManualThroughput request.
  1121  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) {
  1122  	pathParameters := map[string]interface{}{
  1123  		"accountName":       autorest.Encode("path", accountName),
  1124  		"keyspaceName":      autorest.Encode("path", keyspaceName),
  1125  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1126  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1127  	}
  1128  
  1129  	const APIVersion = "2021-10-15"
  1130  	queryParameters := map[string]interface{}{
  1131  		"api-version": APIVersion,
  1132  	}
  1133  
  1134  	preparer := autorest.CreatePreparer(
  1135  		autorest.AsPost(),
  1136  		autorest.WithBaseURL(client.BaseURI),
  1137  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
  1138  		autorest.WithQueryParameters(queryParameters))
  1139  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1140  }
  1141  
  1142  // MigrateCassandraKeyspaceToManualThroughputSender sends the MigrateCassandraKeyspaceToManualThroughput request. The method will close the
  1143  // http.Response Body if it receives an error.
  1144  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) {
  1145  	var resp *http.Response
  1146  	future.FutureAPI = &azure.Future{}
  1147  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1148  	if err != nil {
  1149  		return
  1150  	}
  1151  	var azf azure.Future
  1152  	azf, err = azure.NewFutureFromResponse(resp)
  1153  	future.FutureAPI = &azf
  1154  	future.Result = future.result
  1155  	return
  1156  }
  1157  
  1158  // MigrateCassandraKeyspaceToManualThroughputResponder handles the response to the MigrateCassandraKeyspaceToManualThroughput request. The method always
  1159  // closes the http.Response Body.
  1160  func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1161  	err = autorest.Respond(
  1162  		resp,
  1163  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1164  		autorest.ByUnmarshallingJSON(&result),
  1165  		autorest.ByClosing())
  1166  	result.Response = autorest.Response{Response: resp}
  1167  	return
  1168  }
  1169  
  1170  // MigrateCassandraTableToAutoscale migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale
  1171  // Parameters:
  1172  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1173  // accountName - cosmos DB database account name.
  1174  // keyspaceName - cosmos DB keyspace name.
  1175  // tableName - cosmos DB table name.
  1176  func (client CassandraResourcesClient) MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) {
  1177  	if tracing.IsEnabled() {
  1178  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToAutoscale")
  1179  		defer func() {
  1180  			sc := -1
  1181  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1182  				sc = result.FutureAPI.Response().StatusCode
  1183  			}
  1184  			tracing.EndSpan(ctx, sc, err)
  1185  		}()
  1186  	}
  1187  	if err := validation.Validate([]validation.Validation{
  1188  		{TargetValue: client.SubscriptionID,
  1189  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1190  		{TargetValue: resourceGroupName,
  1191  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1192  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1193  		{TargetValue: accountName,
  1194  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1195  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1196  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1197  		return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", err.Error())
  1198  	}
  1199  
  1200  	req, err := client.MigrateCassandraTableToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName)
  1201  	if err != nil {
  1202  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", nil, "Failure preparing request")
  1203  		return
  1204  	}
  1205  
  1206  	result, err = client.MigrateCassandraTableToAutoscaleSender(req)
  1207  	if err != nil {
  1208  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", result.Response(), "Failure sending request")
  1209  		return
  1210  	}
  1211  
  1212  	return
  1213  }
  1214  
  1215  // MigrateCassandraTableToAutoscalePreparer prepares the MigrateCassandraTableToAutoscale request.
  1216  func (client CassandraResourcesClient) MigrateCassandraTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) {
  1217  	pathParameters := map[string]interface{}{
  1218  		"accountName":       autorest.Encode("path", accountName),
  1219  		"keyspaceName":      autorest.Encode("path", keyspaceName),
  1220  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1221  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1222  		"tableName":         autorest.Encode("path", tableName),
  1223  	}
  1224  
  1225  	const APIVersion = "2021-10-15"
  1226  	queryParameters := map[string]interface{}{
  1227  		"api-version": APIVersion,
  1228  	}
  1229  
  1230  	preparer := autorest.CreatePreparer(
  1231  		autorest.AsPost(),
  1232  		autorest.WithBaseURL(client.BaseURI),
  1233  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters),
  1234  		autorest.WithQueryParameters(queryParameters))
  1235  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1236  }
  1237  
  1238  // MigrateCassandraTableToAutoscaleSender sends the MigrateCassandraTableToAutoscale request. The method will close the
  1239  // http.Response Body if it receives an error.
  1240  func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) {
  1241  	var resp *http.Response
  1242  	future.FutureAPI = &azure.Future{}
  1243  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1244  	if err != nil {
  1245  		return
  1246  	}
  1247  	var azf azure.Future
  1248  	azf, err = azure.NewFutureFromResponse(resp)
  1249  	future.FutureAPI = &azf
  1250  	future.Result = future.result
  1251  	return
  1252  }
  1253  
  1254  // MigrateCassandraTableToAutoscaleResponder handles the response to the MigrateCassandraTableToAutoscale request. The method always
  1255  // closes the http.Response Body.
  1256  func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1257  	err = autorest.Respond(
  1258  		resp,
  1259  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1260  		autorest.ByUnmarshallingJSON(&result),
  1261  		autorest.ByClosing())
  1262  	result.Response = autorest.Response{Response: resp}
  1263  	return
  1264  }
  1265  
  1266  // MigrateCassandraTableToManualThroughput migrate an Azure Cosmos DB Cassandra table from autoscale to manual
  1267  // throughput
  1268  // Parameters:
  1269  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1270  // accountName - cosmos DB database account name.
  1271  // keyspaceName - cosmos DB keyspace name.
  1272  // tableName - cosmos DB table name.
  1273  func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) {
  1274  	if tracing.IsEnabled() {
  1275  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToManualThroughput")
  1276  		defer func() {
  1277  			sc := -1
  1278  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1279  				sc = result.FutureAPI.Response().StatusCode
  1280  			}
  1281  			tracing.EndSpan(ctx, sc, err)
  1282  		}()
  1283  	}
  1284  	if err := validation.Validate([]validation.Validation{
  1285  		{TargetValue: client.SubscriptionID,
  1286  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1287  		{TargetValue: resourceGroupName,
  1288  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1289  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1290  		{TargetValue: accountName,
  1291  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1292  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1293  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
  1294  		return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", err.Error())
  1295  	}
  1296  
  1297  	req, err := client.MigrateCassandraTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName)
  1298  	if err != nil {
  1299  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", nil, "Failure preparing request")
  1300  		return
  1301  	}
  1302  
  1303  	result, err = client.MigrateCassandraTableToManualThroughputSender(req)
  1304  	if err != nil {
  1305  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", result.Response(), "Failure sending request")
  1306  		return
  1307  	}
  1308  
  1309  	return
  1310  }
  1311  
  1312  // MigrateCassandraTableToManualThroughputPreparer prepares the MigrateCassandraTableToManualThroughput request.
  1313  func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) {
  1314  	pathParameters := map[string]interface{}{
  1315  		"accountName":       autorest.Encode("path", accountName),
  1316  		"keyspaceName":      autorest.Encode("path", keyspaceName),
  1317  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1318  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1319  		"tableName":         autorest.Encode("path", tableName),
  1320  	}
  1321  
  1322  	const APIVersion = "2021-10-15"
  1323  	queryParameters := map[string]interface{}{
  1324  		"api-version": APIVersion,
  1325  	}
  1326  
  1327  	preparer := autorest.CreatePreparer(
  1328  		autorest.AsPost(),
  1329  		autorest.WithBaseURL(client.BaseURI),
  1330  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
  1331  		autorest.WithQueryParameters(queryParameters))
  1332  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1333  }
  1334  
  1335  // MigrateCassandraTableToManualThroughputSender sends the MigrateCassandraTableToManualThroughput request. The method will close the
  1336  // http.Response Body if it receives an error.
  1337  func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) {
  1338  	var resp *http.Response
  1339  	future.FutureAPI = &azure.Future{}
  1340  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1341  	if err != nil {
  1342  		return
  1343  	}
  1344  	var azf azure.Future
  1345  	azf, err = azure.NewFutureFromResponse(resp)
  1346  	future.FutureAPI = &azf
  1347  	future.Result = future.result
  1348  	return
  1349  }
  1350  
  1351  // MigrateCassandraTableToManualThroughputResponder handles the response to the MigrateCassandraTableToManualThroughput request. The method always
  1352  // closes the http.Response Body.
  1353  func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1354  	err = autorest.Respond(
  1355  		resp,
  1356  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1357  		autorest.ByUnmarshallingJSON(&result),
  1358  		autorest.ByClosing())
  1359  	result.Response = autorest.Response{Response: resp}
  1360  	return
  1361  }
  1362  
  1363  // UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace
  1364  // Parameters:
  1365  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1366  // accountName - cosmos DB database account name.
  1367  // keyspaceName - cosmos DB keyspace name.
  1368  // updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra
  1369  // Keyspace.
  1370  func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) {
  1371  	if tracing.IsEnabled() {
  1372  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput")
  1373  		defer func() {
  1374  			sc := -1
  1375  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1376  				sc = result.FutureAPI.Response().StatusCode
  1377  			}
  1378  			tracing.EndSpan(ctx, sc, err)
  1379  		}()
  1380  	}
  1381  	if err := validation.Validate([]validation.Validation{
  1382  		{TargetValue: client.SubscriptionID,
  1383  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1384  		{TargetValue: resourceGroupName,
  1385  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1386  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1387  		{TargetValue: accountName,
  1388  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1389  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1390  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
  1391  		{TargetValue: updateThroughputParameters,
  1392  			Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
  1393  				Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
  1394  					Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
  1395  						Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
  1396  					}},
  1397  				}}}}}); err != nil {
  1398  		return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error())
  1399  	}
  1400  
  1401  	req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters)
  1402  	if err != nil {
  1403  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request")
  1404  		return
  1405  	}
  1406  
  1407  	result, err = client.UpdateCassandraKeyspaceThroughputSender(req)
  1408  	if err != nil {
  1409  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request")
  1410  		return
  1411  	}
  1412  
  1413  	return
  1414  }
  1415  
  1416  // UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request.
  1417  func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
  1418  	pathParameters := map[string]interface{}{
  1419  		"accountName":       autorest.Encode("path", accountName),
  1420  		"keyspaceName":      autorest.Encode("path", keyspaceName),
  1421  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1422  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1423  	}
  1424  
  1425  	const APIVersion = "2021-10-15"
  1426  	queryParameters := map[string]interface{}{
  1427  		"api-version": APIVersion,
  1428  	}
  1429  
  1430  	preparer := autorest.CreatePreparer(
  1431  		autorest.AsContentType("application/json; charset=utf-8"),
  1432  		autorest.AsPut(),
  1433  		autorest.WithBaseURL(client.BaseURI),
  1434  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters),
  1435  		autorest.WithJSON(updateThroughputParameters),
  1436  		autorest.WithQueryParameters(queryParameters))
  1437  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1438  }
  1439  
  1440  // UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the
  1441  // http.Response Body if it receives an error.
  1442  func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) {
  1443  	var resp *http.Response
  1444  	future.FutureAPI = &azure.Future{}
  1445  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1446  	if err != nil {
  1447  		return
  1448  	}
  1449  	var azf azure.Future
  1450  	azf, err = azure.NewFutureFromResponse(resp)
  1451  	future.FutureAPI = &azf
  1452  	future.Result = future.result
  1453  	return
  1454  }
  1455  
  1456  // UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always
  1457  // closes the http.Response Body.
  1458  func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1459  	err = autorest.Respond(
  1460  		resp,
  1461  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1462  		autorest.ByUnmarshallingJSON(&result),
  1463  		autorest.ByClosing())
  1464  	result.Response = autorest.Response{Response: resp}
  1465  	return
  1466  }
  1467  
  1468  // UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table
  1469  // Parameters:
  1470  // resourceGroupName - the name of the resource group. The name is case insensitive.
  1471  // accountName - cosmos DB database account name.
  1472  // keyspaceName - cosmos DB keyspace name.
  1473  // tableName - cosmos DB table name.
  1474  // updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra
  1475  // table.
  1476  func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) {
  1477  	if tracing.IsEnabled() {
  1478  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput")
  1479  		defer func() {
  1480  			sc := -1
  1481  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1482  				sc = result.FutureAPI.Response().StatusCode
  1483  			}
  1484  			tracing.EndSpan(ctx, sc, err)
  1485  		}()
  1486  	}
  1487  	if err := validation.Validate([]validation.Validation{
  1488  		{TargetValue: client.SubscriptionID,
  1489  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1490  		{TargetValue: resourceGroupName,
  1491  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
  1492  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
  1493  		{TargetValue: accountName,
  1494  			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1495  				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
  1496  				{Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
  1497  		{TargetValue: updateThroughputParameters,
  1498  			Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
  1499  				Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
  1500  					Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
  1501  						Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
  1502  					}},
  1503  				}}}}}); err != nil {
  1504  		return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error())
  1505  	}
  1506  
  1507  	req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters)
  1508  	if err != nil {
  1509  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request")
  1510  		return
  1511  	}
  1512  
  1513  	result, err = client.UpdateCassandraTableThroughputSender(req)
  1514  	if err != nil {
  1515  		err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request")
  1516  		return
  1517  	}
  1518  
  1519  	return
  1520  }
  1521  
  1522  // UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request.
  1523  func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
  1524  	pathParameters := map[string]interface{}{
  1525  		"accountName":       autorest.Encode("path", accountName),
  1526  		"keyspaceName":      autorest.Encode("path", keyspaceName),
  1527  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1528  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1529  		"tableName":         autorest.Encode("path", tableName),
  1530  	}
  1531  
  1532  	const APIVersion = "2021-10-15"
  1533  	queryParameters := map[string]interface{}{
  1534  		"api-version": APIVersion,
  1535  	}
  1536  
  1537  	preparer := autorest.CreatePreparer(
  1538  		autorest.AsContentType("application/json; charset=utf-8"),
  1539  		autorest.AsPut(),
  1540  		autorest.WithBaseURL(client.BaseURI),
  1541  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters),
  1542  		autorest.WithJSON(updateThroughputParameters),
  1543  		autorest.WithQueryParameters(queryParameters))
  1544  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1545  }
  1546  
  1547  // UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the
  1548  // http.Response Body if it receives an error.
  1549  func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, err error) {
  1550  	var resp *http.Response
  1551  	future.FutureAPI = &azure.Future{}
  1552  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1553  	if err != nil {
  1554  		return
  1555  	}
  1556  	var azf azure.Future
  1557  	azf, err = azure.NewFutureFromResponse(resp)
  1558  	future.FutureAPI = &azf
  1559  	future.Result = future.result
  1560  	return
  1561  }
  1562  
  1563  // UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always
  1564  // closes the http.Response Body.
  1565  func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
  1566  	err = autorest.Respond(
  1567  		resp,
  1568  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1569  		autorest.ByUnmarshallingJSON(&result),
  1570  		autorest.ByClosing())
  1571  	result.Response = autorest.Response{Response: resp}
  1572  	return
  1573  }
  1574  

View as plain text