...

Source file src/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-07-01/features/subscriptionfeatureregistrations.go

Documentation: github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-07-01/features

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

View as plain text