...

Source file src/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions

     1  package subscriptions
     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  	"encoding/json"
    12  	"github.com/Azure/go-autorest/autorest"
    13  	"github.com/Azure/go-autorest/autorest/to"
    14  	"github.com/Azure/go-autorest/tracing"
    15  	"net/http"
    16  )
    17  
    18  // The package's fully qualified name.
    19  const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions"
    20  
    21  // CheckResourceNameResult resource Name valid if not a reserved word, does not contain a reserved word and
    22  // does not start with a reserved word
    23  type CheckResourceNameResult struct {
    24  	autorest.Response `json:"-"`
    25  	// Name - Name of Resource
    26  	Name *string `json:"name,omitempty"`
    27  	// Type - Type of Resource
    28  	Type *string `json:"type,omitempty"`
    29  	// Status - Is the resource name Allowed or Reserved. Possible values include: 'Allowed', 'Reserved'
    30  	Status ResourceNameStatus `json:"status,omitempty"`
    31  }
    32  
    33  // ErrorDefinition error description and code explaining why resource name is invalid.
    34  type ErrorDefinition struct {
    35  	// Message - Description of the error.
    36  	Message *string `json:"message,omitempty"`
    37  	// Code - Code of the error.
    38  	Code *string `json:"code,omitempty"`
    39  }
    40  
    41  // ErrorResponse error response.
    42  type ErrorResponse struct {
    43  	// Error - The error details.
    44  	Error *ErrorDefinition `json:"error,omitempty"`
    45  }
    46  
    47  // ListResult subscription list operation response.
    48  type ListResult struct {
    49  	autorest.Response `json:"-"`
    50  	// Value - An array of subscriptions.
    51  	Value *[]Subscription `json:"value,omitempty"`
    52  	// NextLink - The URL to get the next set of results.
    53  	NextLink *string `json:"nextLink,omitempty"`
    54  }
    55  
    56  // ListResultIterator provides access to a complete listing of Subscription values.
    57  type ListResultIterator struct {
    58  	i    int
    59  	page ListResultPage
    60  }
    61  
    62  // NextWithContext advances to the next value.  If there was an error making
    63  // the request the iterator does not advance and the error is returned.
    64  func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {
    65  	if tracing.IsEnabled() {
    66  		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext")
    67  		defer func() {
    68  			sc := -1
    69  			if iter.Response().Response.Response != nil {
    70  				sc = iter.Response().Response.Response.StatusCode
    71  			}
    72  			tracing.EndSpan(ctx, sc, err)
    73  		}()
    74  	}
    75  	iter.i++
    76  	if iter.i < len(iter.page.Values()) {
    77  		return nil
    78  	}
    79  	err = iter.page.NextWithContext(ctx)
    80  	if err != nil {
    81  		iter.i--
    82  		return err
    83  	}
    84  	iter.i = 0
    85  	return nil
    86  }
    87  
    88  // Next advances to the next value.  If there was an error making
    89  // the request the iterator does not advance and the error is returned.
    90  // Deprecated: Use NextWithContext() instead.
    91  func (iter *ListResultIterator) Next() error {
    92  	return iter.NextWithContext(context.Background())
    93  }
    94  
    95  // NotDone returns true if the enumeration should be started or is not yet complete.
    96  func (iter ListResultIterator) NotDone() bool {
    97  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
    98  }
    99  
   100  // Response returns the raw server response from the last page request.
   101  func (iter ListResultIterator) Response() ListResult {
   102  	return iter.page.Response()
   103  }
   104  
   105  // Value returns the current value or a zero-initialized value if the
   106  // iterator has advanced beyond the end of the collection.
   107  func (iter ListResultIterator) Value() Subscription {
   108  	if !iter.page.NotDone() {
   109  		return Subscription{}
   110  	}
   111  	return iter.page.Values()[iter.i]
   112  }
   113  
   114  // Creates a new instance of the ListResultIterator type.
   115  func NewListResultIterator(page ListResultPage) ListResultIterator {
   116  	return ListResultIterator{page: page}
   117  }
   118  
   119  // IsEmpty returns true if the ListResult contains no values.
   120  func (lr ListResult) IsEmpty() bool {
   121  	return lr.Value == nil || len(*lr.Value) == 0
   122  }
   123  
   124  // hasNextLink returns true if the NextLink is not empty.
   125  func (lr ListResult) hasNextLink() bool {
   126  	return lr.NextLink != nil && len(*lr.NextLink) != 0
   127  }
   128  
   129  // listResultPreparer prepares a request to retrieve the next set of results.
   130  // It returns nil if no more results exist.
   131  func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
   132  	if !lr.hasNextLink() {
   133  		return nil, nil
   134  	}
   135  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   136  		autorest.AsJSON(),
   137  		autorest.AsGet(),
   138  		autorest.WithBaseURL(to.String(lr.NextLink)))
   139  }
   140  
   141  // ListResultPage contains a page of Subscription values.
   142  type ListResultPage struct {
   143  	fn func(context.Context, ListResult) (ListResult, error)
   144  	lr ListResult
   145  }
   146  
   147  // NextWithContext advances to the next page of values.  If there was an error making
   148  // the request the page does not advance and the error is returned.
   149  func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {
   150  	if tracing.IsEnabled() {
   151  		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext")
   152  		defer func() {
   153  			sc := -1
   154  			if page.Response().Response.Response != nil {
   155  				sc = page.Response().Response.Response.StatusCode
   156  			}
   157  			tracing.EndSpan(ctx, sc, err)
   158  		}()
   159  	}
   160  	for {
   161  		next, err := page.fn(ctx, page.lr)
   162  		if err != nil {
   163  			return err
   164  		}
   165  		page.lr = next
   166  		if !next.hasNextLink() || !next.IsEmpty() {
   167  			break
   168  		}
   169  	}
   170  	return nil
   171  }
   172  
   173  // Next advances to the next page of values.  If there was an error making
   174  // the request the page does not advance and the error is returned.
   175  // Deprecated: Use NextWithContext() instead.
   176  func (page *ListResultPage) Next() error {
   177  	return page.NextWithContext(context.Background())
   178  }
   179  
   180  // NotDone returns true if the page enumeration should be started or is not yet complete.
   181  func (page ListResultPage) NotDone() bool {
   182  	return !page.lr.IsEmpty()
   183  }
   184  
   185  // Response returns the raw server response from the last page request.
   186  func (page ListResultPage) Response() ListResult {
   187  	return page.lr
   188  }
   189  
   190  // Values returns the slice of values for the current page or nil if there are no values.
   191  func (page ListResultPage) Values() []Subscription {
   192  	if page.lr.IsEmpty() {
   193  		return nil
   194  	}
   195  	return *page.lr.Value
   196  }
   197  
   198  // Creates a new instance of the ListResultPage type.
   199  func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {
   200  	return ListResultPage{
   201  		fn: getNextPage,
   202  		lr: cur,
   203  	}
   204  }
   205  
   206  // Location location information.
   207  type Location struct {
   208  	// ID - READ-ONLY; The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus.
   209  	ID *string `json:"id,omitempty"`
   210  	// SubscriptionID - READ-ONLY; The subscription ID.
   211  	SubscriptionID *string `json:"subscriptionId,omitempty"`
   212  	// Name - READ-ONLY; The location name.
   213  	Name *string `json:"name,omitempty"`
   214  	// DisplayName - READ-ONLY; The display name of the location.
   215  	DisplayName *string `json:"displayName,omitempty"`
   216  	// Latitude - READ-ONLY; The latitude of the location.
   217  	Latitude *string `json:"latitude,omitempty"`
   218  	// Longitude - READ-ONLY; The longitude of the location.
   219  	Longitude *string `json:"longitude,omitempty"`
   220  }
   221  
   222  // MarshalJSON is the custom marshaler for Location.
   223  func (l Location) MarshalJSON() ([]byte, error) {
   224  	objectMap := make(map[string]interface{})
   225  	return json.Marshal(objectMap)
   226  }
   227  
   228  // LocationListResult location list operation response.
   229  type LocationListResult struct {
   230  	autorest.Response `json:"-"`
   231  	// Value - An array of locations.
   232  	Value *[]Location `json:"value,omitempty"`
   233  }
   234  
   235  // Operation microsoft.Resources operation
   236  type Operation struct {
   237  	// Name - Operation name: {provider}/{resource}/{operation}
   238  	Name *string `json:"name,omitempty"`
   239  	// Display - The object that represents the operation.
   240  	Display *OperationDisplay `json:"display,omitempty"`
   241  }
   242  
   243  // OperationDisplay the object that represents the operation.
   244  type OperationDisplay struct {
   245  	// Provider - Service provider: Microsoft.Resources
   246  	Provider *string `json:"provider,omitempty"`
   247  	// Resource - Resource on which the operation is performed: Profile, endpoint, etc.
   248  	Resource *string `json:"resource,omitempty"`
   249  	// Operation - Operation type: Read, write, delete, etc.
   250  	Operation *string `json:"operation,omitempty"`
   251  	// Description - Description of the operation.
   252  	Description *string `json:"description,omitempty"`
   253  }
   254  
   255  // OperationListResult result of the request to list Microsoft.Resources operations. It contains a list of
   256  // operations and a URL link to get the next set of results.
   257  type OperationListResult struct {
   258  	autorest.Response `json:"-"`
   259  	// Value - List of Microsoft.Resources operations.
   260  	Value *[]Operation `json:"value,omitempty"`
   261  	// NextLink - URL to get the next set of operation list results if there are any.
   262  	NextLink *string `json:"nextLink,omitempty"`
   263  }
   264  
   265  // OperationListResultIterator provides access to a complete listing of Operation values.
   266  type OperationListResultIterator struct {
   267  	i    int
   268  	page OperationListResultPage
   269  }
   270  
   271  // NextWithContext advances to the next value.  If there was an error making
   272  // the request the iterator does not advance and the error is returned.
   273  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   274  	if tracing.IsEnabled() {
   275  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
   276  		defer func() {
   277  			sc := -1
   278  			if iter.Response().Response.Response != nil {
   279  				sc = iter.Response().Response.Response.StatusCode
   280  			}
   281  			tracing.EndSpan(ctx, sc, err)
   282  		}()
   283  	}
   284  	iter.i++
   285  	if iter.i < len(iter.page.Values()) {
   286  		return nil
   287  	}
   288  	err = iter.page.NextWithContext(ctx)
   289  	if err != nil {
   290  		iter.i--
   291  		return err
   292  	}
   293  	iter.i = 0
   294  	return nil
   295  }
   296  
   297  // Next advances to the next value.  If there was an error making
   298  // the request the iterator does not advance and the error is returned.
   299  // Deprecated: Use NextWithContext() instead.
   300  func (iter *OperationListResultIterator) Next() error {
   301  	return iter.NextWithContext(context.Background())
   302  }
   303  
   304  // NotDone returns true if the enumeration should be started or is not yet complete.
   305  func (iter OperationListResultIterator) NotDone() bool {
   306  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   307  }
   308  
   309  // Response returns the raw server response from the last page request.
   310  func (iter OperationListResultIterator) Response() OperationListResult {
   311  	return iter.page.Response()
   312  }
   313  
   314  // Value returns the current value or a zero-initialized value if the
   315  // iterator has advanced beyond the end of the collection.
   316  func (iter OperationListResultIterator) Value() Operation {
   317  	if !iter.page.NotDone() {
   318  		return Operation{}
   319  	}
   320  	return iter.page.Values()[iter.i]
   321  }
   322  
   323  // Creates a new instance of the OperationListResultIterator type.
   324  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
   325  	return OperationListResultIterator{page: page}
   326  }
   327  
   328  // IsEmpty returns true if the ListResult contains no values.
   329  func (olr OperationListResult) IsEmpty() bool {
   330  	return olr.Value == nil || len(*olr.Value) == 0
   331  }
   332  
   333  // hasNextLink returns true if the NextLink is not empty.
   334  func (olr OperationListResult) hasNextLink() bool {
   335  	return olr.NextLink != nil && len(*olr.NextLink) != 0
   336  }
   337  
   338  // operationListResultPreparer prepares a request to retrieve the next set of results.
   339  // It returns nil if no more results exist.
   340  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
   341  	if !olr.hasNextLink() {
   342  		return nil, nil
   343  	}
   344  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   345  		autorest.AsJSON(),
   346  		autorest.AsGet(),
   347  		autorest.WithBaseURL(to.String(olr.NextLink)))
   348  }
   349  
   350  // OperationListResultPage contains a page of Operation values.
   351  type OperationListResultPage struct {
   352  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
   353  	olr OperationListResult
   354  }
   355  
   356  // NextWithContext advances to the next page of values.  If there was an error making
   357  // the request the page does not advance and the error is returned.
   358  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
   359  	if tracing.IsEnabled() {
   360  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
   361  		defer func() {
   362  			sc := -1
   363  			if page.Response().Response.Response != nil {
   364  				sc = page.Response().Response.Response.StatusCode
   365  			}
   366  			tracing.EndSpan(ctx, sc, err)
   367  		}()
   368  	}
   369  	for {
   370  		next, err := page.fn(ctx, page.olr)
   371  		if err != nil {
   372  			return err
   373  		}
   374  		page.olr = next
   375  		if !next.hasNextLink() || !next.IsEmpty() {
   376  			break
   377  		}
   378  	}
   379  	return nil
   380  }
   381  
   382  // Next advances to the next page of values.  If there was an error making
   383  // the request the page does not advance and the error is returned.
   384  // Deprecated: Use NextWithContext() instead.
   385  func (page *OperationListResultPage) Next() error {
   386  	return page.NextWithContext(context.Background())
   387  }
   388  
   389  // NotDone returns true if the page enumeration should be started or is not yet complete.
   390  func (page OperationListResultPage) NotDone() bool {
   391  	return !page.olr.IsEmpty()
   392  }
   393  
   394  // Response returns the raw server response from the last page request.
   395  func (page OperationListResultPage) Response() OperationListResult {
   396  	return page.olr
   397  }
   398  
   399  // Values returns the slice of values for the current page or nil if there are no values.
   400  func (page OperationListResultPage) Values() []Operation {
   401  	if page.olr.IsEmpty() {
   402  		return nil
   403  	}
   404  	return *page.olr.Value
   405  }
   406  
   407  // Creates a new instance of the OperationListResultPage type.
   408  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
   409  	return OperationListResultPage{
   410  		fn:  getNextPage,
   411  		olr: cur,
   412  	}
   413  }
   414  
   415  // Policies subscription policies.
   416  type Policies struct {
   417  	// LocationPlacementID - READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions.
   418  	LocationPlacementID *string `json:"locationPlacementId,omitempty"`
   419  	// QuotaID - READ-ONLY; The subscription quota ID.
   420  	QuotaID *string `json:"quotaId,omitempty"`
   421  	// SpendingLimit - READ-ONLY; The subscription spending limit. Possible values include: 'On', 'Off', 'CurrentPeriodOff'
   422  	SpendingLimit SpendingLimit `json:"spendingLimit,omitempty"`
   423  }
   424  
   425  // MarshalJSON is the custom marshaler for Policies.
   426  func (p Policies) MarshalJSON() ([]byte, error) {
   427  	objectMap := make(map[string]interface{})
   428  	return json.Marshal(objectMap)
   429  }
   430  
   431  // ResourceName name and Type of the Resource
   432  type ResourceName struct {
   433  	// Name - Name of the resource
   434  	Name *string `json:"name,omitempty"`
   435  	// Type - The type of the resource
   436  	Type *string `json:"type,omitempty"`
   437  }
   438  
   439  // Subscription subscription information.
   440  type Subscription struct {
   441  	autorest.Response `json:"-"`
   442  	// ID - READ-ONLY; The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000.
   443  	ID *string `json:"id,omitempty"`
   444  	// SubscriptionID - READ-ONLY; The subscription ID.
   445  	SubscriptionID *string `json:"subscriptionId,omitempty"`
   446  	// DisplayName - READ-ONLY; The subscription display name.
   447  	DisplayName *string `json:"displayName,omitempty"`
   448  	// State - READ-ONLY; The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted'
   449  	State State `json:"state,omitempty"`
   450  	// SubscriptionPolicies - The subscription policies.
   451  	SubscriptionPolicies *Policies `json:"subscriptionPolicies,omitempty"`
   452  	// AuthorizationSource - The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'.
   453  	AuthorizationSource *string `json:"authorizationSource,omitempty"`
   454  }
   455  
   456  // MarshalJSON is the custom marshaler for Subscription.
   457  func (s Subscription) MarshalJSON() ([]byte, error) {
   458  	objectMap := make(map[string]interface{})
   459  	if s.SubscriptionPolicies != nil {
   460  		objectMap["subscriptionPolicies"] = s.SubscriptionPolicies
   461  	}
   462  	if s.AuthorizationSource != nil {
   463  		objectMap["authorizationSource"] = s.AuthorizationSource
   464  	}
   465  	return json.Marshal(objectMap)
   466  }
   467  
   468  // TenantIDDescription tenant Id information.
   469  type TenantIDDescription struct {
   470  	// ID - READ-ONLY; The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000.
   471  	ID *string `json:"id,omitempty"`
   472  	// TenantID - READ-ONLY; The tenant ID. For example, 00000000-0000-0000-0000-000000000000.
   473  	TenantID *string `json:"tenantId,omitempty"`
   474  }
   475  
   476  // MarshalJSON is the custom marshaler for TenantIDDescription.
   477  func (tid TenantIDDescription) MarshalJSON() ([]byte, error) {
   478  	objectMap := make(map[string]interface{})
   479  	return json.Marshal(objectMap)
   480  }
   481  
   482  // TenantListResult tenant Ids information.
   483  type TenantListResult struct {
   484  	autorest.Response `json:"-"`
   485  	// Value - An array of tenants.
   486  	Value *[]TenantIDDescription `json:"value,omitempty"`
   487  	// NextLink - The URL to use for getting the next set of results.
   488  	NextLink *string `json:"nextLink,omitempty"`
   489  }
   490  
   491  // TenantListResultIterator provides access to a complete listing of TenantIDDescription values.
   492  type TenantListResultIterator struct {
   493  	i    int
   494  	page TenantListResultPage
   495  }
   496  
   497  // NextWithContext advances to the next value.  If there was an error making
   498  // the request the iterator does not advance and the error is returned.
   499  func (iter *TenantListResultIterator) NextWithContext(ctx context.Context) (err error) {
   500  	if tracing.IsEnabled() {
   501  		ctx = tracing.StartSpan(ctx, fqdn+"/TenantListResultIterator.NextWithContext")
   502  		defer func() {
   503  			sc := -1
   504  			if iter.Response().Response.Response != nil {
   505  				sc = iter.Response().Response.Response.StatusCode
   506  			}
   507  			tracing.EndSpan(ctx, sc, err)
   508  		}()
   509  	}
   510  	iter.i++
   511  	if iter.i < len(iter.page.Values()) {
   512  		return nil
   513  	}
   514  	err = iter.page.NextWithContext(ctx)
   515  	if err != nil {
   516  		iter.i--
   517  		return err
   518  	}
   519  	iter.i = 0
   520  	return nil
   521  }
   522  
   523  // Next advances to the next value.  If there was an error making
   524  // the request the iterator does not advance and the error is returned.
   525  // Deprecated: Use NextWithContext() instead.
   526  func (iter *TenantListResultIterator) Next() error {
   527  	return iter.NextWithContext(context.Background())
   528  }
   529  
   530  // NotDone returns true if the enumeration should be started or is not yet complete.
   531  func (iter TenantListResultIterator) NotDone() bool {
   532  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   533  }
   534  
   535  // Response returns the raw server response from the last page request.
   536  func (iter TenantListResultIterator) Response() TenantListResult {
   537  	return iter.page.Response()
   538  }
   539  
   540  // Value returns the current value or a zero-initialized value if the
   541  // iterator has advanced beyond the end of the collection.
   542  func (iter TenantListResultIterator) Value() TenantIDDescription {
   543  	if !iter.page.NotDone() {
   544  		return TenantIDDescription{}
   545  	}
   546  	return iter.page.Values()[iter.i]
   547  }
   548  
   549  // Creates a new instance of the TenantListResultIterator type.
   550  func NewTenantListResultIterator(page TenantListResultPage) TenantListResultIterator {
   551  	return TenantListResultIterator{page: page}
   552  }
   553  
   554  // IsEmpty returns true if the ListResult contains no values.
   555  func (tlr TenantListResult) IsEmpty() bool {
   556  	return tlr.Value == nil || len(*tlr.Value) == 0
   557  }
   558  
   559  // hasNextLink returns true if the NextLink is not empty.
   560  func (tlr TenantListResult) hasNextLink() bool {
   561  	return tlr.NextLink != nil && len(*tlr.NextLink) != 0
   562  }
   563  
   564  // tenantListResultPreparer prepares a request to retrieve the next set of results.
   565  // It returns nil if no more results exist.
   566  func (tlr TenantListResult) tenantListResultPreparer(ctx context.Context) (*http.Request, error) {
   567  	if !tlr.hasNextLink() {
   568  		return nil, nil
   569  	}
   570  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   571  		autorest.AsJSON(),
   572  		autorest.AsGet(),
   573  		autorest.WithBaseURL(to.String(tlr.NextLink)))
   574  }
   575  
   576  // TenantListResultPage contains a page of TenantIDDescription values.
   577  type TenantListResultPage struct {
   578  	fn  func(context.Context, TenantListResult) (TenantListResult, error)
   579  	tlr TenantListResult
   580  }
   581  
   582  // NextWithContext advances to the next page of values.  If there was an error making
   583  // the request the page does not advance and the error is returned.
   584  func (page *TenantListResultPage) NextWithContext(ctx context.Context) (err error) {
   585  	if tracing.IsEnabled() {
   586  		ctx = tracing.StartSpan(ctx, fqdn+"/TenantListResultPage.NextWithContext")
   587  		defer func() {
   588  			sc := -1
   589  			if page.Response().Response.Response != nil {
   590  				sc = page.Response().Response.Response.StatusCode
   591  			}
   592  			tracing.EndSpan(ctx, sc, err)
   593  		}()
   594  	}
   595  	for {
   596  		next, err := page.fn(ctx, page.tlr)
   597  		if err != nil {
   598  			return err
   599  		}
   600  		page.tlr = next
   601  		if !next.hasNextLink() || !next.IsEmpty() {
   602  			break
   603  		}
   604  	}
   605  	return nil
   606  }
   607  
   608  // Next advances to the next page of values.  If there was an error making
   609  // the request the page does not advance and the error is returned.
   610  // Deprecated: Use NextWithContext() instead.
   611  func (page *TenantListResultPage) Next() error {
   612  	return page.NextWithContext(context.Background())
   613  }
   614  
   615  // NotDone returns true if the page enumeration should be started or is not yet complete.
   616  func (page TenantListResultPage) NotDone() bool {
   617  	return !page.tlr.IsEmpty()
   618  }
   619  
   620  // Response returns the raw server response from the last page request.
   621  func (page TenantListResultPage) Response() TenantListResult {
   622  	return page.tlr
   623  }
   624  
   625  // Values returns the slice of values for the current page or nil if there are no values.
   626  func (page TenantListResultPage) Values() []TenantIDDescription {
   627  	if page.tlr.IsEmpty() {
   628  		return nil
   629  	}
   630  	return *page.tlr.Value
   631  }
   632  
   633  // Creates a new instance of the TenantListResultPage type.
   634  func NewTenantListResultPage(cur TenantListResult, getNextPage func(context.Context, TenantListResult) (TenantListResult, error)) TenantListResultPage {
   635  	return TenantListResultPage{
   636  		fn:  getNextPage,
   637  		tlr: cur,
   638  	}
   639  }
   640  

View as plain text