1package storagecache
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/date"
26	"github.com/Azure/go-autorest/autorest/to"
27	"github.com/Azure/go-autorest/tracing"
28	"net/http"
29)
30
31// The package's fully qualified name.
32const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/storagecache/mgmt/2019-08-01-preview/storagecache"
33
34// APIOperation REST API operation description: see
35// https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation
36type APIOperation struct {
37	// Display - The object that represents the operation.
38	Display *APIOperationDisplay `json:"display,omitempty"`
39	// Name - Operation name: {provider}/{resource}/{operation}
40	Name *string `json:"name,omitempty"`
41}
42
43// APIOperationDisplay the object that represents the operation.
44type APIOperationDisplay struct {
45	// Operation - Operation type: Read, write, delete, etc.
46	Operation *string `json:"operation,omitempty"`
47	// Provider - Service provider: Microsoft.StorageCache
48	Provider *string `json:"provider,omitempty"`
49	// Resource - Resource on which the operation is performed: cache, etc.
50	Resource *string `json:"resource,omitempty"`
51}
52
53// APIOperationListResult result of the request to list Resource Provider operations. It contains a list of
54// operations and a URL link to get the next set of results.
55type APIOperationListResult struct {
56	autorest.Response `json:"-"`
57	// NextLink - URL to get the next set of operation list results if there are any.
58	NextLink *string `json:"nextLink,omitempty"`
59	// Value - List of Resource Provider operations supported by the Microsoft.StorageCache resource provider.
60	Value *[]APIOperation `json:"value,omitempty"`
61}
62
63// APIOperationListResultIterator provides access to a complete listing of APIOperation values.
64type APIOperationListResultIterator struct {
65	i    int
66	page APIOperationListResultPage
67}
68
69// NextWithContext advances to the next value.  If there was an error making
70// the request the iterator does not advance and the error is returned.
71func (iter *APIOperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
72	if tracing.IsEnabled() {
73		ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultIterator.NextWithContext")
74		defer func() {
75			sc := -1
76			if iter.Response().Response.Response != nil {
77				sc = iter.Response().Response.Response.StatusCode
78			}
79			tracing.EndSpan(ctx, sc, err)
80		}()
81	}
82	iter.i++
83	if iter.i < len(iter.page.Values()) {
84		return nil
85	}
86	err = iter.page.NextWithContext(ctx)
87	if err != nil {
88		iter.i--
89		return err
90	}
91	iter.i = 0
92	return nil
93}
94
95// Next advances to the next value.  If there was an error making
96// the request the iterator does not advance and the error is returned.
97// Deprecated: Use NextWithContext() instead.
98func (iter *APIOperationListResultIterator) Next() error {
99	return iter.NextWithContext(context.Background())
100}
101
102// NotDone returns true if the enumeration should be started or is not yet complete.
103func (iter APIOperationListResultIterator) NotDone() bool {
104	return iter.page.NotDone() && iter.i < len(iter.page.Values())
105}
106
107// Response returns the raw server response from the last page request.
108func (iter APIOperationListResultIterator) Response() APIOperationListResult {
109	return iter.page.Response()
110}
111
112// Value returns the current value or a zero-initialized value if the
113// iterator has advanced beyond the end of the collection.
114func (iter APIOperationListResultIterator) Value() APIOperation {
115	if !iter.page.NotDone() {
116		return APIOperation{}
117	}
118	return iter.page.Values()[iter.i]
119}
120
121// Creates a new instance of the APIOperationListResultIterator type.
122func NewAPIOperationListResultIterator(page APIOperationListResultPage) APIOperationListResultIterator {
123	return APIOperationListResultIterator{page: page}
124}
125
126// IsEmpty returns true if the ListResult contains no values.
127func (aolr APIOperationListResult) IsEmpty() bool {
128	return aolr.Value == nil || len(*aolr.Value) == 0
129}
130
131// hasNextLink returns true if the NextLink is not empty.
132func (aolr APIOperationListResult) hasNextLink() bool {
133	return aolr.NextLink != nil && len(*aolr.NextLink) != 0
134}
135
136// aPIOperationListResultPreparer prepares a request to retrieve the next set of results.
137// It returns nil if no more results exist.
138func (aolr APIOperationListResult) aPIOperationListResultPreparer(ctx context.Context) (*http.Request, error) {
139	if !aolr.hasNextLink() {
140		return nil, nil
141	}
142	return autorest.Prepare((&http.Request{}).WithContext(ctx),
143		autorest.AsJSON(),
144		autorest.AsGet(),
145		autorest.WithBaseURL(to.String(aolr.NextLink)))
146}
147
148// APIOperationListResultPage contains a page of APIOperation values.
149type APIOperationListResultPage struct {
150	fn   func(context.Context, APIOperationListResult) (APIOperationListResult, error)
151	aolr APIOperationListResult
152}
153
154// NextWithContext advances to the next page of values.  If there was an error making
155// the request the page does not advance and the error is returned.
156func (page *APIOperationListResultPage) NextWithContext(ctx context.Context) (err error) {
157	if tracing.IsEnabled() {
158		ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultPage.NextWithContext")
159		defer func() {
160			sc := -1
161			if page.Response().Response.Response != nil {
162				sc = page.Response().Response.Response.StatusCode
163			}
164			tracing.EndSpan(ctx, sc, err)
165		}()
166	}
167	for {
168		next, err := page.fn(ctx, page.aolr)
169		if err != nil {
170			return err
171		}
172		page.aolr = next
173		if !next.hasNextLink() || !next.IsEmpty() {
174			break
175		}
176	}
177	return nil
178}
179
180// Next advances to the next page of values.  If there was an error making
181// the request the page does not advance and the error is returned.
182// Deprecated: Use NextWithContext() instead.
183func (page *APIOperationListResultPage) Next() error {
184	return page.NextWithContext(context.Background())
185}
186
187// NotDone returns true if the page enumeration should be started or is not yet complete.
188func (page APIOperationListResultPage) NotDone() bool {
189	return !page.aolr.IsEmpty()
190}
191
192// Response returns the raw server response from the last page request.
193func (page APIOperationListResultPage) Response() APIOperationListResult {
194	return page.aolr
195}
196
197// Values returns the slice of values for the current page or nil if there are no values.
198func (page APIOperationListResultPage) Values() []APIOperation {
199	if page.aolr.IsEmpty() {
200		return nil
201	}
202	return *page.aolr.Value
203}
204
205// Creates a new instance of the APIOperationListResultPage type.
206func NewAPIOperationListResultPage(cur APIOperationListResult, getNextPage func(context.Context, APIOperationListResult) (APIOperationListResult, error)) APIOperationListResultPage {
207	return APIOperationListResultPage{
208		fn:   getNextPage,
209		aolr: cur,
210	}
211}
212
213// Cache a cache instance.  Follows Azure Resource Manager standards:
214// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md
215type Cache struct {
216	autorest.Response `json:"-"`
217	// Tags - ARM tags as name/value pairs.
218	Tags interface{} `json:"tags,omitempty"`
219	// ID - READ-ONLY; Fully qualified URL of the cache.
220	ID *string `json:"id,omitempty"`
221	// Location - Region name string.
222	Location *string `json:"location,omitempty"`
223	// Name - READ-ONLY; Name of cache.
224	Name *string `json:"name,omitempty"`
225	// Type - READ-ONLY; Type for the cache; Microsoft.StorageCache/Cache
226	Type *string `json:"type,omitempty"`
227	// CacheProperties - Properties for the cache.
228	*CacheProperties `json:"properties,omitempty"`
229	// Sku - Sku for the cache.
230	Sku *CacheSku `json:"sku,omitempty"`
231}
232
233// MarshalJSON is the custom marshaler for Cache.
234func (c Cache) MarshalJSON() ([]byte, error) {
235	objectMap := make(map[string]interface{})
236	if c.Tags != nil {
237		objectMap["tags"] = c.Tags
238	}
239	if c.Location != nil {
240		objectMap["location"] = c.Location
241	}
242	if c.CacheProperties != nil {
243		objectMap["properties"] = c.CacheProperties
244	}
245	if c.Sku != nil {
246		objectMap["sku"] = c.Sku
247	}
248	return json.Marshal(objectMap)
249}
250
251// UnmarshalJSON is the custom unmarshaler for Cache struct.
252func (c *Cache) UnmarshalJSON(body []byte) error {
253	var m map[string]*json.RawMessage
254	err := json.Unmarshal(body, &m)
255	if err != nil {
256		return err
257	}
258	for k, v := range m {
259		switch k {
260		case "tags":
261			if v != nil {
262				var tags interface{}
263				err = json.Unmarshal(*v, &tags)
264				if err != nil {
265					return err
266				}
267				c.Tags = tags
268			}
269		case "id":
270			if v != nil {
271				var ID string
272				err = json.Unmarshal(*v, &ID)
273				if err != nil {
274					return err
275				}
276				c.ID = &ID
277			}
278		case "location":
279			if v != nil {
280				var location string
281				err = json.Unmarshal(*v, &location)
282				if err != nil {
283					return err
284				}
285				c.Location = &location
286			}
287		case "name":
288			if v != nil {
289				var name string
290				err = json.Unmarshal(*v, &name)
291				if err != nil {
292					return err
293				}
294				c.Name = &name
295			}
296		case "type":
297			if v != nil {
298				var typeVar string
299				err = json.Unmarshal(*v, &typeVar)
300				if err != nil {
301					return err
302				}
303				c.Type = &typeVar
304			}
305		case "properties":
306			if v != nil {
307				var cacheProperties CacheProperties
308				err = json.Unmarshal(*v, &cacheProperties)
309				if err != nil {
310					return err
311				}
312				c.CacheProperties = &cacheProperties
313			}
314		case "sku":
315			if v != nil {
316				var sku CacheSku
317				err = json.Unmarshal(*v, &sku)
318				if err != nil {
319					return err
320				}
321				c.Sku = &sku
322			}
323		}
324	}
325
326	return nil
327}
328
329// CacheHealth an indication of cache health.  Gives more information about health than just that related
330// to provisioning.
331type CacheHealth struct {
332	// State - List of cache health states. Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', 'Stopped', 'Upgrading', 'Flushing'
333	State HealthStateType `json:"state,omitempty"`
334	// StatusDescription - Describes explanation of state.
335	StatusDescription *string `json:"statusDescription,omitempty"`
336}
337
338// CacheProperties properties for the cache.
339type CacheProperties struct {
340	// CacheSizeGB - The size of this cache's cache, in GB.
341	CacheSizeGB *int32 `json:"cacheSizeGB,omitempty"`
342	// Health - READ-ONLY; Health of the cache.
343	Health *CacheHealth `json:"health,omitempty"`
344	// MountAddresses - READ-ONLY; Array of IP addresses that can be used by clients mounting this Cache.
345	MountAddresses *[]string `json:"mountAddresses,omitempty"`
346	// ProvisioningState - ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating'
347	ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
348	// Subnet - Subnet used for the cache.
349	Subnet *string `json:"subnet,omitempty"`
350	// UpgradeStatus - Upgrade status of the cache.
351	UpgradeStatus *CacheUpgradeStatus `json:"upgradeStatus,omitempty"`
352}
353
354// MarshalJSON is the custom marshaler for CacheProperties.
355func (c CacheProperties) MarshalJSON() ([]byte, error) {
356	objectMap := make(map[string]interface{})
357	if c.CacheSizeGB != nil {
358		objectMap["cacheSizeGB"] = c.CacheSizeGB
359	}
360	if c.ProvisioningState != "" {
361		objectMap["provisioningState"] = c.ProvisioningState
362	}
363	if c.Subnet != nil {
364		objectMap["subnet"] = c.Subnet
365	}
366	if c.UpgradeStatus != nil {
367		objectMap["upgradeStatus"] = c.UpgradeStatus
368	}
369	return json.Marshal(objectMap)
370}
371
372// CachesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
373type CachesCreateFuture struct {
374	azure.FutureAPI
375	// Result returns the result of the asynchronous operation.
376	// If the operation has not completed it will return an error.
377	Result func(CachesClient) (Cache, error)
378}
379
380// CachesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
381type CachesDeleteFuture struct {
382	azure.FutureAPI
383	// Result returns the result of the asynchronous operation.
384	// If the operation has not completed it will return an error.
385	Result func(CachesClient) (SetObject, error)
386}
387
388// CachesFlushFuture an abstraction for monitoring and retrieving the results of a long-running operation.
389type CachesFlushFuture struct {
390	azure.FutureAPI
391	// Result returns the result of the asynchronous operation.
392	// If the operation has not completed it will return an error.
393	Result func(CachesClient) (SetObject, error)
394}
395
396// CacheSku sku for the cache.
397type CacheSku struct {
398	// Name - Sku name for this cache.
399	Name *string `json:"name,omitempty"`
400}
401
402// CachesListResult result of the request to list caches. It contains a list of caches and a URL link to
403// get the next set of results.
404type CachesListResult struct {
405	autorest.Response `json:"-"`
406	// NextLink - URL to get the next set of cache list results if there are any.
407	NextLink *string `json:"nextLink,omitempty"`
408	// Value - List of caches.
409	Value *[]Cache `json:"value,omitempty"`
410}
411
412// CachesListResultIterator provides access to a complete listing of Cache values.
413type CachesListResultIterator struct {
414	i    int
415	page CachesListResultPage
416}
417
418// NextWithContext advances to the next value.  If there was an error making
419// the request the iterator does not advance and the error is returned.
420func (iter *CachesListResultIterator) NextWithContext(ctx context.Context) (err error) {
421	if tracing.IsEnabled() {
422		ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultIterator.NextWithContext")
423		defer func() {
424			sc := -1
425			if iter.Response().Response.Response != nil {
426				sc = iter.Response().Response.Response.StatusCode
427			}
428			tracing.EndSpan(ctx, sc, err)
429		}()
430	}
431	iter.i++
432	if iter.i < len(iter.page.Values()) {
433		return nil
434	}
435	err = iter.page.NextWithContext(ctx)
436	if err != nil {
437		iter.i--
438		return err
439	}
440	iter.i = 0
441	return nil
442}
443
444// Next advances to the next value.  If there was an error making
445// the request the iterator does not advance and the error is returned.
446// Deprecated: Use NextWithContext() instead.
447func (iter *CachesListResultIterator) Next() error {
448	return iter.NextWithContext(context.Background())
449}
450
451// NotDone returns true if the enumeration should be started or is not yet complete.
452func (iter CachesListResultIterator) NotDone() bool {
453	return iter.page.NotDone() && iter.i < len(iter.page.Values())
454}
455
456// Response returns the raw server response from the last page request.
457func (iter CachesListResultIterator) Response() CachesListResult {
458	return iter.page.Response()
459}
460
461// Value returns the current value or a zero-initialized value if the
462// iterator has advanced beyond the end of the collection.
463func (iter CachesListResultIterator) Value() Cache {
464	if !iter.page.NotDone() {
465		return Cache{}
466	}
467	return iter.page.Values()[iter.i]
468}
469
470// Creates a new instance of the CachesListResultIterator type.
471func NewCachesListResultIterator(page CachesListResultPage) CachesListResultIterator {
472	return CachesListResultIterator{page: page}
473}
474
475// IsEmpty returns true if the ListResult contains no values.
476func (clr CachesListResult) IsEmpty() bool {
477	return clr.Value == nil || len(*clr.Value) == 0
478}
479
480// hasNextLink returns true if the NextLink is not empty.
481func (clr CachesListResult) hasNextLink() bool {
482	return clr.NextLink != nil && len(*clr.NextLink) != 0
483}
484
485// cachesListResultPreparer prepares a request to retrieve the next set of results.
486// It returns nil if no more results exist.
487func (clr CachesListResult) cachesListResultPreparer(ctx context.Context) (*http.Request, error) {
488	if !clr.hasNextLink() {
489		return nil, nil
490	}
491	return autorest.Prepare((&http.Request{}).WithContext(ctx),
492		autorest.AsJSON(),
493		autorest.AsGet(),
494		autorest.WithBaseURL(to.String(clr.NextLink)))
495}
496
497// CachesListResultPage contains a page of Cache values.
498type CachesListResultPage struct {
499	fn  func(context.Context, CachesListResult) (CachesListResult, error)
500	clr CachesListResult
501}
502
503// NextWithContext advances to the next page of values.  If there was an error making
504// the request the page does not advance and the error is returned.
505func (page *CachesListResultPage) NextWithContext(ctx context.Context) (err error) {
506	if tracing.IsEnabled() {
507		ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultPage.NextWithContext")
508		defer func() {
509			sc := -1
510			if page.Response().Response.Response != nil {
511				sc = page.Response().Response.Response.StatusCode
512			}
513			tracing.EndSpan(ctx, sc, err)
514		}()
515	}
516	for {
517		next, err := page.fn(ctx, page.clr)
518		if err != nil {
519			return err
520		}
521		page.clr = next
522		if !next.hasNextLink() || !next.IsEmpty() {
523			break
524		}
525	}
526	return nil
527}
528
529// Next advances to the next page of values.  If there was an error making
530// the request the page does not advance and the error is returned.
531// Deprecated: Use NextWithContext() instead.
532func (page *CachesListResultPage) Next() error {
533	return page.NextWithContext(context.Background())
534}
535
536// NotDone returns true if the page enumeration should be started or is not yet complete.
537func (page CachesListResultPage) NotDone() bool {
538	return !page.clr.IsEmpty()
539}
540
541// Response returns the raw server response from the last page request.
542func (page CachesListResultPage) Response() CachesListResult {
543	return page.clr
544}
545
546// Values returns the slice of values for the current page or nil if there are no values.
547func (page CachesListResultPage) Values() []Cache {
548	if page.clr.IsEmpty() {
549		return nil
550	}
551	return *page.clr.Value
552}
553
554// Creates a new instance of the CachesListResultPage type.
555func NewCachesListResultPage(cur CachesListResult, getNextPage func(context.Context, CachesListResult) (CachesListResult, error)) CachesListResultPage {
556	return CachesListResultPage{
557		fn:  getNextPage,
558		clr: cur,
559	}
560}
561
562// CachesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
563type CachesStartFuture struct {
564	azure.FutureAPI
565	// Result returns the result of the asynchronous operation.
566	// If the operation has not completed it will return an error.
567	Result func(CachesClient) (SetObject, error)
568}
569
570// CachesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
571type CachesStopFuture struct {
572	azure.FutureAPI
573	// Result returns the result of the asynchronous operation.
574	// If the operation has not completed it will return an error.
575	Result func(CachesClient) (SetObject, error)
576}
577
578// CachesUpgradeFirmwareFuture an abstraction for monitoring and retrieving the results of a long-running
579// operation.
580type CachesUpgradeFirmwareFuture struct {
581	azure.FutureAPI
582	// Result returns the result of the asynchronous operation.
583	// If the operation has not completed it will return an error.
584	Result func(CachesClient) (SetObject, error)
585}
586
587// CacheUpgradeStatus properties describing the software upgrade state of the cache
588type CacheUpgradeStatus struct {
589	// CurrentFirmwareVersion - READ-ONLY; Version string of the firmware currently installed on this cache.
590	CurrentFirmwareVersion *string `json:"currentFirmwareVersion,omitempty"`
591	// FirmwareUpdateStatus - READ-ONLY; True if there is a firmware update ready to install on this cache.  The firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade operation. Possible values include: 'Available', 'Unavailable'
592	FirmwareUpdateStatus FirmwareStatusType `json:"firmwareUpdateStatus,omitempty"`
593	// FirmwareUpdateDeadline - READ-ONLY; Time at which the pending firmware update will automatically be installed on the cache.
594	FirmwareUpdateDeadline *date.Time `json:"firmwareUpdateDeadline,omitempty"`
595	// LastFirmwareUpdate - READ-ONLY; Time of the last successful firmware update.
596	LastFirmwareUpdate *date.Time `json:"lastFirmwareUpdate,omitempty"`
597	// PendingFirmwareVersion - READ-ONLY; When firmwareUpdateAvailable is true, this field holds the version string for the update.
598	PendingFirmwareVersion *string `json:"pendingFirmwareVersion,omitempty"`
599}
600
601// ClfsTarget storage container for use as a CLFS StorageTarget.
602type ClfsTarget struct {
603	// Target - URL of storage container.
604	Target *string `json:"target,omitempty"`
605}
606
607// CloudError an error response.
608type CloudError struct {
609	// Error - The body of the error.
610	Error *CloudErrorBody `json:"error,omitempty"`
611}
612
613// CloudErrorBody an error response.
614type CloudErrorBody struct {
615	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
616	Code *string `json:"code,omitempty"`
617	// Details - A list of additional details about the error.
618	Details *[]CloudErrorBody `json:"details,omitempty"`
619	// Message - A message describing the error, intended to be suitable for display in a user interface.
620	Message *string `json:"message,omitempty"`
621	// Target - The target of the particular error. For example, the name of the property in error.
622	Target *string `json:"target,omitempty"`
623}
624
625// NamespaceJunction a namespace junction.
626type NamespaceJunction struct {
627	// NamespacePath - Namespace path on a cache for a storage target.
628	NamespacePath *string `json:"namespacePath,omitempty"`
629	// TargetPath - Path in storage target to which namespacePath points.
630	TargetPath *string `json:"targetPath,omitempty"`
631	// NfsExport - NFS export where targetPath exists.
632	NfsExport *string `json:"nfsExport,omitempty"`
633}
634
635// Nfs3Target an NFS mount point for use as a StorageTarget.
636type Nfs3Target struct {
637	// Target - IP or name of an NFS Storage Target host, ie: 10.0.44.44
638	Target *string `json:"target,omitempty"`
639	// UsageModel - Identifies the primary usage model to be used for this storage target.   GET choices from .../usageModels
640	UsageModel *string `json:"usageModel,omitempty"`
641}
642
643// ResourceSku a resource SKU
644type ResourceSku struct {
645	// ResourceType - READ-ONLY; The type of resource the sku applies to.
646	ResourceType *string `json:"resourceType,omitempty"`
647	// Capabilities - A list of capabilities of this SKU, such as throughput or ops/sec
648	Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"`
649	// Locations - READ-ONLY; The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.).
650	Locations *[]string `json:"locations,omitempty"`
651	// LocationInfo - The set of locations that the SKU is available.
652	LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"`
653	// Name - The name of this sku.
654	Name *string `json:"name,omitempty"`
655	// Restrictions - The restrictions because of which SKU cannot be used. This is empty if there are no restrictions.
656	Restrictions *[]Restriction `json:"restrictions,omitempty"`
657}
658
659// MarshalJSON is the custom marshaler for ResourceSku.
660func (rs ResourceSku) MarshalJSON() ([]byte, error) {
661	objectMap := make(map[string]interface{})
662	if rs.Capabilities != nil {
663		objectMap["capabilities"] = rs.Capabilities
664	}
665	if rs.LocationInfo != nil {
666		objectMap["locationInfo"] = rs.LocationInfo
667	}
668	if rs.Name != nil {
669		objectMap["name"] = rs.Name
670	}
671	if rs.Restrictions != nil {
672		objectMap["restrictions"] = rs.Restrictions
673	}
674	return json.Marshal(objectMap)
675}
676
677// ResourceSkuCapabilities a resource SKU capability.
678type ResourceSkuCapabilities struct {
679	// Name - Name of a capability, such as ops/sec
680	Name *string `json:"name,omitempty"`
681	// Value - Quantity, if the capability is measured by quantity
682	Value *string `json:"value,omitempty"`
683}
684
685// ResourceSkuLocationInfo resource SKU location information.
686type ResourceSkuLocationInfo struct {
687	// Location - Location where this Sku is available
688	Location *string `json:"location,omitempty"`
689	// Zones - Zones if any.
690	Zones *[]string `json:"zones,omitempty"`
691}
692
693// ResourceSkusResult the response from the List Cache SKUs operation.
694type ResourceSkusResult struct {
695	autorest.Response `json:"-"`
696	// NextLink - The uri to fetch the next page of cache Skus.
697	NextLink *string `json:"nextLink,omitempty"`
698	// Value - READ-ONLY; The list of skus available for the subscription.
699	Value *[]ResourceSku `json:"value,omitempty"`
700}
701
702// MarshalJSON is the custom marshaler for ResourceSkusResult.
703func (rsr ResourceSkusResult) MarshalJSON() ([]byte, error) {
704	objectMap := make(map[string]interface{})
705	if rsr.NextLink != nil {
706		objectMap["nextLink"] = rsr.NextLink
707	}
708	return json.Marshal(objectMap)
709}
710
711// ResourceSkusResultIterator provides access to a complete listing of ResourceSku values.
712type ResourceSkusResultIterator struct {
713	i    int
714	page ResourceSkusResultPage
715}
716
717// NextWithContext advances to the next value.  If there was an error making
718// the request the iterator does not advance and the error is returned.
719func (iter *ResourceSkusResultIterator) NextWithContext(ctx context.Context) (err error) {
720	if tracing.IsEnabled() {
721		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultIterator.NextWithContext")
722		defer func() {
723			sc := -1
724			if iter.Response().Response.Response != nil {
725				sc = iter.Response().Response.Response.StatusCode
726			}
727			tracing.EndSpan(ctx, sc, err)
728		}()
729	}
730	iter.i++
731	if iter.i < len(iter.page.Values()) {
732		return nil
733	}
734	err = iter.page.NextWithContext(ctx)
735	if err != nil {
736		iter.i--
737		return err
738	}
739	iter.i = 0
740	return nil
741}
742
743// Next advances to the next value.  If there was an error making
744// the request the iterator does not advance and the error is returned.
745// Deprecated: Use NextWithContext() instead.
746func (iter *ResourceSkusResultIterator) Next() error {
747	return iter.NextWithContext(context.Background())
748}
749
750// NotDone returns true if the enumeration should be started or is not yet complete.
751func (iter ResourceSkusResultIterator) NotDone() bool {
752	return iter.page.NotDone() && iter.i < len(iter.page.Values())
753}
754
755// Response returns the raw server response from the last page request.
756func (iter ResourceSkusResultIterator) Response() ResourceSkusResult {
757	return iter.page.Response()
758}
759
760// Value returns the current value or a zero-initialized value if the
761// iterator has advanced beyond the end of the collection.
762func (iter ResourceSkusResultIterator) Value() ResourceSku {
763	if !iter.page.NotDone() {
764		return ResourceSku{}
765	}
766	return iter.page.Values()[iter.i]
767}
768
769// Creates a new instance of the ResourceSkusResultIterator type.
770func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResultIterator {
771	return ResourceSkusResultIterator{page: page}
772}
773
774// IsEmpty returns true if the ListResult contains no values.
775func (rsr ResourceSkusResult) IsEmpty() bool {
776	return rsr.Value == nil || len(*rsr.Value) == 0
777}
778
779// hasNextLink returns true if the NextLink is not empty.
780func (rsr ResourceSkusResult) hasNextLink() bool {
781	return rsr.NextLink != nil && len(*rsr.NextLink) != 0
782}
783
784// resourceSkusResultPreparer prepares a request to retrieve the next set of results.
785// It returns nil if no more results exist.
786func (rsr ResourceSkusResult) resourceSkusResultPreparer(ctx context.Context) (*http.Request, error) {
787	if !rsr.hasNextLink() {
788		return nil, nil
789	}
790	return autorest.Prepare((&http.Request{}).WithContext(ctx),
791		autorest.AsJSON(),
792		autorest.AsGet(),
793		autorest.WithBaseURL(to.String(rsr.NextLink)))
794}
795
796// ResourceSkusResultPage contains a page of ResourceSku values.
797type ResourceSkusResultPage struct {
798	fn  func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)
799	rsr ResourceSkusResult
800}
801
802// NextWithContext advances to the next page of values.  If there was an error making
803// the request the page does not advance and the error is returned.
804func (page *ResourceSkusResultPage) NextWithContext(ctx context.Context) (err error) {
805	if tracing.IsEnabled() {
806		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultPage.NextWithContext")
807		defer func() {
808			sc := -1
809			if page.Response().Response.Response != nil {
810				sc = page.Response().Response.Response.StatusCode
811			}
812			tracing.EndSpan(ctx, sc, err)
813		}()
814	}
815	for {
816		next, err := page.fn(ctx, page.rsr)
817		if err != nil {
818			return err
819		}
820		page.rsr = next
821		if !next.hasNextLink() || !next.IsEmpty() {
822			break
823		}
824	}
825	return nil
826}
827
828// Next advances to the next page of values.  If there was an error making
829// the request the page does not advance and the error is returned.
830// Deprecated: Use NextWithContext() instead.
831func (page *ResourceSkusResultPage) Next() error {
832	return page.NextWithContext(context.Background())
833}
834
835// NotDone returns true if the page enumeration should be started or is not yet complete.
836func (page ResourceSkusResultPage) NotDone() bool {
837	return !page.rsr.IsEmpty()
838}
839
840// Response returns the raw server response from the last page request.
841func (page ResourceSkusResultPage) Response() ResourceSkusResult {
842	return page.rsr
843}
844
845// Values returns the slice of values for the current page or nil if there are no values.
846func (page ResourceSkusResultPage) Values() []ResourceSku {
847	if page.rsr.IsEmpty() {
848		return nil
849	}
850	return *page.rsr.Value
851}
852
853// Creates a new instance of the ResourceSkusResultPage type.
854func NewResourceSkusResultPage(cur ResourceSkusResult, getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage {
855	return ResourceSkusResultPage{
856		fn:  getNextPage,
857		rsr: cur,
858	}
859}
860
861// Restriction the restriction because of which SKU cannot be used.
862type Restriction struct {
863	// Type - READ-ONLY; The type of restrictions. As of now only possible value for this is location.
864	Type *string `json:"type,omitempty"`
865	// Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted.
866	Values *[]string `json:"values,omitempty"`
867	// ReasonCode - The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: 'QuotaID', 'NotAvailableForSubscription'
868	ReasonCode ReasonCode `json:"reasonCode,omitempty"`
869}
870
871// MarshalJSON is the custom marshaler for Restriction.
872func (r Restriction) MarshalJSON() ([]byte, error) {
873	objectMap := make(map[string]interface{})
874	if r.ReasonCode != "" {
875		objectMap["reasonCode"] = r.ReasonCode
876	}
877	return json.Marshal(objectMap)
878}
879
880// SetObject ...
881type SetObject struct {
882	autorest.Response `json:"-"`
883	Value             interface{} `json:"value,omitempty"`
884}
885
886// StorageTarget a storage system being cached by a Cache.
887type StorageTarget struct {
888	autorest.Response `json:"-"`
889	// Name - READ-ONLY; A fully qualified URL.
890	Name *string `json:"name,omitempty"`
891	// ID - READ-ONLY; Resource Id
892	ID *string `json:"id,omitempty"`
893	// Type - READ-ONLY; Type for the storage target; Microsoft.StorageCache/Cache/StorageTarget
894	Type *string `json:"type,omitempty"`
895	// StorageTargetProperties - Properties of the storage target.
896	*StorageTargetProperties `json:"properties,omitempty"`
897}
898
899// MarshalJSON is the custom marshaler for StorageTarget.
900func (st StorageTarget) MarshalJSON() ([]byte, error) {
901	objectMap := make(map[string]interface{})
902	if st.StorageTargetProperties != nil {
903		objectMap["properties"] = st.StorageTargetProperties
904	}
905	return json.Marshal(objectMap)
906}
907
908// UnmarshalJSON is the custom unmarshaler for StorageTarget struct.
909func (st *StorageTarget) UnmarshalJSON(body []byte) error {
910	var m map[string]*json.RawMessage
911	err := json.Unmarshal(body, &m)
912	if err != nil {
913		return err
914	}
915	for k, v := range m {
916		switch k {
917		case "name":
918			if v != nil {
919				var name string
920				err = json.Unmarshal(*v, &name)
921				if err != nil {
922					return err
923				}
924				st.Name = &name
925			}
926		case "id":
927			if v != nil {
928				var ID string
929				err = json.Unmarshal(*v, &ID)
930				if err != nil {
931					return err
932				}
933				st.ID = &ID
934			}
935		case "type":
936			if v != nil {
937				var typeVar string
938				err = json.Unmarshal(*v, &typeVar)
939				if err != nil {
940					return err
941				}
942				st.Type = &typeVar
943			}
944		case "properties":
945			if v != nil {
946				var storageTargetProperties StorageTargetProperties
947				err = json.Unmarshal(*v, &storageTargetProperties)
948				if err != nil {
949					return err
950				}
951				st.StorageTargetProperties = &storageTargetProperties
952			}
953		}
954	}
955
956	return nil
957}
958
959// StorageTargetProperties properties of the storage target.
960type StorageTargetProperties struct {
961	// Junctions - List of cache namespace to target namespace associations.
962	Junctions *[]NamespaceJunction `json:"junctions,omitempty"`
963	// TargetType - Type for storage target. Possible values include: 'StorageTargetTypeNfs3', 'StorageTargetTypeClfs', 'StorageTargetTypeUnknown'
964	TargetType StorageTargetType `json:"targetType,omitempty"`
965	// ProvisioningState - ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating'
966	ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
967	// Nfs3 - Properties when nfs3 target.
968	Nfs3 *Nfs3Target `json:"nfs3,omitempty"`
969	// Clfs - Properties when clfs target.
970	Clfs *ClfsTarget `json:"clfs,omitempty"`
971	// Unknown - Properties when unknown target.
972	Unknown *UnknownTarget `json:"unknown,omitempty"`
973}
974
975// StorageTargetsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
976// operation.
977type StorageTargetsCreateFuture struct {
978	azure.FutureAPI
979	// Result returns the result of the asynchronous operation.
980	// If the operation has not completed it will return an error.
981	Result func(StorageTargetsClient) (StorageTarget, error)
982}
983
984// StorageTargetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
985// operation.
986type StorageTargetsDeleteFuture struct {
987	azure.FutureAPI
988	// Result returns the result of the asynchronous operation.
989	// If the operation has not completed it will return an error.
990	Result func(StorageTargetsClient) (SetObject, error)
991}
992
993// StorageTargetsResult a list of storage targets.
994type StorageTargetsResult struct {
995	autorest.Response `json:"-"`
996	// NextLink - The uri to fetch the next page of storage targets.
997	NextLink *string `json:"nextLink,omitempty"`
998	// Value - The list of storage targets defined for the cache.
999	Value *[]StorageTarget `json:"value,omitempty"`
1000}
1001
1002// StorageTargetsResultIterator provides access to a complete listing of StorageTarget values.
1003type StorageTargetsResultIterator struct {
1004	i    int
1005	page StorageTargetsResultPage
1006}
1007
1008// NextWithContext advances to the next value.  If there was an error making
1009// the request the iterator does not advance and the error is returned.
1010func (iter *StorageTargetsResultIterator) NextWithContext(ctx context.Context) (err error) {
1011	if tracing.IsEnabled() {
1012		ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsResultIterator.NextWithContext")
1013		defer func() {
1014			sc := -1
1015			if iter.Response().Response.Response != nil {
1016				sc = iter.Response().Response.Response.StatusCode
1017			}
1018			tracing.EndSpan(ctx, sc, err)
1019		}()
1020	}
1021	iter.i++
1022	if iter.i < len(iter.page.Values()) {
1023		return nil
1024	}
1025	err = iter.page.NextWithContext(ctx)
1026	if err != nil {
1027		iter.i--
1028		return err
1029	}
1030	iter.i = 0
1031	return nil
1032}
1033
1034// Next advances to the next value.  If there was an error making
1035// the request the iterator does not advance and the error is returned.
1036// Deprecated: Use NextWithContext() instead.
1037func (iter *StorageTargetsResultIterator) Next() error {
1038	return iter.NextWithContext(context.Background())
1039}
1040
1041// NotDone returns true if the enumeration should be started or is not yet complete.
1042func (iter StorageTargetsResultIterator) NotDone() bool {
1043	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1044}
1045
1046// Response returns the raw server response from the last page request.
1047func (iter StorageTargetsResultIterator) Response() StorageTargetsResult {
1048	return iter.page.Response()
1049}
1050
1051// Value returns the current value or a zero-initialized value if the
1052// iterator has advanced beyond the end of the collection.
1053func (iter StorageTargetsResultIterator) Value() StorageTarget {
1054	if !iter.page.NotDone() {
1055		return StorageTarget{}
1056	}
1057	return iter.page.Values()[iter.i]
1058}
1059
1060// Creates a new instance of the StorageTargetsResultIterator type.
1061func NewStorageTargetsResultIterator(page StorageTargetsResultPage) StorageTargetsResultIterator {
1062	return StorageTargetsResultIterator{page: page}
1063}
1064
1065// IsEmpty returns true if the ListResult contains no values.
1066func (str StorageTargetsResult) IsEmpty() bool {
1067	return str.Value == nil || len(*str.Value) == 0
1068}
1069
1070// hasNextLink returns true if the NextLink is not empty.
1071func (str StorageTargetsResult) hasNextLink() bool {
1072	return str.NextLink != nil && len(*str.NextLink) != 0
1073}
1074
1075// storageTargetsResultPreparer prepares a request to retrieve the next set of results.
1076// It returns nil if no more results exist.
1077func (str StorageTargetsResult) storageTargetsResultPreparer(ctx context.Context) (*http.Request, error) {
1078	if !str.hasNextLink() {
1079		return nil, nil
1080	}
1081	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1082		autorest.AsJSON(),
1083		autorest.AsGet(),
1084		autorest.WithBaseURL(to.String(str.NextLink)))
1085}
1086
1087// StorageTargetsResultPage contains a page of StorageTarget values.
1088type StorageTargetsResultPage struct {
1089	fn  func(context.Context, StorageTargetsResult) (StorageTargetsResult, error)
1090	str StorageTargetsResult
1091}
1092
1093// NextWithContext advances to the next page of values.  If there was an error making
1094// the request the page does not advance and the error is returned.
1095func (page *StorageTargetsResultPage) NextWithContext(ctx context.Context) (err error) {
1096	if tracing.IsEnabled() {
1097		ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsResultPage.NextWithContext")
1098		defer func() {
1099			sc := -1
1100			if page.Response().Response.Response != nil {
1101				sc = page.Response().Response.Response.StatusCode
1102			}
1103			tracing.EndSpan(ctx, sc, err)
1104		}()
1105	}
1106	for {
1107		next, err := page.fn(ctx, page.str)
1108		if err != nil {
1109			return err
1110		}
1111		page.str = next
1112		if !next.hasNextLink() || !next.IsEmpty() {
1113			break
1114		}
1115	}
1116	return nil
1117}
1118
1119// Next advances to the next page of values.  If there was an error making
1120// the request the page does not advance and the error is returned.
1121// Deprecated: Use NextWithContext() instead.
1122func (page *StorageTargetsResultPage) Next() error {
1123	return page.NextWithContext(context.Background())
1124}
1125
1126// NotDone returns true if the page enumeration should be started or is not yet complete.
1127func (page StorageTargetsResultPage) NotDone() bool {
1128	return !page.str.IsEmpty()
1129}
1130
1131// Response returns the raw server response from the last page request.
1132func (page StorageTargetsResultPage) Response() StorageTargetsResult {
1133	return page.str
1134}
1135
1136// Values returns the slice of values for the current page or nil if there are no values.
1137func (page StorageTargetsResultPage) Values() []StorageTarget {
1138	if page.str.IsEmpty() {
1139		return nil
1140	}
1141	return *page.str.Value
1142}
1143
1144// Creates a new instance of the StorageTargetsResultPage type.
1145func NewStorageTargetsResultPage(cur StorageTargetsResult, getNextPage func(context.Context, StorageTargetsResult) (StorageTargetsResult, error)) StorageTargetsResultPage {
1146	return StorageTargetsResultPage{
1147		fn:  getNextPage,
1148		str: cur,
1149	}
1150}
1151
1152// UnknownTarget storage container for use as a Unknown StorageTarget.
1153type UnknownTarget struct {
1154	// UnknownMap - Dictionary of string->string pairs containing information about the StorageTarget.
1155	UnknownMap map[string]*string `json:"unknownMap"`
1156}
1157
1158// MarshalJSON is the custom marshaler for UnknownTarget.
1159func (ut UnknownTarget) MarshalJSON() ([]byte, error) {
1160	objectMap := make(map[string]interface{})
1161	if ut.UnknownMap != nil {
1162		objectMap["unknownMap"] = ut.UnknownMap
1163	}
1164	return json.Marshal(objectMap)
1165}
1166
1167// UsageModel a usage model.
1168type UsageModel struct {
1169	// Display - Localized information describing this usage model.
1170	Display *UsageModelDisplay `json:"display,omitempty"`
1171	// ModelName - Non localized keyword naming this usage model.
1172	ModelName *string `json:"modelName,omitempty"`
1173	// TargetType - The type of Storage Target to which this model is applicable (only nfs for now)
1174	TargetType *string `json:"targetType,omitempty"`
1175}
1176
1177// UsageModelDisplay localized information describing this usage model.
1178type UsageModelDisplay struct {
1179	// Description - String to display for this usage model.
1180	Description *string `json:"description,omitempty"`
1181}
1182
1183// UsageModelsResult a list of cache usage models.
1184type UsageModelsResult struct {
1185	autorest.Response `json:"-"`
1186	// NextLink - The uri to fetch the next page of cache usage models.
1187	NextLink *string `json:"nextLink,omitempty"`
1188	// Value - The list of usage models available for the subscription.
1189	Value *[]UsageModel `json:"value,omitempty"`
1190}
1191
1192// UsageModelsResultIterator provides access to a complete listing of UsageModel values.
1193type UsageModelsResultIterator struct {
1194	i    int
1195	page UsageModelsResultPage
1196}
1197
1198// NextWithContext advances to the next value.  If there was an error making
1199// the request the iterator does not advance and the error is returned.
1200func (iter *UsageModelsResultIterator) NextWithContext(ctx context.Context) (err error) {
1201	if tracing.IsEnabled() {
1202		ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsResultIterator.NextWithContext")
1203		defer func() {
1204			sc := -1
1205			if iter.Response().Response.Response != nil {
1206				sc = iter.Response().Response.Response.StatusCode
1207			}
1208			tracing.EndSpan(ctx, sc, err)
1209		}()
1210	}
1211	iter.i++
1212	if iter.i < len(iter.page.Values()) {
1213		return nil
1214	}
1215	err = iter.page.NextWithContext(ctx)
1216	if err != nil {
1217		iter.i--
1218		return err
1219	}
1220	iter.i = 0
1221	return nil
1222}
1223
1224// Next advances to the next value.  If there was an error making
1225// the request the iterator does not advance and the error is returned.
1226// Deprecated: Use NextWithContext() instead.
1227func (iter *UsageModelsResultIterator) Next() error {
1228	return iter.NextWithContext(context.Background())
1229}
1230
1231// NotDone returns true if the enumeration should be started or is not yet complete.
1232func (iter UsageModelsResultIterator) NotDone() bool {
1233	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1234}
1235
1236// Response returns the raw server response from the last page request.
1237func (iter UsageModelsResultIterator) Response() UsageModelsResult {
1238	return iter.page.Response()
1239}
1240
1241// Value returns the current value or a zero-initialized value if the
1242// iterator has advanced beyond the end of the collection.
1243func (iter UsageModelsResultIterator) Value() UsageModel {
1244	if !iter.page.NotDone() {
1245		return UsageModel{}
1246	}
1247	return iter.page.Values()[iter.i]
1248}
1249
1250// Creates a new instance of the UsageModelsResultIterator type.
1251func NewUsageModelsResultIterator(page UsageModelsResultPage) UsageModelsResultIterator {
1252	return UsageModelsResultIterator{page: page}
1253}
1254
1255// IsEmpty returns true if the ListResult contains no values.
1256func (umr UsageModelsResult) IsEmpty() bool {
1257	return umr.Value == nil || len(*umr.Value) == 0
1258}
1259
1260// hasNextLink returns true if the NextLink is not empty.
1261func (umr UsageModelsResult) hasNextLink() bool {
1262	return umr.NextLink != nil && len(*umr.NextLink) != 0
1263}
1264
1265// usageModelsResultPreparer prepares a request to retrieve the next set of results.
1266// It returns nil if no more results exist.
1267func (umr UsageModelsResult) usageModelsResultPreparer(ctx context.Context) (*http.Request, error) {
1268	if !umr.hasNextLink() {
1269		return nil, nil
1270	}
1271	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1272		autorest.AsJSON(),
1273		autorest.AsGet(),
1274		autorest.WithBaseURL(to.String(umr.NextLink)))
1275}
1276
1277// UsageModelsResultPage contains a page of UsageModel values.
1278type UsageModelsResultPage struct {
1279	fn  func(context.Context, UsageModelsResult) (UsageModelsResult, error)
1280	umr UsageModelsResult
1281}
1282
1283// NextWithContext advances to the next page of values.  If there was an error making
1284// the request the page does not advance and the error is returned.
1285func (page *UsageModelsResultPage) NextWithContext(ctx context.Context) (err error) {
1286	if tracing.IsEnabled() {
1287		ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsResultPage.NextWithContext")
1288		defer func() {
1289			sc := -1
1290			if page.Response().Response.Response != nil {
1291				sc = page.Response().Response.Response.StatusCode
1292			}
1293			tracing.EndSpan(ctx, sc, err)
1294		}()
1295	}
1296	for {
1297		next, err := page.fn(ctx, page.umr)
1298		if err != nil {
1299			return err
1300		}
1301		page.umr = next
1302		if !next.hasNextLink() || !next.IsEmpty() {
1303			break
1304		}
1305	}
1306	return nil
1307}
1308
1309// Next advances to the next page of values.  If there was an error making
1310// the request the page does not advance and the error is returned.
1311// Deprecated: Use NextWithContext() instead.
1312func (page *UsageModelsResultPage) Next() error {
1313	return page.NextWithContext(context.Background())
1314}
1315
1316// NotDone returns true if the page enumeration should be started or is not yet complete.
1317func (page UsageModelsResultPage) NotDone() bool {
1318	return !page.umr.IsEmpty()
1319}
1320
1321// Response returns the raw server response from the last page request.
1322func (page UsageModelsResultPage) Response() UsageModelsResult {
1323	return page.umr
1324}
1325
1326// Values returns the slice of values for the current page or nil if there are no values.
1327func (page UsageModelsResultPage) Values() []UsageModel {
1328	if page.umr.IsEmpty() {
1329		return nil
1330	}
1331	return *page.umr.Value
1332}
1333
1334// Creates a new instance of the UsageModelsResultPage type.
1335func NewUsageModelsResultPage(cur UsageModelsResult, getNextPage func(context.Context, UsageModelsResult) (UsageModelsResult, error)) UsageModelsResultPage {
1336	return UsageModelsResultPage{
1337		fn:  getNextPage,
1338		umr: cur,
1339	}
1340}
1341