...

Source file src/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2016-08-10/siterecovery/replicationstorageclassificationmappings.go

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

View as plain text