...

Source file src/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-01-10/siterecovery/replicationjobs.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/tracing"
    14  	"net/http"
    15  )
    16  
    17  // ReplicationJobsClient is the client for the ReplicationJobs methods of the Siterecovery service.
    18  type ReplicationJobsClient struct {
    19  	BaseClient
    20  }
    21  
    22  // NewReplicationJobsClient creates an instance of the ReplicationJobsClient client.
    23  func NewReplicationJobsClient(subscriptionID string, resourceGroupName string, resourceName string) ReplicationJobsClient {
    24  	return NewReplicationJobsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceGroupName, resourceName)
    25  }
    26  
    27  // NewReplicationJobsClientWithBaseURI creates an instance of the ReplicationJobsClient client using a custom endpoint.
    28  // Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
    29  func NewReplicationJobsClientWithBaseURI(baseURI string, subscriptionID string, resourceGroupName string, resourceName string) ReplicationJobsClient {
    30  	return ReplicationJobsClient{NewWithBaseURI(baseURI, subscriptionID, resourceGroupName, resourceName)}
    31  }
    32  
    33  // Cancel the operation to cancel an Azure Site Recovery job.
    34  // Parameters:
    35  // jobName - job identifier.
    36  func (client ReplicationJobsClient) Cancel(ctx context.Context, jobName string) (result ReplicationJobsCancelFuture, err error) {
    37  	if tracing.IsEnabled() {
    38  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationJobsClient.Cancel")
    39  		defer func() {
    40  			sc := -1
    41  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
    42  				sc = result.FutureAPI.Response().StatusCode
    43  			}
    44  			tracing.EndSpan(ctx, sc, err)
    45  		}()
    46  	}
    47  	req, err := client.CancelPreparer(ctx, jobName)
    48  	if err != nil {
    49  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Cancel", nil, "Failure preparing request")
    50  		return
    51  	}
    52  
    53  	result, err = client.CancelSender(req)
    54  	if err != nil {
    55  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Cancel", result.Response(), "Failure sending request")
    56  		return
    57  	}
    58  
    59  	return
    60  }
    61  
    62  // CancelPreparer prepares the Cancel request.
    63  func (client ReplicationJobsClient) CancelPreparer(ctx context.Context, jobName string) (*http.Request, error) {
    64  	pathParameters := map[string]interface{}{
    65  		"jobName":           autorest.Encode("path", jobName),
    66  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
    67  		"resourceName":      autorest.Encode("path", client.ResourceName),
    68  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    69  	}
    70  
    71  	const APIVersion = "2018-01-10"
    72  	queryParameters := map[string]interface{}{
    73  		"api-version": APIVersion,
    74  	}
    75  
    76  	preparer := autorest.CreatePreparer(
    77  		autorest.AsPost(),
    78  		autorest.WithBaseURL(client.BaseURI),
    79  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel", pathParameters),
    80  		autorest.WithQueryParameters(queryParameters))
    81  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    82  }
    83  
    84  // CancelSender sends the Cancel request. The method will close the
    85  // http.Response Body if it receives an error.
    86  func (client ReplicationJobsClient) CancelSender(req *http.Request) (future ReplicationJobsCancelFuture, err error) {
    87  	var resp *http.Response
    88  	future.FutureAPI = &azure.Future{}
    89  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
    90  	if err != nil {
    91  		return
    92  	}
    93  	var azf azure.Future
    94  	azf, err = azure.NewFutureFromResponse(resp)
    95  	future.FutureAPI = &azf
    96  	future.Result = future.result
    97  	return
    98  }
    99  
   100  // CancelResponder handles the response to the Cancel request. The method always
   101  // closes the http.Response Body.
   102  func (client ReplicationJobsClient) CancelResponder(resp *http.Response) (result Job, err error) {
   103  	err = autorest.Respond(
   104  		resp,
   105  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   106  		autorest.ByUnmarshallingJSON(&result),
   107  		autorest.ByClosing())
   108  	result.Response = autorest.Response{Response: resp}
   109  	return
   110  }
   111  
   112  // Export the operation to export the details of the Azure Site Recovery jobs of the vault.
   113  // Parameters:
   114  // jobQueryParameter - job query filter.
   115  func (client ReplicationJobsClient) Export(ctx context.Context, jobQueryParameter JobQueryParameter) (result ReplicationJobsExportFuture, err error) {
   116  	if tracing.IsEnabled() {
   117  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationJobsClient.Export")
   118  		defer func() {
   119  			sc := -1
   120  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   121  				sc = result.FutureAPI.Response().StatusCode
   122  			}
   123  			tracing.EndSpan(ctx, sc, err)
   124  		}()
   125  	}
   126  	req, err := client.ExportPreparer(ctx, jobQueryParameter)
   127  	if err != nil {
   128  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Export", nil, "Failure preparing request")
   129  		return
   130  	}
   131  
   132  	result, err = client.ExportSender(req)
   133  	if err != nil {
   134  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Export", result.Response(), "Failure sending request")
   135  		return
   136  	}
   137  
   138  	return
   139  }
   140  
   141  // ExportPreparer prepares the Export request.
   142  func (client ReplicationJobsClient) ExportPreparer(ctx context.Context, jobQueryParameter JobQueryParameter) (*http.Request, error) {
   143  	pathParameters := map[string]interface{}{
   144  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   145  		"resourceName":      autorest.Encode("path", client.ResourceName),
   146  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   147  	}
   148  
   149  	const APIVersion = "2018-01-10"
   150  	queryParameters := map[string]interface{}{
   151  		"api-version": APIVersion,
   152  	}
   153  
   154  	preparer := autorest.CreatePreparer(
   155  		autorest.AsContentType("application/json; charset=utf-8"),
   156  		autorest.AsPost(),
   157  		autorest.WithBaseURL(client.BaseURI),
   158  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export", pathParameters),
   159  		autorest.WithJSON(jobQueryParameter),
   160  		autorest.WithQueryParameters(queryParameters))
   161  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   162  }
   163  
   164  // ExportSender sends the Export request. The method will close the
   165  // http.Response Body if it receives an error.
   166  func (client ReplicationJobsClient) ExportSender(req *http.Request) (future ReplicationJobsExportFuture, err error) {
   167  	var resp *http.Response
   168  	future.FutureAPI = &azure.Future{}
   169  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   170  	if err != nil {
   171  		return
   172  	}
   173  	var azf azure.Future
   174  	azf, err = azure.NewFutureFromResponse(resp)
   175  	future.FutureAPI = &azf
   176  	future.Result = future.result
   177  	return
   178  }
   179  
   180  // ExportResponder handles the response to the Export request. The method always
   181  // closes the http.Response Body.
   182  func (client ReplicationJobsClient) ExportResponder(resp *http.Response) (result Job, err error) {
   183  	err = autorest.Respond(
   184  		resp,
   185  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   186  		autorest.ByUnmarshallingJSON(&result),
   187  		autorest.ByClosing())
   188  	result.Response = autorest.Response{Response: resp}
   189  	return
   190  }
   191  
   192  // Get get the details of an Azure Site Recovery job.
   193  // Parameters:
   194  // jobName - job identifier
   195  func (client ReplicationJobsClient) Get(ctx context.Context, jobName string) (result Job, err error) {
   196  	if tracing.IsEnabled() {
   197  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationJobsClient.Get")
   198  		defer func() {
   199  			sc := -1
   200  			if result.Response.Response != nil {
   201  				sc = result.Response.Response.StatusCode
   202  			}
   203  			tracing.EndSpan(ctx, sc, err)
   204  		}()
   205  	}
   206  	req, err := client.GetPreparer(ctx, jobName)
   207  	if err != nil {
   208  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Get", nil, "Failure preparing request")
   209  		return
   210  	}
   211  
   212  	resp, err := client.GetSender(req)
   213  	if err != nil {
   214  		result.Response = autorest.Response{Response: resp}
   215  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Get", resp, "Failure sending request")
   216  		return
   217  	}
   218  
   219  	result, err = client.GetResponder(resp)
   220  	if err != nil {
   221  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Get", resp, "Failure responding to request")
   222  		return
   223  	}
   224  
   225  	return
   226  }
   227  
   228  // GetPreparer prepares the Get request.
   229  func (client ReplicationJobsClient) GetPreparer(ctx context.Context, jobName string) (*http.Request, error) {
   230  	pathParameters := map[string]interface{}{
   231  		"jobName":           autorest.Encode("path", jobName),
   232  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   233  		"resourceName":      autorest.Encode("path", client.ResourceName),
   234  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   235  	}
   236  
   237  	const APIVersion = "2018-01-10"
   238  	queryParameters := map[string]interface{}{
   239  		"api-version": APIVersion,
   240  	}
   241  
   242  	preparer := autorest.CreatePreparer(
   243  		autorest.AsGet(),
   244  		autorest.WithBaseURL(client.BaseURI),
   245  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}", pathParameters),
   246  		autorest.WithQueryParameters(queryParameters))
   247  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   248  }
   249  
   250  // GetSender sends the Get request. The method will close the
   251  // http.Response Body if it receives an error.
   252  func (client ReplicationJobsClient) GetSender(req *http.Request) (*http.Response, error) {
   253  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   254  }
   255  
   256  // GetResponder handles the response to the Get request. The method always
   257  // closes the http.Response Body.
   258  func (client ReplicationJobsClient) GetResponder(resp *http.Response) (result Job, err error) {
   259  	err = autorest.Respond(
   260  		resp,
   261  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   262  		autorest.ByUnmarshallingJSON(&result),
   263  		autorest.ByClosing())
   264  	result.Response = autorest.Response{Response: resp}
   265  	return
   266  }
   267  
   268  // List gets the list of Azure Site Recovery Jobs for the vault.
   269  // Parameters:
   270  // filter - oData filter options.
   271  func (client ReplicationJobsClient) List(ctx context.Context, filter string) (result JobCollectionPage, err error) {
   272  	if tracing.IsEnabled() {
   273  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationJobsClient.List")
   274  		defer func() {
   275  			sc := -1
   276  			if result.jc.Response.Response != nil {
   277  				sc = result.jc.Response.Response.StatusCode
   278  			}
   279  			tracing.EndSpan(ctx, sc, err)
   280  		}()
   281  	}
   282  	result.fn = client.listNextResults
   283  	req, err := client.ListPreparer(ctx, filter)
   284  	if err != nil {
   285  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "List", nil, "Failure preparing request")
   286  		return
   287  	}
   288  
   289  	resp, err := client.ListSender(req)
   290  	if err != nil {
   291  		result.jc.Response = autorest.Response{Response: resp}
   292  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "List", resp, "Failure sending request")
   293  		return
   294  	}
   295  
   296  	result.jc, err = client.ListResponder(resp)
   297  	if err != nil {
   298  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "List", resp, "Failure responding to request")
   299  		return
   300  	}
   301  	if result.jc.hasNextLink() && result.jc.IsEmpty() {
   302  		err = result.NextWithContext(ctx)
   303  		return
   304  	}
   305  
   306  	return
   307  }
   308  
   309  // ListPreparer prepares the List request.
   310  func (client ReplicationJobsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) {
   311  	pathParameters := map[string]interface{}{
   312  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   313  		"resourceName":      autorest.Encode("path", client.ResourceName),
   314  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   315  	}
   316  
   317  	const APIVersion = "2018-01-10"
   318  	queryParameters := map[string]interface{}{
   319  		"api-version": APIVersion,
   320  	}
   321  	if len(filter) > 0 {
   322  		queryParameters["$filter"] = autorest.Encode("query", filter)
   323  	}
   324  
   325  	preparer := autorest.CreatePreparer(
   326  		autorest.AsGet(),
   327  		autorest.WithBaseURL(client.BaseURI),
   328  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs", pathParameters),
   329  		autorest.WithQueryParameters(queryParameters))
   330  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   331  }
   332  
   333  // ListSender sends the List request. The method will close the
   334  // http.Response Body if it receives an error.
   335  func (client ReplicationJobsClient) ListSender(req *http.Request) (*http.Response, error) {
   336  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   337  }
   338  
   339  // ListResponder handles the response to the List request. The method always
   340  // closes the http.Response Body.
   341  func (client ReplicationJobsClient) ListResponder(resp *http.Response) (result JobCollection, err error) {
   342  	err = autorest.Respond(
   343  		resp,
   344  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   345  		autorest.ByUnmarshallingJSON(&result),
   346  		autorest.ByClosing())
   347  	result.Response = autorest.Response{Response: resp}
   348  	return
   349  }
   350  
   351  // listNextResults retrieves the next set of results, if any.
   352  func (client ReplicationJobsClient) listNextResults(ctx context.Context, lastResults JobCollection) (result JobCollection, err error) {
   353  	req, err := lastResults.jobCollectionPreparer(ctx)
   354  	if err != nil {
   355  		return result, autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "listNextResults", nil, "Failure preparing next results request")
   356  	}
   357  	if req == nil {
   358  		return
   359  	}
   360  	resp, err := client.ListSender(req)
   361  	if err != nil {
   362  		result.Response = autorest.Response{Response: resp}
   363  		return result, autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "listNextResults", resp, "Failure sending next results request")
   364  	}
   365  	result, err = client.ListResponder(resp)
   366  	if err != nil {
   367  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "listNextResults", resp, "Failure responding to next results request")
   368  	}
   369  	return
   370  }
   371  
   372  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   373  func (client ReplicationJobsClient) ListComplete(ctx context.Context, filter string) (result JobCollectionIterator, err error) {
   374  	if tracing.IsEnabled() {
   375  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationJobsClient.List")
   376  		defer func() {
   377  			sc := -1
   378  			if result.Response().Response.Response != nil {
   379  				sc = result.page.Response().Response.Response.StatusCode
   380  			}
   381  			tracing.EndSpan(ctx, sc, err)
   382  		}()
   383  	}
   384  	result.page, err = client.List(ctx, filter)
   385  	return
   386  }
   387  
   388  // Restart the operation to restart an Azure Site Recovery job.
   389  // Parameters:
   390  // jobName - job identifier.
   391  func (client ReplicationJobsClient) Restart(ctx context.Context, jobName string) (result ReplicationJobsRestartFuture, err error) {
   392  	if tracing.IsEnabled() {
   393  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationJobsClient.Restart")
   394  		defer func() {
   395  			sc := -1
   396  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   397  				sc = result.FutureAPI.Response().StatusCode
   398  			}
   399  			tracing.EndSpan(ctx, sc, err)
   400  		}()
   401  	}
   402  	req, err := client.RestartPreparer(ctx, jobName)
   403  	if err != nil {
   404  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Restart", nil, "Failure preparing request")
   405  		return
   406  	}
   407  
   408  	result, err = client.RestartSender(req)
   409  	if err != nil {
   410  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Restart", result.Response(), "Failure sending request")
   411  		return
   412  	}
   413  
   414  	return
   415  }
   416  
   417  // RestartPreparer prepares the Restart request.
   418  func (client ReplicationJobsClient) RestartPreparer(ctx context.Context, jobName string) (*http.Request, error) {
   419  	pathParameters := map[string]interface{}{
   420  		"jobName":           autorest.Encode("path", jobName),
   421  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   422  		"resourceName":      autorest.Encode("path", client.ResourceName),
   423  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   424  	}
   425  
   426  	const APIVersion = "2018-01-10"
   427  	queryParameters := map[string]interface{}{
   428  		"api-version": APIVersion,
   429  	}
   430  
   431  	preparer := autorest.CreatePreparer(
   432  		autorest.AsPost(),
   433  		autorest.WithBaseURL(client.BaseURI),
   434  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart", pathParameters),
   435  		autorest.WithQueryParameters(queryParameters))
   436  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   437  }
   438  
   439  // RestartSender sends the Restart request. The method will close the
   440  // http.Response Body if it receives an error.
   441  func (client ReplicationJobsClient) RestartSender(req *http.Request) (future ReplicationJobsRestartFuture, err error) {
   442  	var resp *http.Response
   443  	future.FutureAPI = &azure.Future{}
   444  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   445  	if err != nil {
   446  		return
   447  	}
   448  	var azf azure.Future
   449  	azf, err = azure.NewFutureFromResponse(resp)
   450  	future.FutureAPI = &azf
   451  	future.Result = future.result
   452  	return
   453  }
   454  
   455  // RestartResponder handles the response to the Restart request. The method always
   456  // closes the http.Response Body.
   457  func (client ReplicationJobsClient) RestartResponder(resp *http.Response) (result Job, err error) {
   458  	err = autorest.Respond(
   459  		resp,
   460  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   461  		autorest.ByUnmarshallingJSON(&result),
   462  		autorest.ByClosing())
   463  	result.Response = autorest.Response{Response: resp}
   464  	return
   465  }
   466  
   467  // Resume the operation to resume an Azure Site Recovery job
   468  // Parameters:
   469  // jobName - job identifier.
   470  // resumeJobParams - resume rob comments.
   471  func (client ReplicationJobsClient) Resume(ctx context.Context, jobName string, resumeJobParams ResumeJobParams) (result ReplicationJobsResumeFuture, err error) {
   472  	if tracing.IsEnabled() {
   473  		ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationJobsClient.Resume")
   474  		defer func() {
   475  			sc := -1
   476  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   477  				sc = result.FutureAPI.Response().StatusCode
   478  			}
   479  			tracing.EndSpan(ctx, sc, err)
   480  		}()
   481  	}
   482  	req, err := client.ResumePreparer(ctx, jobName, resumeJobParams)
   483  	if err != nil {
   484  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Resume", nil, "Failure preparing request")
   485  		return
   486  	}
   487  
   488  	result, err = client.ResumeSender(req)
   489  	if err != nil {
   490  		err = autorest.NewErrorWithError(err, "siterecovery.ReplicationJobsClient", "Resume", result.Response(), "Failure sending request")
   491  		return
   492  	}
   493  
   494  	return
   495  }
   496  
   497  // ResumePreparer prepares the Resume request.
   498  func (client ReplicationJobsClient) ResumePreparer(ctx context.Context, jobName string, resumeJobParams ResumeJobParams) (*http.Request, error) {
   499  	pathParameters := map[string]interface{}{
   500  		"jobName":           autorest.Encode("path", jobName),
   501  		"resourceGroupName": autorest.Encode("path", client.ResourceGroupName),
   502  		"resourceName":      autorest.Encode("path", client.ResourceName),
   503  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   504  	}
   505  
   506  	const APIVersion = "2018-01-10"
   507  	queryParameters := map[string]interface{}{
   508  		"api-version": APIVersion,
   509  	}
   510  
   511  	preparer := autorest.CreatePreparer(
   512  		autorest.AsContentType("application/json; charset=utf-8"),
   513  		autorest.AsPost(),
   514  		autorest.WithBaseURL(client.BaseURI),
   515  		autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume", pathParameters),
   516  		autorest.WithJSON(resumeJobParams),
   517  		autorest.WithQueryParameters(queryParameters))
   518  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   519  }
   520  
   521  // ResumeSender sends the Resume request. The method will close the
   522  // http.Response Body if it receives an error.
   523  func (client ReplicationJobsClient) ResumeSender(req *http.Request) (future ReplicationJobsResumeFuture, err error) {
   524  	var resp *http.Response
   525  	future.FutureAPI = &azure.Future{}
   526  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   527  	if err != nil {
   528  		return
   529  	}
   530  	var azf azure.Future
   531  	azf, err = azure.NewFutureFromResponse(resp)
   532  	future.FutureAPI = &azf
   533  	future.Result = future.result
   534  	return
   535  }
   536  
   537  // ResumeResponder handles the response to the Resume request. The method always
   538  // closes the http.Response Body.
   539  func (client ReplicationJobsClient) ResumeResponder(resp *http.Response) (result Job, err error) {
   540  	err = autorest.Respond(
   541  		resp,
   542  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   543  		autorest.ByUnmarshallingJSON(&result),
   544  		autorest.ByClosing())
   545  	result.Response = autorest.Response{Response: resp}
   546  	return
   547  }
   548  

View as plain text