...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal

     1  package portal
     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/preview/portal/mgmt/2019-01-01-preview/portal"
    20  
    21  // AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
    22  type AzureEntityResource struct {
    23  	// Etag - READ-ONLY; Resource Etag.
    24  	Etag *string `json:"etag,omitempty"`
    25  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
    26  	ID *string `json:"id,omitempty"`
    27  	// Name - READ-ONLY; The name of the resource
    28  	Name *string `json:"name,omitempty"`
    29  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
    30  	Type *string `json:"type,omitempty"`
    31  }
    32  
    33  // MarshalJSON is the custom marshaler for AzureEntityResource.
    34  func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
    35  	objectMap := make(map[string]interface{})
    36  	return json.Marshal(objectMap)
    37  }
    38  
    39  // Configuration tenant configuration.
    40  type Configuration struct {
    41  	autorest.Response `json:"-"`
    42  	// ConfigurationProperties - Tenant configuration properties.
    43  	*ConfigurationProperties `json:"properties,omitempty"`
    44  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
    45  	ID *string `json:"id,omitempty"`
    46  	// Name - READ-ONLY; The name of the resource
    47  	Name *string `json:"name,omitempty"`
    48  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
    49  	Type *string `json:"type,omitempty"`
    50  }
    51  
    52  // MarshalJSON is the custom marshaler for Configuration.
    53  func (c Configuration) MarshalJSON() ([]byte, error) {
    54  	objectMap := make(map[string]interface{})
    55  	if c.ConfigurationProperties != nil {
    56  		objectMap["properties"] = c.ConfigurationProperties
    57  	}
    58  	return json.Marshal(objectMap)
    59  }
    60  
    61  // UnmarshalJSON is the custom unmarshaler for Configuration struct.
    62  func (c *Configuration) UnmarshalJSON(body []byte) error {
    63  	var m map[string]*json.RawMessage
    64  	err := json.Unmarshal(body, &m)
    65  	if err != nil {
    66  		return err
    67  	}
    68  	for k, v := range m {
    69  		switch k {
    70  		case "properties":
    71  			if v != nil {
    72  				var configurationProperties ConfigurationProperties
    73  				err = json.Unmarshal(*v, &configurationProperties)
    74  				if err != nil {
    75  					return err
    76  				}
    77  				c.ConfigurationProperties = &configurationProperties
    78  			}
    79  		case "id":
    80  			if v != nil {
    81  				var ID string
    82  				err = json.Unmarshal(*v, &ID)
    83  				if err != nil {
    84  					return err
    85  				}
    86  				c.ID = &ID
    87  			}
    88  		case "name":
    89  			if v != nil {
    90  				var name string
    91  				err = json.Unmarshal(*v, &name)
    92  				if err != nil {
    93  					return err
    94  				}
    95  				c.Name = &name
    96  			}
    97  		case "type":
    98  			if v != nil {
    99  				var typeVar string
   100  				err = json.Unmarshal(*v, &typeVar)
   101  				if err != nil {
   102  					return err
   103  				}
   104  				c.Type = &typeVar
   105  			}
   106  		}
   107  	}
   108  
   109  	return nil
   110  }
   111  
   112  // ConfigurationList list of tenant configurations.
   113  type ConfigurationList struct {
   114  	autorest.Response `json:"-"`
   115  	// Value - The array of tenant configurations.
   116  	Value *[]Configuration `json:"value,omitempty"`
   117  	// NextLink - The URL to use for getting the next set of results.
   118  	NextLink *string `json:"nextLink,omitempty"`
   119  }
   120  
   121  // ConfigurationProperties tenant configuration properties.
   122  type ConfigurationProperties struct {
   123  	// EnforcePrivateMarkdownStorage - When flag is set to true Markdown tile will require external storage configuration (URI). The inline content configuration will be prohibited.
   124  	EnforcePrivateMarkdownStorage *bool `json:"enforcePrivateMarkdownStorage,omitempty"`
   125  }
   126  
   127  // Dashboard the shared dashboard resource definition.
   128  type Dashboard struct {
   129  	autorest.Response `json:"-"`
   130  	// DashboardProperties - The shared dashboard properties.
   131  	*DashboardProperties `json:"properties,omitempty"`
   132  	// ID - READ-ONLY; Resource Id
   133  	ID *string `json:"id,omitempty"`
   134  	// Name - READ-ONLY; Resource name
   135  	Name *string `json:"name,omitempty"`
   136  	// Type - READ-ONLY; Resource type
   137  	Type *string `json:"type,omitempty"`
   138  	// Location - Resource location
   139  	Location *string `json:"location,omitempty"`
   140  	// Tags - Resource tags
   141  	Tags map[string]*string `json:"tags"`
   142  }
   143  
   144  // MarshalJSON is the custom marshaler for Dashboard.
   145  func (d Dashboard) MarshalJSON() ([]byte, error) {
   146  	objectMap := make(map[string]interface{})
   147  	if d.DashboardProperties != nil {
   148  		objectMap["properties"] = d.DashboardProperties
   149  	}
   150  	if d.Location != nil {
   151  		objectMap["location"] = d.Location
   152  	}
   153  	if d.Tags != nil {
   154  		objectMap["tags"] = d.Tags
   155  	}
   156  	return json.Marshal(objectMap)
   157  }
   158  
   159  // UnmarshalJSON is the custom unmarshaler for Dashboard struct.
   160  func (d *Dashboard) UnmarshalJSON(body []byte) error {
   161  	var m map[string]*json.RawMessage
   162  	err := json.Unmarshal(body, &m)
   163  	if err != nil {
   164  		return err
   165  	}
   166  	for k, v := range m {
   167  		switch k {
   168  		case "properties":
   169  			if v != nil {
   170  				var dashboardProperties DashboardProperties
   171  				err = json.Unmarshal(*v, &dashboardProperties)
   172  				if err != nil {
   173  					return err
   174  				}
   175  				d.DashboardProperties = &dashboardProperties
   176  			}
   177  		case "id":
   178  			if v != nil {
   179  				var ID string
   180  				err = json.Unmarshal(*v, &ID)
   181  				if err != nil {
   182  					return err
   183  				}
   184  				d.ID = &ID
   185  			}
   186  		case "name":
   187  			if v != nil {
   188  				var name string
   189  				err = json.Unmarshal(*v, &name)
   190  				if err != nil {
   191  					return err
   192  				}
   193  				d.Name = &name
   194  			}
   195  		case "type":
   196  			if v != nil {
   197  				var typeVar string
   198  				err = json.Unmarshal(*v, &typeVar)
   199  				if err != nil {
   200  					return err
   201  				}
   202  				d.Type = &typeVar
   203  			}
   204  		case "location":
   205  			if v != nil {
   206  				var location string
   207  				err = json.Unmarshal(*v, &location)
   208  				if err != nil {
   209  					return err
   210  				}
   211  				d.Location = &location
   212  			}
   213  		case "tags":
   214  			if v != nil {
   215  				var tags map[string]*string
   216  				err = json.Unmarshal(*v, &tags)
   217  				if err != nil {
   218  					return err
   219  				}
   220  				d.Tags = tags
   221  			}
   222  		}
   223  	}
   224  
   225  	return nil
   226  }
   227  
   228  // DashboardLens a dashboard lens.
   229  type DashboardLens struct {
   230  	// Order - The lens order.
   231  	Order *int32 `json:"order,omitempty"`
   232  	// Parts - The dashboard parts.
   233  	Parts map[string]*DashboardParts `json:"parts"`
   234  	// Metadata - The dashboard len's metadata.
   235  	Metadata map[string]interface{} `json:"metadata"`
   236  }
   237  
   238  // MarshalJSON is the custom marshaler for DashboardLens.
   239  func (dl DashboardLens) MarshalJSON() ([]byte, error) {
   240  	objectMap := make(map[string]interface{})
   241  	if dl.Order != nil {
   242  		objectMap["order"] = dl.Order
   243  	}
   244  	if dl.Parts != nil {
   245  		objectMap["parts"] = dl.Parts
   246  	}
   247  	if dl.Metadata != nil {
   248  		objectMap["metadata"] = dl.Metadata
   249  	}
   250  	return json.Marshal(objectMap)
   251  }
   252  
   253  // DashboardListResult list of dashboards.
   254  type DashboardListResult struct {
   255  	autorest.Response `json:"-"`
   256  	// Value - The array of custom resource provider manifests.
   257  	Value *[]Dashboard `json:"value,omitempty"`
   258  	// NextLink - The URL to use for getting the next set of results.
   259  	NextLink *string `json:"nextLink,omitempty"`
   260  }
   261  
   262  // DashboardListResultIterator provides access to a complete listing of Dashboard values.
   263  type DashboardListResultIterator struct {
   264  	i    int
   265  	page DashboardListResultPage
   266  }
   267  
   268  // NextWithContext advances to the next value.  If there was an error making
   269  // the request the iterator does not advance and the error is returned.
   270  func (iter *DashboardListResultIterator) NextWithContext(ctx context.Context) (err error) {
   271  	if tracing.IsEnabled() {
   272  		ctx = tracing.StartSpan(ctx, fqdn+"/DashboardListResultIterator.NextWithContext")
   273  		defer func() {
   274  			sc := -1
   275  			if iter.Response().Response.Response != nil {
   276  				sc = iter.Response().Response.Response.StatusCode
   277  			}
   278  			tracing.EndSpan(ctx, sc, err)
   279  		}()
   280  	}
   281  	iter.i++
   282  	if iter.i < len(iter.page.Values()) {
   283  		return nil
   284  	}
   285  	err = iter.page.NextWithContext(ctx)
   286  	if err != nil {
   287  		iter.i--
   288  		return err
   289  	}
   290  	iter.i = 0
   291  	return nil
   292  }
   293  
   294  // Next advances to the next value.  If there was an error making
   295  // the request the iterator does not advance and the error is returned.
   296  // Deprecated: Use NextWithContext() instead.
   297  func (iter *DashboardListResultIterator) Next() error {
   298  	return iter.NextWithContext(context.Background())
   299  }
   300  
   301  // NotDone returns true if the enumeration should be started or is not yet complete.
   302  func (iter DashboardListResultIterator) NotDone() bool {
   303  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   304  }
   305  
   306  // Response returns the raw server response from the last page request.
   307  func (iter DashboardListResultIterator) Response() DashboardListResult {
   308  	return iter.page.Response()
   309  }
   310  
   311  // Value returns the current value or a zero-initialized value if the
   312  // iterator has advanced beyond the end of the collection.
   313  func (iter DashboardListResultIterator) Value() Dashboard {
   314  	if !iter.page.NotDone() {
   315  		return Dashboard{}
   316  	}
   317  	return iter.page.Values()[iter.i]
   318  }
   319  
   320  // Creates a new instance of the DashboardListResultIterator type.
   321  func NewDashboardListResultIterator(page DashboardListResultPage) DashboardListResultIterator {
   322  	return DashboardListResultIterator{page: page}
   323  }
   324  
   325  // IsEmpty returns true if the ListResult contains no values.
   326  func (dlr DashboardListResult) IsEmpty() bool {
   327  	return dlr.Value == nil || len(*dlr.Value) == 0
   328  }
   329  
   330  // hasNextLink returns true if the NextLink is not empty.
   331  func (dlr DashboardListResult) hasNextLink() bool {
   332  	return dlr.NextLink != nil && len(*dlr.NextLink) != 0
   333  }
   334  
   335  // dashboardListResultPreparer prepares a request to retrieve the next set of results.
   336  // It returns nil if no more results exist.
   337  func (dlr DashboardListResult) dashboardListResultPreparer(ctx context.Context) (*http.Request, error) {
   338  	if !dlr.hasNextLink() {
   339  		return nil, nil
   340  	}
   341  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   342  		autorest.AsJSON(),
   343  		autorest.AsGet(),
   344  		autorest.WithBaseURL(to.String(dlr.NextLink)))
   345  }
   346  
   347  // DashboardListResultPage contains a page of Dashboard values.
   348  type DashboardListResultPage struct {
   349  	fn  func(context.Context, DashboardListResult) (DashboardListResult, error)
   350  	dlr DashboardListResult
   351  }
   352  
   353  // NextWithContext advances to the next page of values.  If there was an error making
   354  // the request the page does not advance and the error is returned.
   355  func (page *DashboardListResultPage) NextWithContext(ctx context.Context) (err error) {
   356  	if tracing.IsEnabled() {
   357  		ctx = tracing.StartSpan(ctx, fqdn+"/DashboardListResultPage.NextWithContext")
   358  		defer func() {
   359  			sc := -1
   360  			if page.Response().Response.Response != nil {
   361  				sc = page.Response().Response.Response.StatusCode
   362  			}
   363  			tracing.EndSpan(ctx, sc, err)
   364  		}()
   365  	}
   366  	for {
   367  		next, err := page.fn(ctx, page.dlr)
   368  		if err != nil {
   369  			return err
   370  		}
   371  		page.dlr = next
   372  		if !next.hasNextLink() || !next.IsEmpty() {
   373  			break
   374  		}
   375  	}
   376  	return nil
   377  }
   378  
   379  // Next advances to the next page of values.  If there was an error making
   380  // the request the page does not advance and the error is returned.
   381  // Deprecated: Use NextWithContext() instead.
   382  func (page *DashboardListResultPage) Next() error {
   383  	return page.NextWithContext(context.Background())
   384  }
   385  
   386  // NotDone returns true if the page enumeration should be started or is not yet complete.
   387  func (page DashboardListResultPage) NotDone() bool {
   388  	return !page.dlr.IsEmpty()
   389  }
   390  
   391  // Response returns the raw server response from the last page request.
   392  func (page DashboardListResultPage) Response() DashboardListResult {
   393  	return page.dlr
   394  }
   395  
   396  // Values returns the slice of values for the current page or nil if there are no values.
   397  func (page DashboardListResultPage) Values() []Dashboard {
   398  	if page.dlr.IsEmpty() {
   399  		return nil
   400  	}
   401  	return *page.dlr.Value
   402  }
   403  
   404  // Creates a new instance of the DashboardListResultPage type.
   405  func NewDashboardListResultPage(cur DashboardListResult, getNextPage func(context.Context, DashboardListResult) (DashboardListResult, error)) DashboardListResultPage {
   406  	return DashboardListResultPage{
   407  		fn:  getNextPage,
   408  		dlr: cur,
   409  	}
   410  }
   411  
   412  // DashboardParts a dashboard part.
   413  type DashboardParts struct {
   414  	// Position - The dashboard's part position.
   415  	Position *DashboardPartsPosition `json:"position,omitempty"`
   416  	// Metadata - The dashboard part's metadata.
   417  	Metadata map[string]interface{} `json:"metadata"`
   418  }
   419  
   420  // MarshalJSON is the custom marshaler for DashboardParts.
   421  func (dp DashboardParts) MarshalJSON() ([]byte, error) {
   422  	objectMap := make(map[string]interface{})
   423  	if dp.Position != nil {
   424  		objectMap["position"] = dp.Position
   425  	}
   426  	if dp.Metadata != nil {
   427  		objectMap["metadata"] = dp.Metadata
   428  	}
   429  	return json.Marshal(objectMap)
   430  }
   431  
   432  // DashboardPartsPosition the dashboard's part position.
   433  type DashboardPartsPosition struct {
   434  	// X - The dashboard's part x coordinate.
   435  	X *int32 `json:"x,omitempty"`
   436  	// Y - The dashboard's part y coordinate.
   437  	Y *int32 `json:"y,omitempty"`
   438  	// RowSpan - The dashboard's part row span.
   439  	RowSpan *int32 `json:"rowSpan,omitempty"`
   440  	// ColSpan - The dashboard's part column span.
   441  	ColSpan *int32 `json:"colSpan,omitempty"`
   442  	// Metadata - The dashboard part's metadata.
   443  	Metadata map[string]interface{} `json:"metadata"`
   444  }
   445  
   446  // MarshalJSON is the custom marshaler for DashboardPartsPosition.
   447  func (dp DashboardPartsPosition) MarshalJSON() ([]byte, error) {
   448  	objectMap := make(map[string]interface{})
   449  	if dp.X != nil {
   450  		objectMap["x"] = dp.X
   451  	}
   452  	if dp.Y != nil {
   453  		objectMap["y"] = dp.Y
   454  	}
   455  	if dp.RowSpan != nil {
   456  		objectMap["rowSpan"] = dp.RowSpan
   457  	}
   458  	if dp.ColSpan != nil {
   459  		objectMap["colSpan"] = dp.ColSpan
   460  	}
   461  	if dp.Metadata != nil {
   462  		objectMap["metadata"] = dp.Metadata
   463  	}
   464  	return json.Marshal(objectMap)
   465  }
   466  
   467  // DashboardProperties the shared dashboard properties.
   468  type DashboardProperties struct {
   469  	// Lenses - The dashboard lenses.
   470  	Lenses map[string]*DashboardLens `json:"lenses"`
   471  	// Metadata - The dashboard metadata.
   472  	Metadata map[string]interface{} `json:"metadata"`
   473  }
   474  
   475  // MarshalJSON is the custom marshaler for DashboardProperties.
   476  func (dp DashboardProperties) MarshalJSON() ([]byte, error) {
   477  	objectMap := make(map[string]interface{})
   478  	if dp.Lenses != nil {
   479  		objectMap["lenses"] = dp.Lenses
   480  	}
   481  	if dp.Metadata != nil {
   482  		objectMap["metadata"] = dp.Metadata
   483  	}
   484  	return json.Marshal(objectMap)
   485  }
   486  
   487  // ErrorDefinition error definition.
   488  type ErrorDefinition struct {
   489  	// Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
   490  	Code *int32 `json:"code,omitempty"`
   491  	// Message - READ-ONLY; Description of the error.
   492  	Message *string `json:"message,omitempty"`
   493  	// Details - READ-ONLY; Internal error details.
   494  	Details *[]ErrorDefinition `json:"details,omitempty"`
   495  }
   496  
   497  // MarshalJSON is the custom marshaler for ErrorDefinition.
   498  func (ed ErrorDefinition) MarshalJSON() ([]byte, error) {
   499  	objectMap := make(map[string]interface{})
   500  	return json.Marshal(objectMap)
   501  }
   502  
   503  // ErrorResponse error response.
   504  type ErrorResponse struct {
   505  	// Error - The error details.
   506  	Error *ErrorDefinition `json:"error,omitempty"`
   507  }
   508  
   509  // PatchableDashboard the shared dashboard resource definition.
   510  type PatchableDashboard struct {
   511  	// DashboardProperties - The shared dashboard properties.
   512  	*DashboardProperties `json:"properties,omitempty"`
   513  	// Tags - Resource tags
   514  	Tags map[string]*string `json:"tags"`
   515  }
   516  
   517  // MarshalJSON is the custom marshaler for PatchableDashboard.
   518  func (pd PatchableDashboard) MarshalJSON() ([]byte, error) {
   519  	objectMap := make(map[string]interface{})
   520  	if pd.DashboardProperties != nil {
   521  		objectMap["properties"] = pd.DashboardProperties
   522  	}
   523  	if pd.Tags != nil {
   524  		objectMap["tags"] = pd.Tags
   525  	}
   526  	return json.Marshal(objectMap)
   527  }
   528  
   529  // UnmarshalJSON is the custom unmarshaler for PatchableDashboard struct.
   530  func (pd *PatchableDashboard) UnmarshalJSON(body []byte) error {
   531  	var m map[string]*json.RawMessage
   532  	err := json.Unmarshal(body, &m)
   533  	if err != nil {
   534  		return err
   535  	}
   536  	for k, v := range m {
   537  		switch k {
   538  		case "properties":
   539  			if v != nil {
   540  				var dashboardProperties DashboardProperties
   541  				err = json.Unmarshal(*v, &dashboardProperties)
   542  				if err != nil {
   543  					return err
   544  				}
   545  				pd.DashboardProperties = &dashboardProperties
   546  			}
   547  		case "tags":
   548  			if v != nil {
   549  				var tags map[string]*string
   550  				err = json.Unmarshal(*v, &tags)
   551  				if err != nil {
   552  					return err
   553  				}
   554  				pd.Tags = tags
   555  			}
   556  		}
   557  	}
   558  
   559  	return nil
   560  }
   561  
   562  // ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have
   563  // everything other than required location and tags
   564  type ProxyResource struct {
   565  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
   566  	ID *string `json:"id,omitempty"`
   567  	// Name - READ-ONLY; The name of the resource
   568  	Name *string `json:"name,omitempty"`
   569  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
   570  	Type *string `json:"type,omitempty"`
   571  }
   572  
   573  // MarshalJSON is the custom marshaler for ProxyResource.
   574  func (pr ProxyResource) MarshalJSON() ([]byte, error) {
   575  	objectMap := make(map[string]interface{})
   576  	return json.Marshal(objectMap)
   577  }
   578  
   579  // Resource common fields that are returned in the response for all Azure Resource Manager resources
   580  type Resource struct {
   581  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
   582  	ID *string `json:"id,omitempty"`
   583  	// Name - READ-ONLY; The name of the resource
   584  	Name *string `json:"name,omitempty"`
   585  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
   586  	Type *string `json:"type,omitempty"`
   587  }
   588  
   589  // MarshalJSON is the custom marshaler for Resource.
   590  func (r Resource) MarshalJSON() ([]byte, error) {
   591  	objectMap := make(map[string]interface{})
   592  	return json.Marshal(objectMap)
   593  }
   594  
   595  // ResourceProviderOperation supported operations of this resource provider.
   596  type ResourceProviderOperation struct {
   597  	// Name - Operation name, in format of {provider}/{resource}/{operation}
   598  	Name *string `json:"name,omitempty"`
   599  	// IsDataAction - Indicates whether the operation applies to data-plane.
   600  	IsDataAction *string `json:"isDataAction,omitempty"`
   601  	// Display - Display metadata associated with the operation.
   602  	Display *ResourceProviderOperationDisplay `json:"display,omitempty"`
   603  }
   604  
   605  // ResourceProviderOperationDisplay display metadata associated with the operation.
   606  type ResourceProviderOperationDisplay struct {
   607  	// Provider - Resource provider: Microsoft Custom Providers.
   608  	Provider *string `json:"provider,omitempty"`
   609  	// Resource - Resource on which the operation is performed.
   610  	Resource *string `json:"resource,omitempty"`
   611  	// Operation - Type of operation: get, read, delete, etc.
   612  	Operation *string `json:"operation,omitempty"`
   613  	// Description - Description of this operation.
   614  	Description *string `json:"description,omitempty"`
   615  }
   616  
   617  // ResourceProviderOperationList results of the request to list operations.
   618  type ResourceProviderOperationList struct {
   619  	autorest.Response `json:"-"`
   620  	// Value - List of operations supported by this resource provider.
   621  	Value *[]ResourceProviderOperation `json:"value,omitempty"`
   622  	// NextLink - The URL to use for getting the next set of results.
   623  	NextLink *string `json:"nextLink,omitempty"`
   624  }
   625  
   626  // ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation
   627  // values.
   628  type ResourceProviderOperationListIterator struct {
   629  	i    int
   630  	page ResourceProviderOperationListPage
   631  }
   632  
   633  // NextWithContext advances to the next value.  If there was an error making
   634  // the request the iterator does not advance and the error is returned.
   635  func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) {
   636  	if tracing.IsEnabled() {
   637  		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext")
   638  		defer func() {
   639  			sc := -1
   640  			if iter.Response().Response.Response != nil {
   641  				sc = iter.Response().Response.Response.StatusCode
   642  			}
   643  			tracing.EndSpan(ctx, sc, err)
   644  		}()
   645  	}
   646  	iter.i++
   647  	if iter.i < len(iter.page.Values()) {
   648  		return nil
   649  	}
   650  	err = iter.page.NextWithContext(ctx)
   651  	if err != nil {
   652  		iter.i--
   653  		return err
   654  	}
   655  	iter.i = 0
   656  	return nil
   657  }
   658  
   659  // Next advances to the next value.  If there was an error making
   660  // the request the iterator does not advance and the error is returned.
   661  // Deprecated: Use NextWithContext() instead.
   662  func (iter *ResourceProviderOperationListIterator) Next() error {
   663  	return iter.NextWithContext(context.Background())
   664  }
   665  
   666  // NotDone returns true if the enumeration should be started or is not yet complete.
   667  func (iter ResourceProviderOperationListIterator) NotDone() bool {
   668  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   669  }
   670  
   671  // Response returns the raw server response from the last page request.
   672  func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList {
   673  	return iter.page.Response()
   674  }
   675  
   676  // Value returns the current value or a zero-initialized value if the
   677  // iterator has advanced beyond the end of the collection.
   678  func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation {
   679  	if !iter.page.NotDone() {
   680  		return ResourceProviderOperation{}
   681  	}
   682  	return iter.page.Values()[iter.i]
   683  }
   684  
   685  // Creates a new instance of the ResourceProviderOperationListIterator type.
   686  func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator {
   687  	return ResourceProviderOperationListIterator{page: page}
   688  }
   689  
   690  // IsEmpty returns true if the ListResult contains no values.
   691  func (rpol ResourceProviderOperationList) IsEmpty() bool {
   692  	return rpol.Value == nil || len(*rpol.Value) == 0
   693  }
   694  
   695  // hasNextLink returns true if the NextLink is not empty.
   696  func (rpol ResourceProviderOperationList) hasNextLink() bool {
   697  	return rpol.NextLink != nil && len(*rpol.NextLink) != 0
   698  }
   699  
   700  // resourceProviderOperationListPreparer prepares a request to retrieve the next set of results.
   701  // It returns nil if no more results exist.
   702  func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) {
   703  	if !rpol.hasNextLink() {
   704  		return nil, nil
   705  	}
   706  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   707  		autorest.AsJSON(),
   708  		autorest.AsGet(),
   709  		autorest.WithBaseURL(to.String(rpol.NextLink)))
   710  }
   711  
   712  // ResourceProviderOperationListPage contains a page of ResourceProviderOperation values.
   713  type ResourceProviderOperationListPage struct {
   714  	fn   func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)
   715  	rpol ResourceProviderOperationList
   716  }
   717  
   718  // NextWithContext advances to the next page of values.  If there was an error making
   719  // the request the page does not advance and the error is returned.
   720  func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) {
   721  	if tracing.IsEnabled() {
   722  		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext")
   723  		defer func() {
   724  			sc := -1
   725  			if page.Response().Response.Response != nil {
   726  				sc = page.Response().Response.Response.StatusCode
   727  			}
   728  			tracing.EndSpan(ctx, sc, err)
   729  		}()
   730  	}
   731  	for {
   732  		next, err := page.fn(ctx, page.rpol)
   733  		if err != nil {
   734  			return err
   735  		}
   736  		page.rpol = next
   737  		if !next.hasNextLink() || !next.IsEmpty() {
   738  			break
   739  		}
   740  	}
   741  	return nil
   742  }
   743  
   744  // Next advances to the next page of values.  If there was an error making
   745  // the request the page does not advance and the error is returned.
   746  // Deprecated: Use NextWithContext() instead.
   747  func (page *ResourceProviderOperationListPage) Next() error {
   748  	return page.NextWithContext(context.Background())
   749  }
   750  
   751  // NotDone returns true if the page enumeration should be started or is not yet complete.
   752  func (page ResourceProviderOperationListPage) NotDone() bool {
   753  	return !page.rpol.IsEmpty()
   754  }
   755  
   756  // Response returns the raw server response from the last page request.
   757  func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList {
   758  	return page.rpol
   759  }
   760  
   761  // Values returns the slice of values for the current page or nil if there are no values.
   762  func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation {
   763  	if page.rpol.IsEmpty() {
   764  		return nil
   765  	}
   766  	return *page.rpol.Value
   767  }
   768  
   769  // Creates a new instance of the ResourceProviderOperationListPage type.
   770  func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage {
   771  	return ResourceProviderOperationListPage{
   772  		fn:   getNextPage,
   773  		rpol: cur,
   774  	}
   775  }
   776  
   777  // TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource
   778  type TrackedResource struct {
   779  	// Tags - Resource tags.
   780  	Tags map[string]*string `json:"tags"`
   781  	// Location - The geo-location where the resource lives
   782  	Location *string `json:"location,omitempty"`
   783  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
   784  	ID *string `json:"id,omitempty"`
   785  	// Name - READ-ONLY; The name of the resource
   786  	Name *string `json:"name,omitempty"`
   787  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
   788  	Type *string `json:"type,omitempty"`
   789  }
   790  
   791  // MarshalJSON is the custom marshaler for TrackedResource.
   792  func (tr TrackedResource) MarshalJSON() ([]byte, error) {
   793  	objectMap := make(map[string]interface{})
   794  	if tr.Tags != nil {
   795  		objectMap["tags"] = tr.Tags
   796  	}
   797  	if tr.Location != nil {
   798  		objectMap["location"] = tr.Location
   799  	}
   800  	return json.Marshal(objectMap)
   801  }
   802  

View as plain text