...

Source file src/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2015-12-01/features/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2015-12-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/to"
    13  	"github.com/Azure/go-autorest/tracing"
    14  	"net/http"
    15  )
    16  
    17  // The package's fully qualified name.
    18  const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2015-12-01/features"
    19  
    20  // Operation microsoft.Features operation
    21  type Operation struct {
    22  	// Name - Operation name: {provider}/{resource}/{operation}
    23  	Name *string `json:"name,omitempty"`
    24  	// Display - The object that represents the operation.
    25  	Display *OperationDisplay `json:"display,omitempty"`
    26  }
    27  
    28  // OperationDisplay the object that represents the operation.
    29  type OperationDisplay struct {
    30  	// Provider - Service provider: Microsoft.Features
    31  	Provider *string `json:"provider,omitempty"`
    32  	// Resource - Resource on which the operation is performed: Profile, endpoint, etc.
    33  	Resource *string `json:"resource,omitempty"`
    34  	// Operation - Operation type: Read, write, delete, etc.
    35  	Operation *string `json:"operation,omitempty"`
    36  }
    37  
    38  // OperationListResult result of the request to list Microsoft.Features operations. It contains a list of
    39  // operations and a URL link to get the next set of results.
    40  type OperationListResult struct {
    41  	autorest.Response `json:"-"`
    42  	// Value - List of Microsoft.Features operations.
    43  	Value *[]Operation `json:"value,omitempty"`
    44  	// NextLink - URL to get the next set of operation list results if there are any.
    45  	NextLink *string `json:"nextLink,omitempty"`
    46  }
    47  
    48  // OperationListResultIterator provides access to a complete listing of Operation values.
    49  type OperationListResultIterator struct {
    50  	i    int
    51  	page OperationListResultPage
    52  }
    53  
    54  // NextWithContext advances to the next value.  If there was an error making
    55  // the request the iterator does not advance and the error is returned.
    56  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
    57  	if tracing.IsEnabled() {
    58  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
    59  		defer func() {
    60  			sc := -1
    61  			if iter.Response().Response.Response != nil {
    62  				sc = iter.Response().Response.Response.StatusCode
    63  			}
    64  			tracing.EndSpan(ctx, sc, err)
    65  		}()
    66  	}
    67  	iter.i++
    68  	if iter.i < len(iter.page.Values()) {
    69  		return nil
    70  	}
    71  	err = iter.page.NextWithContext(ctx)
    72  	if err != nil {
    73  		iter.i--
    74  		return err
    75  	}
    76  	iter.i = 0
    77  	return nil
    78  }
    79  
    80  // Next advances to the next value.  If there was an error making
    81  // the request the iterator does not advance and the error is returned.
    82  // Deprecated: Use NextWithContext() instead.
    83  func (iter *OperationListResultIterator) Next() error {
    84  	return iter.NextWithContext(context.Background())
    85  }
    86  
    87  // NotDone returns true if the enumeration should be started or is not yet complete.
    88  func (iter OperationListResultIterator) NotDone() bool {
    89  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
    90  }
    91  
    92  // Response returns the raw server response from the last page request.
    93  func (iter OperationListResultIterator) Response() OperationListResult {
    94  	return iter.page.Response()
    95  }
    96  
    97  // Value returns the current value or a zero-initialized value if the
    98  // iterator has advanced beyond the end of the collection.
    99  func (iter OperationListResultIterator) Value() Operation {
   100  	if !iter.page.NotDone() {
   101  		return Operation{}
   102  	}
   103  	return iter.page.Values()[iter.i]
   104  }
   105  
   106  // Creates a new instance of the OperationListResultIterator type.
   107  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
   108  	return OperationListResultIterator{page: page}
   109  }
   110  
   111  // IsEmpty returns true if the ListResult contains no values.
   112  func (olr OperationListResult) IsEmpty() bool {
   113  	return olr.Value == nil || len(*olr.Value) == 0
   114  }
   115  
   116  // hasNextLink returns true if the NextLink is not empty.
   117  func (olr OperationListResult) hasNextLink() bool {
   118  	return olr.NextLink != nil && len(*olr.NextLink) != 0
   119  }
   120  
   121  // operationListResultPreparer prepares a request to retrieve the next set of results.
   122  // It returns nil if no more results exist.
   123  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
   124  	if !olr.hasNextLink() {
   125  		return nil, nil
   126  	}
   127  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   128  		autorest.AsJSON(),
   129  		autorest.AsGet(),
   130  		autorest.WithBaseURL(to.String(olr.NextLink)))
   131  }
   132  
   133  // OperationListResultPage contains a page of Operation values.
   134  type OperationListResultPage struct {
   135  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
   136  	olr OperationListResult
   137  }
   138  
   139  // NextWithContext advances to the next page of values.  If there was an error making
   140  // the request the page does not advance and the error is returned.
   141  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
   142  	if tracing.IsEnabled() {
   143  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
   144  		defer func() {
   145  			sc := -1
   146  			if page.Response().Response.Response != nil {
   147  				sc = page.Response().Response.Response.StatusCode
   148  			}
   149  			tracing.EndSpan(ctx, sc, err)
   150  		}()
   151  	}
   152  	for {
   153  		next, err := page.fn(ctx, page.olr)
   154  		if err != nil {
   155  			return err
   156  		}
   157  		page.olr = next
   158  		if !next.hasNextLink() || !next.IsEmpty() {
   159  			break
   160  		}
   161  	}
   162  	return nil
   163  }
   164  
   165  // Next advances to the next page of values.  If there was an error making
   166  // the request the page does not advance and the error is returned.
   167  // Deprecated: Use NextWithContext() instead.
   168  func (page *OperationListResultPage) Next() error {
   169  	return page.NextWithContext(context.Background())
   170  }
   171  
   172  // NotDone returns true if the page enumeration should be started or is not yet complete.
   173  func (page OperationListResultPage) NotDone() bool {
   174  	return !page.olr.IsEmpty()
   175  }
   176  
   177  // Response returns the raw server response from the last page request.
   178  func (page OperationListResultPage) Response() OperationListResult {
   179  	return page.olr
   180  }
   181  
   182  // Values returns the slice of values for the current page or nil if there are no values.
   183  func (page OperationListResultPage) Values() []Operation {
   184  	if page.olr.IsEmpty() {
   185  		return nil
   186  	}
   187  	return *page.olr.Value
   188  }
   189  
   190  // Creates a new instance of the OperationListResultPage type.
   191  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
   192  	return OperationListResultPage{
   193  		fn:  getNextPage,
   194  		olr: cur,
   195  	}
   196  }
   197  
   198  // OperationsListResult list of previewed features.
   199  type OperationsListResult struct {
   200  	autorest.Response `json:"-"`
   201  	// Value - The array of features.
   202  	Value *[]Result `json:"value,omitempty"`
   203  	// NextLink - The URL to use for getting the next set of results.
   204  	NextLink *string `json:"nextLink,omitempty"`
   205  }
   206  
   207  // OperationsListResultIterator provides access to a complete listing of Result values.
   208  type OperationsListResultIterator struct {
   209  	i    int
   210  	page OperationsListResultPage
   211  }
   212  
   213  // NextWithContext advances to the next value.  If there was an error making
   214  // the request the iterator does not advance and the error is returned.
   215  func (iter *OperationsListResultIterator) NextWithContext(ctx context.Context) (err error) {
   216  	if tracing.IsEnabled() {
   217  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultIterator.NextWithContext")
   218  		defer func() {
   219  			sc := -1
   220  			if iter.Response().Response.Response != nil {
   221  				sc = iter.Response().Response.Response.StatusCode
   222  			}
   223  			tracing.EndSpan(ctx, sc, err)
   224  		}()
   225  	}
   226  	iter.i++
   227  	if iter.i < len(iter.page.Values()) {
   228  		return nil
   229  	}
   230  	err = iter.page.NextWithContext(ctx)
   231  	if err != nil {
   232  		iter.i--
   233  		return err
   234  	}
   235  	iter.i = 0
   236  	return nil
   237  }
   238  
   239  // Next advances to the next value.  If there was an error making
   240  // the request the iterator does not advance and the error is returned.
   241  // Deprecated: Use NextWithContext() instead.
   242  func (iter *OperationsListResultIterator) Next() error {
   243  	return iter.NextWithContext(context.Background())
   244  }
   245  
   246  // NotDone returns true if the enumeration should be started or is not yet complete.
   247  func (iter OperationsListResultIterator) NotDone() bool {
   248  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   249  }
   250  
   251  // Response returns the raw server response from the last page request.
   252  func (iter OperationsListResultIterator) Response() OperationsListResult {
   253  	return iter.page.Response()
   254  }
   255  
   256  // Value returns the current value or a zero-initialized value if the
   257  // iterator has advanced beyond the end of the collection.
   258  func (iter OperationsListResultIterator) Value() Result {
   259  	if !iter.page.NotDone() {
   260  		return Result{}
   261  	}
   262  	return iter.page.Values()[iter.i]
   263  }
   264  
   265  // Creates a new instance of the OperationsListResultIterator type.
   266  func NewOperationsListResultIterator(page OperationsListResultPage) OperationsListResultIterator {
   267  	return OperationsListResultIterator{page: page}
   268  }
   269  
   270  // IsEmpty returns true if the ListResult contains no values.
   271  func (olr OperationsListResult) IsEmpty() bool {
   272  	return olr.Value == nil || len(*olr.Value) == 0
   273  }
   274  
   275  // hasNextLink returns true if the NextLink is not empty.
   276  func (olr OperationsListResult) hasNextLink() bool {
   277  	return olr.NextLink != nil && len(*olr.NextLink) != 0
   278  }
   279  
   280  // operationsListResultPreparer prepares a request to retrieve the next set of results.
   281  // It returns nil if no more results exist.
   282  func (olr OperationsListResult) operationsListResultPreparer(ctx context.Context) (*http.Request, error) {
   283  	if !olr.hasNextLink() {
   284  		return nil, nil
   285  	}
   286  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   287  		autorest.AsJSON(),
   288  		autorest.AsGet(),
   289  		autorest.WithBaseURL(to.String(olr.NextLink)))
   290  }
   291  
   292  // OperationsListResultPage contains a page of Result values.
   293  type OperationsListResultPage struct {
   294  	fn  func(context.Context, OperationsListResult) (OperationsListResult, error)
   295  	olr OperationsListResult
   296  }
   297  
   298  // NextWithContext advances to the next page of values.  If there was an error making
   299  // the request the page does not advance and the error is returned.
   300  func (page *OperationsListResultPage) NextWithContext(ctx context.Context) (err error) {
   301  	if tracing.IsEnabled() {
   302  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultPage.NextWithContext")
   303  		defer func() {
   304  			sc := -1
   305  			if page.Response().Response.Response != nil {
   306  				sc = page.Response().Response.Response.StatusCode
   307  			}
   308  			tracing.EndSpan(ctx, sc, err)
   309  		}()
   310  	}
   311  	for {
   312  		next, err := page.fn(ctx, page.olr)
   313  		if err != nil {
   314  			return err
   315  		}
   316  		page.olr = next
   317  		if !next.hasNextLink() || !next.IsEmpty() {
   318  			break
   319  		}
   320  	}
   321  	return nil
   322  }
   323  
   324  // Next advances to the next page of values.  If there was an error making
   325  // the request the page does not advance and the error is returned.
   326  // Deprecated: Use NextWithContext() instead.
   327  func (page *OperationsListResultPage) Next() error {
   328  	return page.NextWithContext(context.Background())
   329  }
   330  
   331  // NotDone returns true if the page enumeration should be started or is not yet complete.
   332  func (page OperationsListResultPage) NotDone() bool {
   333  	return !page.olr.IsEmpty()
   334  }
   335  
   336  // Response returns the raw server response from the last page request.
   337  func (page OperationsListResultPage) Response() OperationsListResult {
   338  	return page.olr
   339  }
   340  
   341  // Values returns the slice of values for the current page or nil if there are no values.
   342  func (page OperationsListResultPage) Values() []Result {
   343  	if page.olr.IsEmpty() {
   344  		return nil
   345  	}
   346  	return *page.olr.Value
   347  }
   348  
   349  // Creates a new instance of the OperationsListResultPage type.
   350  func NewOperationsListResultPage(cur OperationsListResult, getNextPage func(context.Context, OperationsListResult) (OperationsListResult, error)) OperationsListResultPage {
   351  	return OperationsListResultPage{
   352  		fn:  getNextPage,
   353  		olr: cur,
   354  	}
   355  }
   356  
   357  // Properties information about feature.
   358  type Properties struct {
   359  	// State - The registration state of the feature for the subscription.
   360  	State *string `json:"state,omitempty"`
   361  }
   362  
   363  // Result previewed feature information.
   364  type Result struct {
   365  	autorest.Response `json:"-"`
   366  	// Name - The name of the feature.
   367  	Name *string `json:"name,omitempty"`
   368  	// Properties - Properties of the previewed feature.
   369  	Properties *Properties `json:"properties,omitempty"`
   370  	// ID - The resource ID of the feature.
   371  	ID *string `json:"id,omitempty"`
   372  	// Type - The resource type of the feature.
   373  	Type *string `json:"type,omitempty"`
   374  }
   375  

View as plain text