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