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