...

Source file src/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-01-10/siterecovery/replicationrecoveryplans.go

Documentation: github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-01-10/siterecovery

     1  package siterecovery
     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  // ReplicationRecoveryPlansClient is the client for the ReplicationRecoveryPlans methods of the Siterecovery service.
    19  type ReplicationRecoveryPlansClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewReplicationRecoveryPlansClient creates an instance of the ReplicationRecoveryPlansClient client.
    24  func NewReplicationRecoveryPlansClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationRecoveryPlansClient {
    25  	return NewReplicationRecoveryPlansClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName)
    26  }
    27  
    28  // NewReplicationRecoveryPlansClientWithBaseURI creates an instance of the ReplicationRecoveryPlansClient client using
    29  // a custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign
    30  // clouds, Azure stack).
    31  func NewReplicationRecoveryPlansClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationRecoveryPlansClient {
    32  	return ReplicationRecoveryPlansClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)}
    33  }
    34  
    35  // Create the operation to create a recovery plan.
    36  // Parameters:
    37  // recoveryPlanName - recovery plan name.
    38  // input - recovery Plan creation input.
    39  func (client ReplicationRecoveryPlansClient) Create(ctx context.Context, recoveryPlanName string, input CreateRecoveryPlanInput) (result ReplicationRecoveryPlansCreateFuture, err error) {
    40  	if tracing.IsEnabled() {
    41  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.Create")
    42  		defer func() {
    43  			sc := -1
    44  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
    45  				sc = result.FutureAPI.Response().StatusCode
    46  			}
    47  			tracing.EndSpan(ctx, sc, err)
    48  		}()
    49  	}
    50  	if err := validation.Validate([]validation.Validation{
    51  		{TargetValue: input,
    52  			Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true,
    53  				Chain: []validation.Constraint{{Target: "input.Properties.PrimaryFabricID", Name: validation.Null, Rule: true, Chain: nil},
    54  					{Target: "input.Properties.RecoveryFabricID", Name: validation.Null, Rule: true, Chain: nil},
    55  					{Target: "input.Properties.Groups", Name: validation.Null, Rule: true, Chain: nil},
    56  				}}}}}); err != nil {
    57  		return result, validation.NewError("siterecovery.ReplicationRecoveryPlansClient", "Create", err.Error())
    58  	}
    59  
    60  	req, err := client.CreatePreparer(ctx, recoveryPlanName, input)
    61  	if err != nil {
    62  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Create", nil, "Failure preparing request")
    63  		return
    64  	}
    65  
    66  	result, err = client.CreateSender(req)
    67  	if err != nil {
    68  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Create", result.Response(), "Failure sending request")
    69  		return
    70  	}
    71  
    72  	return
    73  }
    74  
    75  // CreatePreparer prepares the Create request.
    76  func (client ReplicationRecoveryPlansClient) CreatePreparer(ctx context.Context, recoveryPlanName string, input CreateRecoveryPlanInput) (*http.Request, error) {
    77  	pathParameters := map[string]interface{}{
    78  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
    79  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
    80  		"resourceName":      autorest.Encode("path", client.ResourceName),
    81  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    82  	}
    83  
    84  	const APIVersion = "2018-01-10"
    85  	queryParameters := map[string]interface{}{
    86  		"api-version": APIVersion,
    87  	}
    88  
    89  	preparer := autorest.CreatePreparer(
    90  		autorest.AsContentType("application/json; charset=utf-8"),
    91  		autorest.AsPut(),
    92  		autorest.WithBaseURL(client.BaseURI),
    93  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", pathParameters),
    94  		autorest.WithJSON(input),
    95  		autorest.WithQueryParameters(queryParameters))
    96  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    97  }
    98  
    99  // CreateSender sends the Create request. The method will close the
   100  // http.Response Body if it receives an error.
   101  func (client ReplicationRecoveryPlansClient) CreateSender(req *http.Request) (future ReplicationRecoveryPlansCreateFuture, err error) {
   102  	var resp *http.Response
   103  	future.FutureAPI = &azure.Future{}
   104  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   105  	if err != nil {
   106  		return
   107  	}
   108  	var azf azure.Future
   109  	azf, err = azure.NewFutureFromResponse(resp)
   110  	future.FutureAPI = &azf
   111  	future.Result = future.result
   112  	return
   113  }
   114  
   115  // CreateResponder handles the response to the Create request. The method always
   116  // closes the http.Response Body.
   117  func (client ReplicationRecoveryPlansClient) CreateResponder(resp *http.Response) (result RecoveryPlan, err error) {
   118  	err = autorest.Respond(
   119  		resp,
   120  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   121  		autorest.ByUnmarshallingJSON(&result),
   122  		autorest.ByClosing())
   123  	result.Response = autorest.Response{Response: resp}
   124  	return
   125  }
   126  
   127  // Delete delete a recovery plan.
   128  // Parameters:
   129  // recoveryPlanName - recovery plan name.
   130  func (client ReplicationRecoveryPlansClient) Delete(ctx context.Context, recoveryPlanName string) (result ReplicationRecoveryPlansDeleteFuture, err error) {
   131  	if tracing.IsEnabled() {
   132  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.Delete")
   133  		defer func() {
   134  			sc := -1
   135  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   136  				sc = result.FutureAPI.Response().StatusCode
   137  			}
   138  			tracing.EndSpan(ctx, sc, err)
   139  		}()
   140  	}
   141  	req, err := client.DeletePreparer(ctx, recoveryPlanName)
   142  	if err != nil {
   143  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Delete", nil, "Failure preparing request")
   144  		return
   145  	}
   146  
   147  	result, err = client.DeleteSender(req)
   148  	if err != nil {
   149  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Delete", result.Response(), "Failure sending request")
   150  		return
   151  	}
   152  
   153  	return
   154  }
   155  
   156  // DeletePreparer prepares the Delete request.
   157  func (client ReplicationRecoveryPlansClient) DeletePreparer(ctx context.Context, recoveryPlanName string) (*http.Request, error) {
   158  	pathParameters := map[string]interface{}{
   159  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   160  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   161  		"resourceName":      autorest.Encode("path", client.ResourceName),
   162  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   163  	}
   164  
   165  	const APIVersion = "2018-01-10"
   166  	queryParameters := map[string]interface{}{
   167  		"api-version": APIVersion,
   168  	}
   169  
   170  	preparer := autorest.CreatePreparer(
   171  		autorest.AsDelete(),
   172  		autorest.WithBaseURL(client.BaseURI),
   173  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", pathParameters),
   174  		autorest.WithQueryParameters(queryParameters))
   175  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   176  }
   177  
   178  // DeleteSender sends the Delete request. The method will close the
   179  // http.Response Body if it receives an error.
   180  func (client ReplicationRecoveryPlansClient) DeleteSender(req *http.Request) (future ReplicationRecoveryPlansDeleteFuture, err error) {
   181  	var resp *http.Response
   182  	future.FutureAPI = &azure.Future{}
   183  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   184  	if err != nil {
   185  		return
   186  	}
   187  	var azf azure.Future
   188  	azf, err = azure.NewFutureFromResponse(resp)
   189  	future.FutureAPI = &azf
   190  	future.Result = future.result
   191  	return
   192  }
   193  
   194  // DeleteResponder handles the response to the Delete request. The method always
   195  // closes the http.Response Body.
   196  func (client ReplicationRecoveryPlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   197  	err = autorest.Respond(
   198  		resp,
   199  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   200  		autorest.ByClosing())
   201  	result.Response = resp
   202  	return
   203  }
   204  
   205  // FailoverCommit the operation to commit the fail over of a recovery plan.
   206  // Parameters:
   207  // recoveryPlanName - recovery plan name.
   208  func (client ReplicationRecoveryPlansClient) FailoverCommit(ctx context.Context, recoveryPlanName string) (result ReplicationRecoveryPlansFailoverCommitFuture, err error) {
   209  	if tracing.IsEnabled() {
   210  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.FailoverCommit")
   211  		defer func() {
   212  			sc := -1
   213  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   214  				sc = result.FutureAPI.Response().StatusCode
   215  			}
   216  			tracing.EndSpan(ctx, sc, err)
   217  		}()
   218  	}
   219  	req, err := client.FailoverCommitPreparer(ctx, recoveryPlanName)
   220  	if err != nil {
   221  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "FailoverCommit", nil, "Failure preparing request")
   222  		return
   223  	}
   224  
   225  	result, err = client.FailoverCommitSender(req)
   226  	if err != nil {
   227  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "FailoverCommit", result.Response(), "Failure sending request")
   228  		return
   229  	}
   230  
   231  	return
   232  }
   233  
   234  // FailoverCommitPreparer prepares the FailoverCommit request.
   235  func (client ReplicationRecoveryPlansClient) FailoverCommitPreparer(ctx context.Context, recoveryPlanName string) (*http.Request, error) {
   236  	pathParameters := map[string]interface{}{
   237  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   238  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   239  		"resourceName":      autorest.Encode("path", client.ResourceName),
   240  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   241  	}
   242  
   243  	const APIVersion = "2018-01-10"
   244  	queryParameters := map[string]interface{}{
   245  		"api-version": APIVersion,
   246  	}
   247  
   248  	preparer := autorest.CreatePreparer(
   249  		autorest.AsPost(),
   250  		autorest.WithBaseURL(client.BaseURI),
   251  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit", pathParameters),
   252  		autorest.WithQueryParameters(queryParameters))
   253  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   254  }
   255  
   256  // FailoverCommitSender sends the FailoverCommit request. The method will close the
   257  // http.Response Body if it receives an error.
   258  func (client ReplicationRecoveryPlansClient) FailoverCommitSender(req *http.Request) (future ReplicationRecoveryPlansFailoverCommitFuture, err error) {
   259  	var resp *http.Response
   260  	future.FutureAPI = &azure.Future{}
   261  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   262  	if err != nil {
   263  		return
   264  	}
   265  	var azf azure.Future
   266  	azf, err = azure.NewFutureFromResponse(resp)
   267  	future.FutureAPI = &azf
   268  	future.Result = future.result
   269  	return
   270  }
   271  
   272  // FailoverCommitResponder handles the response to the FailoverCommit request. The method always
   273  // closes the http.Response Body.
   274  func (client ReplicationRecoveryPlansClient) FailoverCommitResponder(resp *http.Response) (result RecoveryPlan, err error) {
   275  	err = autorest.Respond(
   276  		resp,
   277  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   278  		autorest.ByUnmarshallingJSON(&result),
   279  		autorest.ByClosing())
   280  	result.Response = autorest.Response{Response: resp}
   281  	return
   282  }
   283  
   284  // Get gets the details of the recovery plan.
   285  // Parameters:
   286  // recoveryPlanName - name of the recovery plan.
   287  func (client ReplicationRecoveryPlansClient) Get(ctx context.Context, recoveryPlanName string) (result RecoveryPlan, err error) {
   288  	if tracing.IsEnabled() {
   289  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.Get")
   290  		defer func() {
   291  			sc := -1
   292  			if result.Response.Response != nil {
   293  				sc = result.Response.Response.StatusCode
   294  			}
   295  			tracing.EndSpan(ctx, sc, err)
   296  		}()
   297  	}
   298  	req, err := client.GetPreparer(ctx, recoveryPlanName)
   299  	if err != nil {
   300  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Get", nil, "Failure preparing request")
   301  		return
   302  	}
   303  
   304  	resp, err := client.GetSender(req)
   305  	if err != nil {
   306  		result.Response = autorest.Response{Response: resp}
   307  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Get", resp, "Failure sending request")
   308  		return
   309  	}
   310  
   311  	result, err = client.GetResponder(resp)
   312  	if err != nil {
   313  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Get", resp, "Failure responding to request")
   314  		return
   315  	}
   316  
   317  	return
   318  }
   319  
   320  // GetPreparer prepares the Get request.
   321  func (client ReplicationRecoveryPlansClient) GetPreparer(ctx context.Context, recoveryPlanName string) (*http.Request, error) {
   322  	pathParameters := map[string]interface{}{
   323  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   324  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   325  		"resourceName":      autorest.Encode("path", client.ResourceName),
   326  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   327  	}
   328  
   329  	const APIVersion = "2018-01-10"
   330  	queryParameters := map[string]interface{}{
   331  		"api-version": APIVersion,
   332  	}
   333  
   334  	preparer := autorest.CreatePreparer(
   335  		autorest.AsGet(),
   336  		autorest.WithBaseURL(client.BaseURI),
   337  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", pathParameters),
   338  		autorest.WithQueryParameters(queryParameters))
   339  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   340  }
   341  
   342  // GetSender sends the Get request. The method will close the
   343  // http.Response Body if it receives an error.
   344  func (client ReplicationRecoveryPlansClient) GetSender(req *http.Request) (*http.Response, error) {
   345  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   346  }
   347  
   348  // GetResponder handles the response to the Get request. The method always
   349  // closes the http.Response Body.
   350  func (client ReplicationRecoveryPlansClient) GetResponder(resp *http.Response) (result RecoveryPlan, err error) {
   351  	err = autorest.Respond(
   352  		resp,
   353  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   354  		autorest.ByUnmarshallingJSON(&result),
   355  		autorest.ByClosing())
   356  	result.Response = autorest.Response{Response: resp}
   357  	return
   358  }
   359  
   360  // List lists the recovery plans in the vault.
   361  func (client ReplicationRecoveryPlansClient) List(ctx context.Context) (result RecoveryPlanCollectionPage, err error) {
   362  	if tracing.IsEnabled() {
   363  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.List")
   364  		defer func() {
   365  			sc := -1
   366  			if result.RPCVar.Response.Response != nil {
   367  				sc = result.RPCVar.Response.Response.StatusCode
   368  			}
   369  			tracing.EndSpan(ctx, sc, err)
   370  		}()
   371  	}
   372  	result.fn = client.listNextResults
   373  	req, err := client.ListPreparer(ctx)
   374  	if err != nil {
   375  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "List", nil, "Failure preparing request")
   376  		return
   377  	}
   378  
   379  	resp, err := client.ListSender(req)
   380  	if err != nil {
   381  		result.RPCVar.Response = autorest.Response{Response: resp}
   382  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "List", resp, "Failure sending request")
   383  		return
   384  	}
   385  
   386  	result.RPCVar, err = client.ListResponder(resp)
   387  	if err != nil {
   388  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "List", resp, "Failure responding to request")
   389  		return
   390  	}
   391  	if result.RPCVar.hasNextLink() && result.RPCVar.IsEmpty() {
   392  		err = result.NextWithContext(ctx)
   393  		return
   394  	}
   395  
   396  	return
   397  }
   398  
   399  // ListPreparer prepares the List request.
   400  func (client ReplicationRecoveryPlansClient) ListPreparer(ctx context.Context) (*http.Request, error) {
   401  	pathParameters := map[string]interface{}{
   402  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   403  		"resourceName":      autorest.Encode("path", client.ResourceName),
   404  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   405  	}
   406  
   407  	const APIVersion = "2018-01-10"
   408  	queryParameters := map[string]interface{}{
   409  		"api-version": APIVersion,
   410  	}
   411  
   412  	preparer := autorest.CreatePreparer(
   413  		autorest.AsGet(),
   414  		autorest.WithBaseURL(client.BaseURI),
   415  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans", pathParameters),
   416  		autorest.WithQueryParameters(queryParameters))
   417  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   418  }
   419  
   420  // ListSender sends the List request. The method will close the
   421  // http.Response Body if it receives an error.
   422  func (client ReplicationRecoveryPlansClient) ListSender(req *http.Request) (*http.Response, error) {
   423  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   424  }
   425  
   426  // ListResponder handles the response to the List request. The method always
   427  // closes the http.Response Body.
   428  func (client ReplicationRecoveryPlansClient) ListResponder(resp *http.Response) (result RecoveryPlanCollection, err error) {
   429  	err = autorest.Respond(
   430  		resp,
   431  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   432  		autorest.ByUnmarshallingJSON(&result),
   433  		autorest.ByClosing())
   434  	result.Response = autorest.Response{Response: resp}
   435  	return
   436  }
   437  
   438  // listNextResults retrieves the next set of results, if any.
   439  func (client ReplicationRecoveryPlansClient) listNextResults(ctx context.Context, lastResults RecoveryPlanCollection) (result RecoveryPlanCollection, err error) {
   440  	req, err := lastResults.recoveryPlanCollectionPreparer(ctx)
   441  	if err != nil {
   442  		return result, autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "listNextResults", nil, "Failure preparing next results request")
   443  	}
   444  	if req == nil {
   445  		return
   446  	}
   447  	resp, err := client.ListSender(req)
   448  	if err != nil {
   449  		result.Response = autorest.Response{Response: resp}
   450  		return result, autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "listNextResults", resp, "Failure sending next results request")
   451  	}
   452  	result, err = client.ListResponder(resp)
   453  	if err != nil {
   454  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "listNextResults", resp, "Failure responding to next results request")
   455  	}
   456  	return
   457  }
   458  
   459  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   460  func (client ReplicationRecoveryPlansClient) ListComplete(ctx context.Context) (result RecoveryPlanCollectionIterator, err error) {
   461  	if tracing.IsEnabled() {
   462  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.List")
   463  		defer func() {
   464  			sc := -1
   465  			if result.Response().Response.Response != nil {
   466  				sc = result.page.Response().Response.Response.StatusCode
   467  			}
   468  			tracing.EndSpan(ctx, sc, err)
   469  		}()
   470  	}
   471  	result.page, err = client.List(ctx)
   472  	return
   473  }
   474  
   475  // PlannedFailover the operation to start the planned failover of a recovery plan.
   476  // Parameters:
   477  // recoveryPlanName - recovery plan name.
   478  // input - failover input.
   479  func (client ReplicationRecoveryPlansClient) PlannedFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput) (result ReplicationRecoveryPlansPlannedFailoverFuture, err error) {
   480  	if tracing.IsEnabled() {
   481  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.PlannedFailover")
   482  		defer func() {
   483  			sc := -1
   484  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   485  				sc = result.FutureAPI.Response().StatusCode
   486  			}
   487  			tracing.EndSpan(ctx, sc, err)
   488  		}()
   489  	}
   490  	if err := validation.Validate([]validation.Validation{
   491  		{TargetValue: input,
   492  			Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
   493  		return result, validation.NewError("siterecovery.ReplicationRecoveryPlansClient", "PlannedFailover", err.Error())
   494  	}
   495  
   496  	req, err := client.PlannedFailoverPreparer(ctx, recoveryPlanName, input)
   497  	if err != nil {
   498  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "PlannedFailover", nil, "Failure preparing request")
   499  		return
   500  	}
   501  
   502  	result, err = client.PlannedFailoverSender(req)
   503  	if err != nil {
   504  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "PlannedFailover", result.Response(), "Failure sending request")
   505  		return
   506  	}
   507  
   508  	return
   509  }
   510  
   511  // PlannedFailoverPreparer prepares the PlannedFailover request.
   512  func (client ReplicationRecoveryPlansClient) PlannedFailoverPreparer(ctx context.Context, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput) (*http.Request, error) {
   513  	pathParameters := map[string]interface{}{
   514  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   515  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   516  		"resourceName":      autorest.Encode("path", client.ResourceName),
   517  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   518  	}
   519  
   520  	const APIVersion = "2018-01-10"
   521  	queryParameters := map[string]interface{}{
   522  		"api-version": APIVersion,
   523  	}
   524  
   525  	preparer := autorest.CreatePreparer(
   526  		autorest.AsContentType("application/json; charset=utf-8"),
   527  		autorest.AsPost(),
   528  		autorest.WithBaseURL(client.BaseURI),
   529  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover", pathParameters),
   530  		autorest.WithJSON(input),
   531  		autorest.WithQueryParameters(queryParameters))
   532  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   533  }
   534  
   535  // PlannedFailoverSender sends the PlannedFailover request. The method will close the
   536  // http.Response Body if it receives an error.
   537  func (client ReplicationRecoveryPlansClient) PlannedFailoverSender(req *http.Request) (future ReplicationRecoveryPlansPlannedFailoverFuture, err error) {
   538  	var resp *http.Response
   539  	future.FutureAPI = &azure.Future{}
   540  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   541  	if err != nil {
   542  		return
   543  	}
   544  	var azf azure.Future
   545  	azf, err = azure.NewFutureFromResponse(resp)
   546  	future.FutureAPI = &azf
   547  	future.Result = future.result
   548  	return
   549  }
   550  
   551  // PlannedFailoverResponder handles the response to the PlannedFailover request. The method always
   552  // closes the http.Response Body.
   553  func (client ReplicationRecoveryPlansClient) PlannedFailoverResponder(resp *http.Response) (result RecoveryPlan, err error) {
   554  	err = autorest.Respond(
   555  		resp,
   556  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   557  		autorest.ByUnmarshallingJSON(&result),
   558  		autorest.ByClosing())
   559  	result.Response = autorest.Response{Response: resp}
   560  	return
   561  }
   562  
   563  // Reprotect the operation to reprotect(reverse replicate) a recovery plan.
   564  // Parameters:
   565  // recoveryPlanName - recovery plan name.
   566  func (client ReplicationRecoveryPlansClient) Reprotect(ctx context.Context, recoveryPlanName string) (result ReplicationRecoveryPlansReprotectFuture, err error) {
   567  	if tracing.IsEnabled() {
   568  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.Reprotect")
   569  		defer func() {
   570  			sc := -1
   571  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   572  				sc = result.FutureAPI.Response().StatusCode
   573  			}
   574  			tracing.EndSpan(ctx, sc, err)
   575  		}()
   576  	}
   577  	req, err := client.ReprotectPreparer(ctx, recoveryPlanName)
   578  	if err != nil {
   579  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Reprotect", nil, "Failure preparing request")
   580  		return
   581  	}
   582  
   583  	result, err = client.ReprotectSender(req)
   584  	if err != nil {
   585  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Reprotect", result.Response(), "Failure sending request")
   586  		return
   587  	}
   588  
   589  	return
   590  }
   591  
   592  // ReprotectPreparer prepares the Reprotect request.
   593  func (client ReplicationRecoveryPlansClient) ReprotectPreparer(ctx context.Context, recoveryPlanName string) (*http.Request, error) {
   594  	pathParameters := map[string]interface{}{
   595  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   596  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   597  		"resourceName":      autorest.Encode("path", client.ResourceName),
   598  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   599  	}
   600  
   601  	const APIVersion = "2018-01-10"
   602  	queryParameters := map[string]interface{}{
   603  		"api-version": APIVersion,
   604  	}
   605  
   606  	preparer := autorest.CreatePreparer(
   607  		autorest.AsPost(),
   608  		autorest.WithBaseURL(client.BaseURI),
   609  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect", pathParameters),
   610  		autorest.WithQueryParameters(queryParameters))
   611  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   612  }
   613  
   614  // ReprotectSender sends the Reprotect request. The method will close the
   615  // http.Response Body if it receives an error.
   616  func (client ReplicationRecoveryPlansClient) ReprotectSender(req *http.Request) (future ReplicationRecoveryPlansReprotectFuture, err error) {
   617  	var resp *http.Response
   618  	future.FutureAPI = &azure.Future{}
   619  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   620  	if err != nil {
   621  		return
   622  	}
   623  	var azf azure.Future
   624  	azf, err = azure.NewFutureFromResponse(resp)
   625  	future.FutureAPI = &azf
   626  	future.Result = future.result
   627  	return
   628  }
   629  
   630  // ReprotectResponder handles the response to the Reprotect request. The method always
   631  // closes the http.Response Body.
   632  func (client ReplicationRecoveryPlansClient) ReprotectResponder(resp *http.Response) (result RecoveryPlan, err error) {
   633  	err = autorest.Respond(
   634  		resp,
   635  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   636  		autorest.ByUnmarshallingJSON(&result),
   637  		autorest.ByClosing())
   638  	result.Response = autorest.Response{Response: resp}
   639  	return
   640  }
   641  
   642  // TestFailover the operation to start the test failover of a recovery plan.
   643  // Parameters:
   644  // recoveryPlanName - recovery plan name.
   645  // input - failover input.
   646  func (client ReplicationRecoveryPlansClient) TestFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverInput) (result ReplicationRecoveryPlansTestFailoverFuture, err error) {
   647  	if tracing.IsEnabled() {
   648  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.TestFailover")
   649  		defer func() {
   650  			sc := -1
   651  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   652  				sc = result.FutureAPI.Response().StatusCode
   653  			}
   654  			tracing.EndSpan(ctx, sc, err)
   655  		}()
   656  	}
   657  	if err := validation.Validate([]validation.Validation{
   658  		{TargetValue: input,
   659  			Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true,
   660  				Chain: []validation.Constraint{{Target: "input.Properties.NetworkType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
   661  		return result, validation.NewError("siterecovery.ReplicationRecoveryPlansClient", "TestFailover", err.Error())
   662  	}
   663  
   664  	req, err := client.TestFailoverPreparer(ctx, recoveryPlanName, input)
   665  	if err != nil {
   666  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "TestFailover", nil, "Failure preparing request")
   667  		return
   668  	}
   669  
   670  	result, err = client.TestFailoverSender(req)
   671  	if err != nil {
   672  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "TestFailover", result.Response(), "Failure sending request")
   673  		return
   674  	}
   675  
   676  	return
   677  }
   678  
   679  // TestFailoverPreparer prepares the TestFailover request.
   680  func (client ReplicationRecoveryPlansClient) TestFailoverPreparer(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverInput) (*http.Request, error) {
   681  	pathParameters := map[string]interface{}{
   682  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   683  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   684  		"resourceName":      autorest.Encode("path", client.ResourceName),
   685  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   686  	}
   687  
   688  	const APIVersion = "2018-01-10"
   689  	queryParameters := map[string]interface{}{
   690  		"api-version": APIVersion,
   691  	}
   692  
   693  	preparer := autorest.CreatePreparer(
   694  		autorest.AsContentType("application/json; charset=utf-8"),
   695  		autorest.AsPost(),
   696  		autorest.WithBaseURL(client.BaseURI),
   697  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover", pathParameters),
   698  		autorest.WithJSON(input),
   699  		autorest.WithQueryParameters(queryParameters))
   700  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   701  }
   702  
   703  // TestFailoverSender sends the TestFailover request. The method will close the
   704  // http.Response Body if it receives an error.
   705  func (client ReplicationRecoveryPlansClient) TestFailoverSender(req *http.Request) (future ReplicationRecoveryPlansTestFailoverFuture, err error) {
   706  	var resp *http.Response
   707  	future.FutureAPI = &azure.Future{}
   708  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   709  	if err != nil {
   710  		return
   711  	}
   712  	var azf azure.Future
   713  	azf, err = azure.NewFutureFromResponse(resp)
   714  	future.FutureAPI = &azf
   715  	future.Result = future.result
   716  	return
   717  }
   718  
   719  // TestFailoverResponder handles the response to the TestFailover request. The method always
   720  // closes the http.Response Body.
   721  func (client ReplicationRecoveryPlansClient) TestFailoverResponder(resp *http.Response) (result RecoveryPlan, err error) {
   722  	err = autorest.Respond(
   723  		resp,
   724  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   725  		autorest.ByUnmarshallingJSON(&result),
   726  		autorest.ByClosing())
   727  	result.Response = autorest.Response{Response: resp}
   728  	return
   729  }
   730  
   731  // TestFailoverCleanup the operation to cleanup test failover of a recovery plan.
   732  // Parameters:
   733  // recoveryPlanName - recovery plan name.
   734  // input - test failover cleanup input.
   735  func (client ReplicationRecoveryPlansClient) TestFailoverCleanup(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput) (result ReplicationRecoveryPlansTestFailoverCleanupFuture, err error) {
   736  	if tracing.IsEnabled() {
   737  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.TestFailoverCleanup")
   738  		defer func() {
   739  			sc := -1
   740  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   741  				sc = result.FutureAPI.Response().StatusCode
   742  			}
   743  			tracing.EndSpan(ctx, sc, err)
   744  		}()
   745  	}
   746  	if err := validation.Validate([]validation.Validation{
   747  		{TargetValue: input,
   748  			Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
   749  		return result, validation.NewError("siterecovery.ReplicationRecoveryPlansClient", "TestFailoverCleanup", err.Error())
   750  	}
   751  
   752  	req, err := client.TestFailoverCleanupPreparer(ctx, recoveryPlanName, input)
   753  	if err != nil {
   754  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "TestFailoverCleanup", nil, "Failure preparing request")
   755  		return
   756  	}
   757  
   758  	result, err = client.TestFailoverCleanupSender(req)
   759  	if err != nil {
   760  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "TestFailoverCleanup", result.Response(), "Failure sending request")
   761  		return
   762  	}
   763  
   764  	return
   765  }
   766  
   767  // TestFailoverCleanupPreparer prepares the TestFailoverCleanup request.
   768  func (client ReplicationRecoveryPlansClient) TestFailoverCleanupPreparer(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput) (*http.Request, error) {
   769  	pathParameters := map[string]interface{}{
   770  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   771  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   772  		"resourceName":      autorest.Encode("path", client.ResourceName),
   773  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   774  	}
   775  
   776  	const APIVersion = "2018-01-10"
   777  	queryParameters := map[string]interface{}{
   778  		"api-version": APIVersion,
   779  	}
   780  
   781  	preparer := autorest.CreatePreparer(
   782  		autorest.AsContentType("application/json; charset=utf-8"),
   783  		autorest.AsPost(),
   784  		autorest.WithBaseURL(client.BaseURI),
   785  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup", pathParameters),
   786  		autorest.WithJSON(input),
   787  		autorest.WithQueryParameters(queryParameters))
   788  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   789  }
   790  
   791  // TestFailoverCleanupSender sends the TestFailoverCleanup request. The method will close the
   792  // http.Response Body if it receives an error.
   793  func (client ReplicationRecoveryPlansClient) TestFailoverCleanupSender(req *http.Request) (future ReplicationRecoveryPlansTestFailoverCleanupFuture, err error) {
   794  	var resp *http.Response
   795  	future.FutureAPI = &azure.Future{}
   796  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   797  	if err != nil {
   798  		return
   799  	}
   800  	var azf azure.Future
   801  	azf, err = azure.NewFutureFromResponse(resp)
   802  	future.FutureAPI = &azf
   803  	future.Result = future.result
   804  	return
   805  }
   806  
   807  // TestFailoverCleanupResponder handles the response to the TestFailoverCleanup request. The method always
   808  // closes the http.Response Body.
   809  func (client ReplicationRecoveryPlansClient) TestFailoverCleanupResponder(resp *http.Response) (result RecoveryPlan, err error) {
   810  	err = autorest.Respond(
   811  		resp,
   812  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   813  		autorest.ByUnmarshallingJSON(&result),
   814  		autorest.ByClosing())
   815  	result.Response = autorest.Response{Response: resp}
   816  	return
   817  }
   818  
   819  // UnplannedFailover the operation to start the failover of a recovery plan.
   820  // Parameters:
   821  // recoveryPlanName - recovery plan name.
   822  // input - failover input.
   823  func (client ReplicationRecoveryPlansClient) UnplannedFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput) (result ReplicationRecoveryPlansUnplannedFailoverFuture, err error) {
   824  	if tracing.IsEnabled() {
   825  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.UnplannedFailover")
   826  		defer func() {
   827  			sc := -1
   828  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   829  				sc = result.FutureAPI.Response().StatusCode
   830  			}
   831  			tracing.EndSpan(ctx, sc, err)
   832  		}()
   833  	}
   834  	if err := validation.Validate([]validation.Validation{
   835  		{TargetValue: input,
   836  			Constraints: []validation.Constraint{{Target: "input.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
   837  		return result, validation.NewError("siterecovery.ReplicationRecoveryPlansClient", "UnplannedFailover", err.Error())
   838  	}
   839  
   840  	req, err := client.UnplannedFailoverPreparer(ctx, recoveryPlanName, input)
   841  	if err != nil {
   842  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "UnplannedFailover", nil, "Failure preparing request")
   843  		return
   844  	}
   845  
   846  	result, err = client.UnplannedFailoverSender(req)
   847  	if err != nil {
   848  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "UnplannedFailover", result.Response(), "Failure sending request")
   849  		return
   850  	}
   851  
   852  	return
   853  }
   854  
   855  // UnplannedFailoverPreparer prepares the UnplannedFailover request.
   856  func (client ReplicationRecoveryPlansClient) UnplannedFailoverPreparer(ctx context.Context, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput) (*http.Request, error) {
   857  	pathParameters := map[string]interface{}{
   858  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   859  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   860  		"resourceName":      autorest.Encode("path", client.ResourceName),
   861  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   862  	}
   863  
   864  	const APIVersion = "2018-01-10"
   865  	queryParameters := map[string]interface{}{
   866  		"api-version": APIVersion,
   867  	}
   868  
   869  	preparer := autorest.CreatePreparer(
   870  		autorest.AsContentType("application/json; charset=utf-8"),
   871  		autorest.AsPost(),
   872  		autorest.WithBaseURL(client.BaseURI),
   873  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover", pathParameters),
   874  		autorest.WithJSON(input),
   875  		autorest.WithQueryParameters(queryParameters))
   876  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   877  }
   878  
   879  // UnplannedFailoverSender sends the UnplannedFailover request. The method will close the
   880  // http.Response Body if it receives an error.
   881  func (client ReplicationRecoveryPlansClient) UnplannedFailoverSender(req *http.Request) (future ReplicationRecoveryPlansUnplannedFailoverFuture, err error) {
   882  	var resp *http.Response
   883  	future.FutureAPI = &azure.Future{}
   884  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   885  	if err != nil {
   886  		return
   887  	}
   888  	var azf azure.Future
   889  	azf, err = azure.NewFutureFromResponse(resp)
   890  	future.FutureAPI = &azf
   891  	future.Result = future.result
   892  	return
   893  }
   894  
   895  // UnplannedFailoverResponder handles the response to the UnplannedFailover request. The method always
   896  // closes the http.Response Body.
   897  func (client ReplicationRecoveryPlansClient) UnplannedFailoverResponder(resp *http.Response) (result RecoveryPlan, err error) {
   898  	err = autorest.Respond(
   899  		resp,
   900  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   901  		autorest.ByUnmarshallingJSON(&result),
   902  		autorest.ByClosing())
   903  	result.Response = autorest.Response{Response: resp}
   904  	return
   905  }
   906  
   907  // Update the operation to update a recovery plan.
   908  // Parameters:
   909  // recoveryPlanName - recovery plan name.
   910  // input - update recovery plan input
   911  func (client ReplicationRecoveryPlansClient) Update(ctx context.Context, recoveryPlanName string, input UpdateRecoveryPlanInput) (result ReplicationRecoveryPlansUpdateFuture, err error) {
   912  	if tracing.IsEnabled() {
   913  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationRecoveryPlansClient.Update")
   914  		defer func() {
   915  			sc := -1
   916  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   917  				sc = result.FutureAPI.Response().StatusCode
   918  			}
   919  			tracing.EndSpan(ctx, sc, err)
   920  		}()
   921  	}
   922  	req, err := client.UpdatePreparer(ctx, recoveryPlanName, input)
   923  	if err != nil {
   924  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Update", nil, "Failure preparing request")
   925  		return
   926  	}
   927  
   928  	result, err = client.UpdateSender(req)
   929  	if err != nil {
   930  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationRecoveryPlansClient", "Update", result.Response(), "Failure sending request")
   931  		return
   932  	}
   933  
   934  	return
   935  }
   936  
   937  // UpdatePreparer prepares the Update request.
   938  func (client ReplicationRecoveryPlansClient) UpdatePreparer(ctx context.Context, recoveryPlanName string, input UpdateRecoveryPlanInput) (*http.Request, error) {
   939  	pathParameters := map[string]interface{}{
   940  		"recoveryPlanName":  autorest.Encode("path", recoveryPlanName),
   941  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   942  		"resourceName":      autorest.Encode("path", client.ResourceName),
   943  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   944  	}
   945  
   946  	const APIVersion = "2018-01-10"
   947  	queryParameters := map[string]interface{}{
   948  		"api-version": APIVersion,
   949  	}
   950  
   951  	preparer := autorest.CreatePreparer(
   952  		autorest.AsContentType("application/json; charset=utf-8"),
   953  		autorest.AsPatch(),
   954  		autorest.WithBaseURL(client.BaseURI),
   955  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}", pathParameters),
   956  		autorest.WithJSON(input),
   957  		autorest.WithQueryParameters(queryParameters))
   958  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   959  }
   960  
   961  // UpdateSender sends the Update request. The method will close the
   962  // http.Response Body if it receives an error.
   963  func (client ReplicationRecoveryPlansClient) UpdateSender(req *http.Request) (future ReplicationRecoveryPlansUpdateFuture, err error) {
   964  	var resp *http.Response
   965  	future.FutureAPI = &azure.Future{}
   966  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   967  	if err != nil {
   968  		return
   969  	}
   970  	var azf azure.Future
   971  	azf, err = azure.NewFutureFromResponse(resp)
   972  	future.FutureAPI = &azf
   973  	future.Result = future.result
   974  	return
   975  }
   976  
   977  // UpdateResponder handles the response to the Update request. The method always
   978  // closes the http.Response Body.
   979  func (client ReplicationRecoveryPlansClient) UpdateResponder(resp *http.Response) (result RecoveryPlan, err error) {
   980  	err = autorest.Respond(
   981  		resp,
   982  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   983  		autorest.ByUnmarshallingJSON(&result),
   984  		autorest.ByClosing())
   985  	result.Response = autorest.Response{Response: resp}
   986  	return
   987  }
   988  

View as plain text