...

Source file src/github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2022-08-15/documentdb/cassandraclusters.go

Documentation: github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2022-08-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  // CassandraClustersClient is the client for the CassandraClusters methods of the Documentdb service.
    19  type CassandraClustersClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewCassandraClustersClient creates an instance of the CassandraClustersClient client.
    24  func NewCassandraClustersClient(subscriptionID string) CassandraClustersClient {
    25  	return NewCassandraClustersClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewCassandraClustersClientWithBaseURI creates an instance of the CassandraClustersClient 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 NewCassandraClustersClientWithBaseURI(baseURI string, subscriptionID string) CassandraClustersClient {
    32  	return CassandraClustersClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // CreateUpdate create or update a managed Cassandra cluster. When updating, you must specify all writable properties.
    36  // To update only some properties, use PATCH.
    37  // Parameters:
    38  // resourceGroupName - the name of the resource group. The name is case insensitive.
    39  // clusterName - managed Cassandra cluster name.
    40  // body - the properties specifying the desired state of the managed Cassandra cluster.
    41  func (client CassandraClustersClient) CreateUpdate(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (result CassandraClustersCreateUpdateFuture, err error) {
    42  	if tracing.IsEnabled() {
    43  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.CreateUpdate")
    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: clusterName,
    59  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
    60  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
    61  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {
    62  		return result, validation.NewError("documentdb.CassandraClustersClient", "CreateUpdate", err.Error())
    63  	}
    64  
    65  	req, err := client.CreateUpdatePreparer(ctx, resourceGroupName, clusterName, body)
    66  	if err != nil {
    67  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "CreateUpdate", nil, "Failure preparing request")
    68  		return
    69  	}
    70  
    71  	result, err = client.CreateUpdateSender(req)
    72  	if err != nil {
    73  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "CreateUpdate", result.Response(), "Failure sending request")
    74  		return
    75  	}
    76  
    77  	return
    78  }
    79  
    80  // CreateUpdatePreparer prepares the CreateUpdate request.
    81  func (client CassandraClustersClient) CreateUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (*http.Request, error) {
    82  	pathParameters := map[string]interface{}{
    83  		"clusterName":       autorest.Encode("path", clusterName),
    84  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
    85  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    86  	}
    87  
    88  	const APIVersion = "2022-08-15"
    89  	queryParameters := map[string]interface{}{
    90  		"api-version": APIVersion,
    91  	}
    92  
    93  	preparer := autorest.CreatePreparer(
    94  		autorest.AsContentType("application/json; charset=utf-8"),
    95  		autorest.AsPut(),
    96  		autorest.WithBaseURL(client.BaseURI),
    97  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", pathParameters),
    98  		autorest.WithJSON(body),
    99  		autorest.WithQueryParameters(queryParameters))
   100  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   101  }
   102  
   103  // CreateUpdateSender sends the CreateUpdate request. The method will close the
   104  // http.Response Body if it receives an error.
   105  func (client CassandraClustersClient) CreateUpdateSender(req *http.Request) (future CassandraClustersCreateUpdateFuture, err error) {
   106  	var resp *http.Response
   107  	future.FutureAPI = &azure.Future{}
   108  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   109  	if err != nil {
   110  		return
   111  	}
   112  	var azf azure.Future
   113  	azf, err = azure.NewFutureFromResponse(resp)
   114  	future.FutureAPI = &azf
   115  	future.Result = future.result
   116  	return
   117  }
   118  
   119  // CreateUpdateResponder handles the response to the CreateUpdate request. The method always
   120  // closes the http.Response Body.
   121  func (client CassandraClustersClient) CreateUpdateResponder(resp *http.Response) (result ClusterResource, err error) {
   122  	err = autorest.Respond(
   123  		resp,
   124  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   125  		autorest.ByUnmarshallingJSON(&result),
   126  		autorest.ByClosing())
   127  	result.Response = autorest.Response{Response: resp}
   128  	return
   129  }
   130  
   131  // Deallocate deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the
   132  // host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated
   133  // cluster. Use Start to restart the cluster.
   134  // Parameters:
   135  // resourceGroupName - the name of the resource group. The name is case insensitive.
   136  // clusterName - managed Cassandra cluster name.
   137  func (client CassandraClustersClient) Deallocate(ctx context.Context, resourceGroupName string, clusterName string) (result CassandraClustersDeallocateFuture, err error) {
   138  	if tracing.IsEnabled() {
   139  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.Deallocate")
   140  		defer func() {
   141  			sc := -1
   142  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   143  				sc = result.FutureAPI.Response().StatusCode
   144  			}
   145  			tracing.EndSpan(ctx, sc, err)
   146  		}()
   147  	}
   148  	if err := validation.Validate([]validation.Validation{
   149  		{TargetValue: client.SubscriptionID,
   150  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   151  		{TargetValue: resourceGroupName,
   152  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   153  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   154  		{TargetValue: clusterName,
   155  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
   156  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
   157  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {
   158  		return result, validation.NewError("documentdb.CassandraClustersClient", "Deallocate", err.Error())
   159  	}
   160  
   161  	req, err := client.DeallocatePreparer(ctx, resourceGroupName, clusterName)
   162  	if err != nil {
   163  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Deallocate", nil, "Failure preparing request")
   164  		return
   165  	}
   166  
   167  	result, err = client.DeallocateSender(req)
   168  	if err != nil {
   169  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Deallocate", result.Response(), "Failure sending request")
   170  		return
   171  	}
   172  
   173  	return
   174  }
   175  
   176  // DeallocatePreparer prepares the Deallocate request.
   177  func (client CassandraClustersClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
   178  	pathParameters := map[string]interface{}{
   179  		"clusterName":       autorest.Encode("path", clusterName),
   180  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   181  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   182  	}
   183  
   184  	const APIVersion = "2022-08-15"
   185  	queryParameters := map[string]interface{}{
   186  		"api-version": APIVersion,
   187  	}
   188  
   189  	preparer := autorest.CreatePreparer(
   190  		autorest.AsPost(),
   191  		autorest.WithBaseURL(client.BaseURI),
   192  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate", pathParameters),
   193  		autorest.WithQueryParameters(queryParameters))
   194  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   195  }
   196  
   197  // DeallocateSender sends the Deallocate request. The method will close the
   198  // http.Response Body if it receives an error.
   199  func (client CassandraClustersClient) DeallocateSender(req *http.Request) (future CassandraClustersDeallocateFuture, err error) {
   200  	var resp *http.Response
   201  	future.FutureAPI = &azure.Future{}
   202  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   203  	if err != nil {
   204  		return
   205  	}
   206  	var azf azure.Future
   207  	azf, err = azure.NewFutureFromResponse(resp)
   208  	future.FutureAPI = &azf
   209  	future.Result = future.result
   210  	return
   211  }
   212  
   213  // DeallocateResponder handles the response to the Deallocate request. The method always
   214  // closes the http.Response Body.
   215  func (client CassandraClustersClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) {
   216  	err = autorest.Respond(
   217  		resp,
   218  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   219  		autorest.ByClosing())
   220  	result.Response = resp
   221  	return
   222  }
   223  
   224  // Delete deletes a managed Cassandra cluster.
   225  // Parameters:
   226  // resourceGroupName - the name of the resource group. The name is case insensitive.
   227  // clusterName - managed Cassandra cluster name.
   228  func (client CassandraClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result CassandraClustersDeleteFuture, err error) {
   229  	if tracing.IsEnabled() {
   230  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.Delete")
   231  		defer func() {
   232  			sc := -1
   233  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   234  				sc = result.FutureAPI.Response().StatusCode
   235  			}
   236  			tracing.EndSpan(ctx, sc, err)
   237  		}()
   238  	}
   239  	if err := validation.Validate([]validation.Validation{
   240  		{TargetValue: client.SubscriptionID,
   241  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   242  		{TargetValue: resourceGroupName,
   243  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   244  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   245  		{TargetValue: clusterName,
   246  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
   247  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
   248  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {
   249  		return result, validation.NewError("documentdb.CassandraClustersClient", "Delete", err.Error())
   250  	}
   251  
   252  	req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName)
   253  	if err != nil {
   254  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Delete", nil, "Failure preparing request")
   255  		return
   256  	}
   257  
   258  	result, err = client.DeleteSender(req)
   259  	if err != nil {
   260  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Delete", result.Response(), "Failure sending request")
   261  		return
   262  	}
   263  
   264  	return
   265  }
   266  
   267  // DeletePreparer prepares the Delete request.
   268  func (client CassandraClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
   269  	pathParameters := map[string]interface{}{
   270  		"clusterName":       autorest.Encode("path", clusterName),
   271  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   272  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   273  	}
   274  
   275  	const APIVersion = "2022-08-15"
   276  	queryParameters := map[string]interface{}{
   277  		"api-version": APIVersion,
   278  	}
   279  
   280  	preparer := autorest.CreatePreparer(
   281  		autorest.AsDelete(),
   282  		autorest.WithBaseURL(client.BaseURI),
   283  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", pathParameters),
   284  		autorest.WithQueryParameters(queryParameters))
   285  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   286  }
   287  
   288  // DeleteSender sends the Delete request. The method will close the
   289  // http.Response Body if it receives an error.
   290  func (client CassandraClustersClient) DeleteSender(req *http.Request) (future CassandraClustersDeleteFuture, err error) {
   291  	var resp *http.Response
   292  	future.FutureAPI = &azure.Future{}
   293  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   294  	if err != nil {
   295  		return
   296  	}
   297  	var azf azure.Future
   298  	azf, err = azure.NewFutureFromResponse(resp)
   299  	future.FutureAPI = &azf
   300  	future.Result = future.result
   301  	return
   302  }
   303  
   304  // DeleteResponder handles the response to the Delete request. The method always
   305  // closes the http.Response Body.
   306  func (client CassandraClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   307  	err = autorest.Respond(
   308  		resp,
   309  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   310  		autorest.ByClosing())
   311  	result.Response = resp
   312  	return
   313  }
   314  
   315  // Get get the properties of a managed Cassandra cluster.
   316  // Parameters:
   317  // resourceGroupName - the name of the resource group. The name is case insensitive.
   318  // clusterName - managed Cassandra cluster name.
   319  func (client CassandraClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterResource, err error) {
   320  	if tracing.IsEnabled() {
   321  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.Get")
   322  		defer func() {
   323  			sc := -1
   324  			if result.Response.Response != nil {
   325  				sc = result.Response.Response.StatusCode
   326  			}
   327  			tracing.EndSpan(ctx, sc, err)
   328  		}()
   329  	}
   330  	if err := validation.Validate([]validation.Validation{
   331  		{TargetValue: client.SubscriptionID,
   332  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   333  		{TargetValue: resourceGroupName,
   334  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   335  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   336  		{TargetValue: clusterName,
   337  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
   338  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
   339  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {
   340  		return result, validation.NewError("documentdb.CassandraClustersClient", "Get", err.Error())
   341  	}
   342  
   343  	req, err := client.GetPreparer(ctx, resourceGroupName, clusterName)
   344  	if err != nil {
   345  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Get", nil, "Failure preparing request")
   346  		return
   347  	}
   348  
   349  	resp, err := client.GetSender(req)
   350  	if err != nil {
   351  		result.Response = autorest.Response{Response: resp}
   352  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Get", resp, "Failure sending request")
   353  		return
   354  	}
   355  
   356  	result, err = client.GetResponder(resp)
   357  	if err != nil {
   358  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Get", resp, "Failure responding to request")
   359  		return
   360  	}
   361  
   362  	return
   363  }
   364  
   365  // GetPreparer prepares the Get request.
   366  func (client CassandraClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
   367  	pathParameters := map[string]interface{}{
   368  		"clusterName":       autorest.Encode("path", clusterName),
   369  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   370  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   371  	}
   372  
   373  	const APIVersion = "2022-08-15"
   374  	queryParameters := map[string]interface{}{
   375  		"api-version": APIVersion,
   376  	}
   377  
   378  	preparer := autorest.CreatePreparer(
   379  		autorest.AsGet(),
   380  		autorest.WithBaseURL(client.BaseURI),
   381  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", pathParameters),
   382  		autorest.WithQueryParameters(queryParameters))
   383  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   384  }
   385  
   386  // GetSender sends the Get request. The method will close the
   387  // http.Response Body if it receives an error.
   388  func (client CassandraClustersClient) GetSender(req *http.Request) (*http.Response, error) {
   389  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   390  }
   391  
   392  // GetResponder handles the response to the Get request. The method always
   393  // closes the http.Response Body.
   394  func (client CassandraClustersClient) GetResponder(resp *http.Response) (result ClusterResource, err error) {
   395  	err = autorest.Respond(
   396  		resp,
   397  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   398  		autorest.ByUnmarshallingJSON(&result),
   399  		autorest.ByClosing())
   400  	result.Response = autorest.Response{Response: resp}
   401  	return
   402  }
   403  
   404  // InvokeCommand invoke a command like nodetool for cassandra maintenance
   405  // Parameters:
   406  // resourceGroupName - the name of the resource group. The name is case insensitive.
   407  // clusterName - managed Cassandra cluster name.
   408  // body - specification which command to run where
   409  func (client CassandraClustersClient) InvokeCommand(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody) (result CassandraClustersInvokeCommandFuture, err error) {
   410  	if tracing.IsEnabled() {
   411  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.InvokeCommand")
   412  		defer func() {
   413  			sc := -1
   414  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   415  				sc = result.FutureAPI.Response().StatusCode
   416  			}
   417  			tracing.EndSpan(ctx, sc, err)
   418  		}()
   419  	}
   420  	if err := validation.Validate([]validation.Validation{
   421  		{TargetValue: client.SubscriptionID,
   422  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   423  		{TargetValue: resourceGroupName,
   424  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   425  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   426  		{TargetValue: clusterName,
   427  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
   428  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
   429  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}},
   430  		{TargetValue: body,
   431  			Constraints: []validation.Constraint{{Target: "body.Command", Name: validation.Null, Rule: true, Chain: nil},
   432  				{Target: "body.Host", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
   433  		return result, validation.NewError("documentdb.CassandraClustersClient", "InvokeCommand", err.Error())
   434  	}
   435  
   436  	req, err := client.InvokeCommandPreparer(ctx, resourceGroupName, clusterName, body)
   437  	if err != nil {
   438  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "InvokeCommand", nil, "Failure preparing request")
   439  		return
   440  	}
   441  
   442  	result, err = client.InvokeCommandSender(req)
   443  	if err != nil {
   444  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "InvokeCommand", result.Response(), "Failure sending request")
   445  		return
   446  	}
   447  
   448  	return
   449  }
   450  
   451  // InvokeCommandPreparer prepares the InvokeCommand request.
   452  func (client CassandraClustersClient) InvokeCommandPreparer(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody) (*http.Request, error) {
   453  	pathParameters := map[string]interface{}{
   454  		"clusterName":       autorest.Encode("path", clusterName),
   455  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   456  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   457  	}
   458  
   459  	const APIVersion = "2022-08-15"
   460  	queryParameters := map[string]interface{}{
   461  		"api-version": APIVersion,
   462  	}
   463  
   464  	preparer := autorest.CreatePreparer(
   465  		autorest.AsContentType("application/json; charset=utf-8"),
   466  		autorest.AsPost(),
   467  		autorest.WithBaseURL(client.BaseURI),
   468  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand", pathParameters),
   469  		autorest.WithJSON(body),
   470  		autorest.WithQueryParameters(queryParameters))
   471  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   472  }
   473  
   474  // InvokeCommandSender sends the InvokeCommand request. The method will close the
   475  // http.Response Body if it receives an error.
   476  func (client CassandraClustersClient) InvokeCommandSender(req *http.Request) (future CassandraClustersInvokeCommandFuture, err error) {
   477  	var resp *http.Response
   478  	future.FutureAPI = &azure.Future{}
   479  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   480  	if err != nil {
   481  		return
   482  	}
   483  	var azf azure.Future
   484  	azf, err = azure.NewFutureFromResponse(resp)
   485  	future.FutureAPI = &azf
   486  	future.Result = future.result
   487  	return
   488  }
   489  
   490  // InvokeCommandResponder handles the response to the InvokeCommand request. The method always
   491  // closes the http.Response Body.
   492  func (client CassandraClustersClient) InvokeCommandResponder(resp *http.Response) (result CommandOutput, err error) {
   493  	err = autorest.Respond(
   494  		resp,
   495  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   496  		autorest.ByUnmarshallingJSON(&result),
   497  		autorest.ByClosing())
   498  	result.Response = autorest.Response{Response: resp}
   499  	return
   500  }
   501  
   502  // ListByResourceGroup list all managed Cassandra clusters in this resource group.
   503  // Parameters:
   504  // resourceGroupName - the name of the resource group. The name is case insensitive.
   505  func (client CassandraClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListClusters, err error) {
   506  	if tracing.IsEnabled() {
   507  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.ListByResourceGroup")
   508  		defer func() {
   509  			sc := -1
   510  			if result.Response.Response != nil {
   511  				sc = result.Response.Response.StatusCode
   512  			}
   513  			tracing.EndSpan(ctx, sc, err)
   514  		}()
   515  	}
   516  	if err := validation.Validate([]validation.Validation{
   517  		{TargetValue: client.SubscriptionID,
   518  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   519  		{TargetValue: resourceGroupName,
   520  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   521  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   522  		return result, validation.NewError("documentdb.CassandraClustersClient", "ListByResourceGroup", err.Error())
   523  	}
   524  
   525  	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
   526  	if err != nil {
   527  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListByResourceGroup", nil, "Failure preparing request")
   528  		return
   529  	}
   530  
   531  	resp, err := client.ListByResourceGroupSender(req)
   532  	if err != nil {
   533  		result.Response = autorest.Response{Response: resp}
   534  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListByResourceGroup", resp, "Failure sending request")
   535  		return
   536  	}
   537  
   538  	result, err = client.ListByResourceGroupResponder(resp)
   539  	if err != nil {
   540  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListByResourceGroup", resp, "Failure responding to request")
   541  		return
   542  	}
   543  
   544  	return
   545  }
   546  
   547  // ListByResourceGroupPreparer prepares the ListByResourceGroup request.
   548  func (client CassandraClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   549  	pathParameters := map[string]interface{}{
   550  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   551  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   552  	}
   553  
   554  	const APIVersion = "2022-08-15"
   555  	queryParameters := map[string]interface{}{
   556  		"api-version": APIVersion,
   557  	}
   558  
   559  	preparer := autorest.CreatePreparer(
   560  		autorest.AsGet(),
   561  		autorest.WithBaseURL(client.BaseURI),
   562  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters", pathParameters),
   563  		autorest.WithQueryParameters(queryParameters))
   564  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   565  }
   566  
   567  // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
   568  // http.Response Body if it receives an error.
   569  func (client CassandraClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
   570  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   571  }
   572  
   573  // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
   574  // closes the http.Response Body.
   575  func (client CassandraClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ListClusters, err error) {
   576  	err = autorest.Respond(
   577  		resp,
   578  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   579  		autorest.ByUnmarshallingJSON(&result),
   580  		autorest.ByClosing())
   581  	result.Response = autorest.Response{Response: resp}
   582  	return
   583  }
   584  
   585  // ListBySubscription list all managed Cassandra clusters in this subscription.
   586  func (client CassandraClustersClient) ListBySubscription(ctx context.Context) (result ListClusters, err error) {
   587  	if tracing.IsEnabled() {
   588  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.ListBySubscription")
   589  		defer func() {
   590  			sc := -1
   591  			if result.Response.Response != nil {
   592  				sc = result.Response.Response.StatusCode
   593  			}
   594  			tracing.EndSpan(ctx, sc, err)
   595  		}()
   596  	}
   597  	if err := validation.Validate([]validation.Validation{
   598  		{TargetValue: client.SubscriptionID,
   599  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   600  		return result, validation.NewError("documentdb.CassandraClustersClient", "ListBySubscription", err.Error())
   601  	}
   602  
   603  	req, err := client.ListBySubscriptionPreparer(ctx)
   604  	if err != nil {
   605  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBySubscription", nil, "Failure preparing request")
   606  		return
   607  	}
   608  
   609  	resp, err := client.ListBySubscriptionSender(req)
   610  	if err != nil {
   611  		result.Response = autorest.Response{Response: resp}
   612  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBySubscription", resp, "Failure sending request")
   613  		return
   614  	}
   615  
   616  	result, err = client.ListBySubscriptionResponder(resp)
   617  	if err != nil {
   618  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBySubscription", resp, "Failure responding to request")
   619  		return
   620  	}
   621  
   622  	return
   623  }
   624  
   625  // ListBySubscriptionPreparer prepares the ListBySubscription request.
   626  func (client CassandraClustersClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
   627  	pathParameters := map[string]interface{}{
   628  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   629  	}
   630  
   631  	const APIVersion = "2022-08-15"
   632  	queryParameters := map[string]interface{}{
   633  		"api-version": APIVersion,
   634  	}
   635  
   636  	preparer := autorest.CreatePreparer(
   637  		autorest.AsGet(),
   638  		autorest.WithBaseURL(client.BaseURI),
   639  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters", pathParameters),
   640  		autorest.WithQueryParameters(queryParameters))
   641  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   642  }
   643  
   644  // ListBySubscriptionSender sends the ListBySubscription request. The method will close the
   645  // http.Response Body if it receives an error.
   646  func (client CassandraClustersClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
   647  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   648  }
   649  
   650  // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
   651  // closes the http.Response Body.
   652  func (client CassandraClustersClient) ListBySubscriptionResponder(resp *http.Response) (result ListClusters, err error) {
   653  	err = autorest.Respond(
   654  		resp,
   655  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   656  		autorest.ByUnmarshallingJSON(&result),
   657  		autorest.ByClosing())
   658  	result.Response = autorest.Response{Response: resp}
   659  	return
   660  }
   661  
   662  // Start start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of
   663  // this cluster with reserved data disk. This won't do anything on an already running cluster. Use Deallocate to
   664  // deallocate the cluster.
   665  // Parameters:
   666  // resourceGroupName - the name of the resource group. The name is case insensitive.
   667  // clusterName - managed Cassandra cluster name.
   668  func (client CassandraClustersClient) Start(ctx context.Context, resourceGroupName string, clusterName string) (result CassandraClustersStartFuture, err error) {
   669  	if tracing.IsEnabled() {
   670  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.Start")
   671  		defer func() {
   672  			sc := -1
   673  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   674  				sc = result.FutureAPI.Response().StatusCode
   675  			}
   676  			tracing.EndSpan(ctx, sc, err)
   677  		}()
   678  	}
   679  	if err := validation.Validate([]validation.Validation{
   680  		{TargetValue: client.SubscriptionID,
   681  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   682  		{TargetValue: resourceGroupName,
   683  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   684  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   685  		{TargetValue: clusterName,
   686  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
   687  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
   688  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {
   689  		return result, validation.NewError("documentdb.CassandraClustersClient", "Start", err.Error())
   690  	}
   691  
   692  	req, err := client.StartPreparer(ctx, resourceGroupName, clusterName)
   693  	if err != nil {
   694  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Start", nil, "Failure preparing request")
   695  		return
   696  	}
   697  
   698  	result, err = client.StartSender(req)
   699  	if err != nil {
   700  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Start", result.Response(), "Failure sending request")
   701  		return
   702  	}
   703  
   704  	return
   705  }
   706  
   707  // StartPreparer prepares the Start request.
   708  func (client CassandraClustersClient) StartPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
   709  	pathParameters := map[string]interface{}{
   710  		"clusterName":       autorest.Encode("path", clusterName),
   711  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   712  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   713  	}
   714  
   715  	const APIVersion = "2022-08-15"
   716  	queryParameters := map[string]interface{}{
   717  		"api-version": APIVersion,
   718  	}
   719  
   720  	preparer := autorest.CreatePreparer(
   721  		autorest.AsPost(),
   722  		autorest.WithBaseURL(client.BaseURI),
   723  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start", pathParameters),
   724  		autorest.WithQueryParameters(queryParameters))
   725  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   726  }
   727  
   728  // StartSender sends the Start request. The method will close the
   729  // http.Response Body if it receives an error.
   730  func (client CassandraClustersClient) StartSender(req *http.Request) (future CassandraClustersStartFuture, err error) {
   731  	var resp *http.Response
   732  	future.FutureAPI = &azure.Future{}
   733  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   734  	if err != nil {
   735  		return
   736  	}
   737  	var azf azure.Future
   738  	azf, err = azure.NewFutureFromResponse(resp)
   739  	future.FutureAPI = &azf
   740  	future.Result = future.result
   741  	return
   742  }
   743  
   744  // StartResponder handles the response to the Start request. The method always
   745  // closes the http.Response Body.
   746  func (client CassandraClustersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
   747  	err = autorest.Respond(
   748  		resp,
   749  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   750  		autorest.ByClosing())
   751  	result.Response = resp
   752  	return
   753  }
   754  
   755  // Status gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster.
   756  // Parameters:
   757  // resourceGroupName - the name of the resource group. The name is case insensitive.
   758  // clusterName - managed Cassandra cluster name.
   759  func (client CassandraClustersClient) Status(ctx context.Context, resourceGroupName string, clusterName string) (result CassandraClusterPublicStatus, err error) {
   760  	if tracing.IsEnabled() {
   761  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.Status")
   762  		defer func() {
   763  			sc := -1
   764  			if result.Response.Response != nil {
   765  				sc = result.Response.Response.StatusCode
   766  			}
   767  			tracing.EndSpan(ctx, sc, err)
   768  		}()
   769  	}
   770  	if err := validation.Validate([]validation.Validation{
   771  		{TargetValue: client.SubscriptionID,
   772  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   773  		{TargetValue: resourceGroupName,
   774  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   775  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   776  		{TargetValue: clusterName,
   777  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
   778  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
   779  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {
   780  		return result, validation.NewError("documentdb.CassandraClustersClient", "Status", err.Error())
   781  	}
   782  
   783  	req, err := client.StatusPreparer(ctx, resourceGroupName, clusterName)
   784  	if err != nil {
   785  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Status", nil, "Failure preparing request")
   786  		return
   787  	}
   788  
   789  	resp, err := client.StatusSender(req)
   790  	if err != nil {
   791  		result.Response = autorest.Response{Response: resp}
   792  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Status", resp, "Failure sending request")
   793  		return
   794  	}
   795  
   796  	result, err = client.StatusResponder(resp)
   797  	if err != nil {
   798  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Status", resp, "Failure responding to request")
   799  		return
   800  	}
   801  
   802  	return
   803  }
   804  
   805  // StatusPreparer prepares the Status request.
   806  func (client CassandraClustersClient) StatusPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) {
   807  	pathParameters := map[string]interface{}{
   808  		"clusterName":       autorest.Encode("path", clusterName),
   809  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   810  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   811  	}
   812  
   813  	const APIVersion = "2022-08-15"
   814  	queryParameters := map[string]interface{}{
   815  		"api-version": APIVersion,
   816  	}
   817  
   818  	preparer := autorest.CreatePreparer(
   819  		autorest.AsGet(),
   820  		autorest.WithBaseURL(client.BaseURI),
   821  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status", pathParameters),
   822  		autorest.WithQueryParameters(queryParameters))
   823  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   824  }
   825  
   826  // StatusSender sends the Status request. The method will close the
   827  // http.Response Body if it receives an error.
   828  func (client CassandraClustersClient) StatusSender(req *http.Request) (*http.Response, error) {
   829  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   830  }
   831  
   832  // StatusResponder handles the response to the Status request. The method always
   833  // closes the http.Response Body.
   834  func (client CassandraClustersClient) StatusResponder(resp *http.Response) (result CassandraClusterPublicStatus, err error) {
   835  	err = autorest.Respond(
   836  		resp,
   837  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   838  		autorest.ByUnmarshallingJSON(&result),
   839  		autorest.ByClosing())
   840  	result.Response = autorest.Response{Response: resp}
   841  	return
   842  }
   843  
   844  // Update updates some of the properties of a managed Cassandra cluster.
   845  // Parameters:
   846  // resourceGroupName - the name of the resource group. The name is case insensitive.
   847  // clusterName - managed Cassandra cluster name.
   848  // body - parameters to provide for specifying the managed Cassandra cluster.
   849  func (client CassandraClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (result CassandraClustersUpdateFuture, err error) {
   850  	if tracing.IsEnabled() {
   851  		ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.Update")
   852  		defer func() {
   853  			sc := -1
   854  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   855  				sc = result.FutureAPI.Response().StatusCode
   856  			}
   857  			tracing.EndSpan(ctx, sc, err)
   858  		}()
   859  	}
   860  	if err := validation.Validate([]validation.Validation{
   861  		{TargetValue: client.SubscriptionID,
   862  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   863  		{TargetValue: resourceGroupName,
   864  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   865  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   866  		{TargetValue: clusterName,
   867  			Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil},
   868  				{Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil},
   869  				{Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil {
   870  		return result, validation.NewError("documentdb.CassandraClustersClient", "Update", err.Error())
   871  	}
   872  
   873  	req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, body)
   874  	if err != nil {
   875  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Update", nil, "Failure preparing request")
   876  		return
   877  	}
   878  
   879  	result, err = client.UpdateSender(req)
   880  	if err != nil {
   881  		err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Update", result.Response(), "Failure sending request")
   882  		return
   883  	}
   884  
   885  	return
   886  }
   887  
   888  // UpdatePreparer prepares the Update request.
   889  func (client CassandraClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (*http.Request, error) {
   890  	pathParameters := map[string]interface{}{
   891  		"clusterName":       autorest.Encode("path", clusterName),
   892  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   893  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   894  	}
   895  
   896  	const APIVersion = "2022-08-15"
   897  	queryParameters := map[string]interface{}{
   898  		"api-version": APIVersion,
   899  	}
   900  
   901  	preparer := autorest.CreatePreparer(
   902  		autorest.AsContentType("application/json; charset=utf-8"),
   903  		autorest.AsPatch(),
   904  		autorest.WithBaseURL(client.BaseURI),
   905  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", pathParameters),
   906  		autorest.WithJSON(body),
   907  		autorest.WithQueryParameters(queryParameters))
   908  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   909  }
   910  
   911  // UpdateSender sends the Update request. The method will close the
   912  // http.Response Body if it receives an error.
   913  func (client CassandraClustersClient) UpdateSender(req *http.Request) (future CassandraClustersUpdateFuture, err error) {
   914  	var resp *http.Response
   915  	future.FutureAPI = &azure.Future{}
   916  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   917  	if err != nil {
   918  		return
   919  	}
   920  	var azf azure.Future
   921  	azf, err = azure.NewFutureFromResponse(resp)
   922  	future.FutureAPI = &azf
   923  	future.Result = future.result
   924  	return
   925  }
   926  
   927  // UpdateResponder handles the response to the Update request. The method always
   928  // closes the http.Response Body.
   929  func (client CassandraClustersClient) UpdateResponder(resp *http.Response) (result ClusterResource, err error) {
   930  	err = autorest.Respond(
   931  		resp,
   932  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   933  		autorest.ByUnmarshallingJSON(&result),
   934  		autorest.ByClosing())
   935  	result.Response = autorest.Response{Response: resp}
   936  	return
   937  }
   938  

View as plain text