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/storagecache/mgmt/2020-10-01/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	// Origin - Origin of the operation.
40	Origin *string `json:"origin,omitempty"`
41	// IsDataAction - The flag that indicates whether the operation applies to data plane.
42	IsDataAction *bool `json:"isDataAction,omitempty"`
43	// Name - Operation name: {provider}/{resource}/{operation}
44	Name *string `json:"name,omitempty"`
45	// APIOperationProperties - Additional details about an operation.
46	*APIOperationProperties `json:"properties,omitempty"`
47}
48
49// MarshalJSON is the custom marshaler for APIOperation.
50func (ao APIOperation) MarshalJSON() ([]byte, error) {
51	objectMap := make(map[string]interface{})
52	if ao.Display != nil {
53		objectMap["display"] = ao.Display
54	}
55	if ao.Origin != nil {
56		objectMap["origin"] = ao.Origin
57	}
58	if ao.IsDataAction != nil {
59		objectMap["isDataAction"] = ao.IsDataAction
60	}
61	if ao.Name != nil {
62		objectMap["name"] = ao.Name
63	}
64	if ao.APIOperationProperties != nil {
65		objectMap["properties"] = ao.APIOperationProperties
66	}
67	return json.Marshal(objectMap)
68}
69
70// UnmarshalJSON is the custom unmarshaler for APIOperation struct.
71func (ao *APIOperation) UnmarshalJSON(body []byte) error {
72	var m map[string]*json.RawMessage
73	err := json.Unmarshal(body, &m)
74	if err != nil {
75		return err
76	}
77	for k, v := range m {
78		switch k {
79		case "display":
80			if v != nil {
81				var display APIOperationDisplay
82				err = json.Unmarshal(*v, &display)
83				if err != nil {
84					return err
85				}
86				ao.Display = &display
87			}
88		case "origin":
89			if v != nil {
90				var origin string
91				err = json.Unmarshal(*v, &origin)
92				if err != nil {
93					return err
94				}
95				ao.Origin = &origin
96			}
97		case "isDataAction":
98			if v != nil {
99				var isDataAction bool
100				err = json.Unmarshal(*v, &isDataAction)
101				if err != nil {
102					return err
103				}
104				ao.IsDataAction = &isDataAction
105			}
106		case "name":
107			if v != nil {
108				var name string
109				err = json.Unmarshal(*v, &name)
110				if err != nil {
111					return err
112				}
113				ao.Name = &name
114			}
115		case "properties":
116			if v != nil {
117				var APIOperationProperties APIOperationProperties
118				err = json.Unmarshal(*v, &APIOperationProperties)
119				if err != nil {
120					return err
121				}
122				ao.APIOperationProperties = &APIOperationProperties
123			}
124		}
125	}
126
127	return nil
128}
129
130// APIOperationDisplay the object that represents the operation.
131type APIOperationDisplay struct {
132	// Operation - Operation type: Read, write, delete, etc.
133	Operation *string `json:"operation,omitempty"`
134	// Provider - Service provider: Microsoft.StorageCache
135	Provider *string `json:"provider,omitempty"`
136	// Resource - Resource on which the operation is performed: Cache, etc.
137	Resource *string `json:"resource,omitempty"`
138	// Description - The description of the operation
139	Description *string `json:"description,omitempty"`
140}
141
142// APIOperationListResult result of the request to list Resource Provider operations. It contains a list of
143// operations and a URL link to get the next set of results.
144type APIOperationListResult struct {
145	autorest.Response `json:"-"`
146	// NextLink - URL to get the next set of operation list results if there are any.
147	NextLink *string `json:"nextLink,omitempty"`
148	// Value - List of Resource Provider operations supported by the Microsoft.StorageCache resource provider.
149	Value *[]APIOperation `json:"value,omitempty"`
150}
151
152// APIOperationListResultIterator provides access to a complete listing of APIOperation values.
153type APIOperationListResultIterator struct {
154	i    int
155	page APIOperationListResultPage
156}
157
158// NextWithContext advances to the next value.  If there was an error making
159// the request the iterator does not advance and the error is returned.
160func (iter *APIOperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
161	if tracing.IsEnabled() {
162		ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultIterator.NextWithContext")
163		defer func() {
164			sc := -1
165			if iter.Response().Response.Response != nil {
166				sc = iter.Response().Response.Response.StatusCode
167			}
168			tracing.EndSpan(ctx, sc, err)
169		}()
170	}
171	iter.i++
172	if iter.i < len(iter.page.Values()) {
173		return nil
174	}
175	err = iter.page.NextWithContext(ctx)
176	if err != nil {
177		iter.i--
178		return err
179	}
180	iter.i = 0
181	return nil
182}
183
184// Next advances to the next value.  If there was an error making
185// the request the iterator does not advance and the error is returned.
186// Deprecated: Use NextWithContext() instead.
187func (iter *APIOperationListResultIterator) Next() error {
188	return iter.NextWithContext(context.Background())
189}
190
191// NotDone returns true if the enumeration should be started or is not yet complete.
192func (iter APIOperationListResultIterator) NotDone() bool {
193	return iter.page.NotDone() && iter.i < len(iter.page.Values())
194}
195
196// Response returns the raw server response from the last page request.
197func (iter APIOperationListResultIterator) Response() APIOperationListResult {
198	return iter.page.Response()
199}
200
201// Value returns the current value or a zero-initialized value if the
202// iterator has advanced beyond the end of the collection.
203func (iter APIOperationListResultIterator) Value() APIOperation {
204	if !iter.page.NotDone() {
205		return APIOperation{}
206	}
207	return iter.page.Values()[iter.i]
208}
209
210// Creates a new instance of the APIOperationListResultIterator type.
211func NewAPIOperationListResultIterator(page APIOperationListResultPage) APIOperationListResultIterator {
212	return APIOperationListResultIterator{page: page}
213}
214
215// IsEmpty returns true if the ListResult contains no values.
216func (aolr APIOperationListResult) IsEmpty() bool {
217	return aolr.Value == nil || len(*aolr.Value) == 0
218}
219
220// hasNextLink returns true if the NextLink is not empty.
221func (aolr APIOperationListResult) hasNextLink() bool {
222	return aolr.NextLink != nil && len(*aolr.NextLink) != 0
223}
224
225// aPIOperationListResultPreparer prepares a request to retrieve the next set of results.
226// It returns nil if no more results exist.
227func (aolr APIOperationListResult) aPIOperationListResultPreparer(ctx context.Context) (*http.Request, error) {
228	if !aolr.hasNextLink() {
229		return nil, nil
230	}
231	return autorest.Prepare((&http.Request{}).WithContext(ctx),
232		autorest.AsJSON(),
233		autorest.AsGet(),
234		autorest.WithBaseURL(to.String(aolr.NextLink)))
235}
236
237// APIOperationListResultPage contains a page of APIOperation values.
238type APIOperationListResultPage struct {
239	fn   func(context.Context, APIOperationListResult) (APIOperationListResult, error)
240	aolr APIOperationListResult
241}
242
243// NextWithContext advances to the next page of values.  If there was an error making
244// the request the page does not advance and the error is returned.
245func (page *APIOperationListResultPage) NextWithContext(ctx context.Context) (err error) {
246	if tracing.IsEnabled() {
247		ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultPage.NextWithContext")
248		defer func() {
249			sc := -1
250			if page.Response().Response.Response != nil {
251				sc = page.Response().Response.Response.StatusCode
252			}
253			tracing.EndSpan(ctx, sc, err)
254		}()
255	}
256	for {
257		next, err := page.fn(ctx, page.aolr)
258		if err != nil {
259			return err
260		}
261		page.aolr = next
262		if !next.hasNextLink() || !next.IsEmpty() {
263			break
264		}
265	}
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(cur APIOperationListResult, getNextPage func(context.Context, APIOperationListResult) (APIOperationListResult, error)) APIOperationListResultPage {
296	return APIOperationListResultPage{
297		fn:   getNextPage,
298		aolr: cur,
299	}
300}
301
302// APIOperationProperties additional details about an operation.
303type APIOperationProperties struct {
304	// ServiceSpecification - Specification of the all the metrics provided for a resource type.
305	ServiceSpecification *APIOperationPropertiesServiceSpecification `json:"serviceSpecification,omitempty"`
306}
307
308// APIOperationPropertiesServiceSpecification specification of the all the metrics provided for a resource
309// type.
310type APIOperationPropertiesServiceSpecification struct {
311	// MetricSpecifications - Details about operations related to metrics.
312	MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"`
313}
314
315// AscOperation the status of operation.
316type AscOperation struct {
317	autorest.Response `json:"-"`
318	// ID - The operation Id.
319	ID *string `json:"id,omitempty"`
320	// Name - The operation name.
321	Name *string `json:"name,omitempty"`
322	// StartTime - The start time of the operation.
323	StartTime *string `json:"startTime,omitempty"`
324	// EndTime - The end time of the operation.
325	EndTime *string `json:"endTime,omitempty"`
326	// Status - The status of the operation.
327	Status *string `json:"status,omitempty"`
328	// Error - The error detail of the operation if any.
329	Error *ErrorResponse `json:"error,omitempty"`
330	// AscOperationProperties - Additional operation specific properties
331	*AscOperationProperties `json:"properties,omitempty"`
332}
333
334// MarshalJSON is the custom marshaler for AscOperation.
335func (ao AscOperation) MarshalJSON() ([]byte, error) {
336	objectMap := make(map[string]interface{})
337	if ao.ID != nil {
338		objectMap["id"] = ao.ID
339	}
340	if ao.Name != nil {
341		objectMap["name"] = ao.Name
342	}
343	if ao.StartTime != nil {
344		objectMap["startTime"] = ao.StartTime
345	}
346	if ao.EndTime != nil {
347		objectMap["endTime"] = ao.EndTime
348	}
349	if ao.Status != nil {
350		objectMap["status"] = ao.Status
351	}
352	if ao.Error != nil {
353		objectMap["error"] = ao.Error
354	}
355	if ao.AscOperationProperties != nil {
356		objectMap["properties"] = ao.AscOperationProperties
357	}
358	return json.Marshal(objectMap)
359}
360
361// UnmarshalJSON is the custom unmarshaler for AscOperation struct.
362func (ao *AscOperation) UnmarshalJSON(body []byte) error {
363	var m map[string]*json.RawMessage
364	err := json.Unmarshal(body, &m)
365	if err != nil {
366		return err
367	}
368	for k, v := range m {
369		switch k {
370		case "id":
371			if v != nil {
372				var ID string
373				err = json.Unmarshal(*v, &ID)
374				if err != nil {
375					return err
376				}
377				ao.ID = &ID
378			}
379		case "name":
380			if v != nil {
381				var name string
382				err = json.Unmarshal(*v, &name)
383				if err != nil {
384					return err
385				}
386				ao.Name = &name
387			}
388		case "startTime":
389			if v != nil {
390				var startTime string
391				err = json.Unmarshal(*v, &startTime)
392				if err != nil {
393					return err
394				}
395				ao.StartTime = &startTime
396			}
397		case "endTime":
398			if v != nil {
399				var endTime string
400				err = json.Unmarshal(*v, &endTime)
401				if err != nil {
402					return err
403				}
404				ao.EndTime = &endTime
405			}
406		case "status":
407			if v != nil {
408				var status string
409				err = json.Unmarshal(*v, &status)
410				if err != nil {
411					return err
412				}
413				ao.Status = &status
414			}
415		case "error":
416			if v != nil {
417				var errorVar ErrorResponse
418				err = json.Unmarshal(*v, &errorVar)
419				if err != nil {
420					return err
421				}
422				ao.Error = &errorVar
423			}
424		case "properties":
425			if v != nil {
426				var ascOperationProperties AscOperationProperties
427				err = json.Unmarshal(*v, &ascOperationProperties)
428				if err != nil {
429					return err
430				}
431				ao.AscOperationProperties = &ascOperationProperties
432			}
433		}
434	}
435
436	return nil
437}
438
439// AscOperationProperties operation specific output
440type AscOperationProperties struct {
441	// Output - Additional Operation Specific Properties
442	Output map[string]interface{} `json:"output"`
443}
444
445// MarshalJSON is the custom marshaler for AscOperationProperties.
446func (aop AscOperationProperties) MarshalJSON() ([]byte, error) {
447	objectMap := make(map[string]interface{})
448	if aop.Output != nil {
449		objectMap["output"] = aop.Output
450	}
451	return json.Marshal(objectMap)
452}
453
454// Cache a Cache instance. Follows Azure Resource Manager standards:
455// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md
456type Cache struct {
457	autorest.Response `json:"-"`
458	// Tags - ARM tags as name/value pairs.
459	Tags interface{} `json:"tags,omitempty"`
460	// ID - READ-ONLY; Resource ID of the Cache.
461	ID *string `json:"id,omitempty"`
462	// Location - Region name string.
463	Location *string `json:"location,omitempty"`
464	// Name - READ-ONLY; Name of Cache.
465	Name *string `json:"name,omitempty"`
466	// Type - READ-ONLY; Type of the Cache; Microsoft.StorageCache/Cache
467	Type *string `json:"type,omitempty"`
468	// Identity - The identity of the cache, if configured.
469	Identity *CacheIdentity `json:"identity,omitempty"`
470	// SystemData - READ-ONLY; The system meta data relating to this resource.
471	SystemData *SystemData `json:"systemData,omitempty"`
472	// CacheProperties - Properties of the Cache.
473	*CacheProperties `json:"properties,omitempty"`
474	// Sku - SKU for the Cache.
475	Sku *CacheSku `json:"sku,omitempty"`
476}
477
478// MarshalJSON is the custom marshaler for Cache.
479func (c Cache) MarshalJSON() ([]byte, error) {
480	objectMap := make(map[string]interface{})
481	if c.Tags != nil {
482		objectMap["tags"] = c.Tags
483	}
484	if c.Location != nil {
485		objectMap["location"] = c.Location
486	}
487	if c.Identity != nil {
488		objectMap["identity"] = c.Identity
489	}
490	if c.CacheProperties != nil {
491		objectMap["properties"] = c.CacheProperties
492	}
493	if c.Sku != nil {
494		objectMap["sku"] = c.Sku
495	}
496	return json.Marshal(objectMap)
497}
498
499// UnmarshalJSON is the custom unmarshaler for Cache struct.
500func (c *Cache) UnmarshalJSON(body []byte) error {
501	var m map[string]*json.RawMessage
502	err := json.Unmarshal(body, &m)
503	if err != nil {
504		return err
505	}
506	for k, v := range m {
507		switch k {
508		case "tags":
509			if v != nil {
510				var tags interface{}
511				err = json.Unmarshal(*v, &tags)
512				if err != nil {
513					return err
514				}
515				c.Tags = tags
516			}
517		case "id":
518			if v != nil {
519				var ID string
520				err = json.Unmarshal(*v, &ID)
521				if err != nil {
522					return err
523				}
524				c.ID = &ID
525			}
526		case "location":
527			if v != nil {
528				var location string
529				err = json.Unmarshal(*v, &location)
530				if err != nil {
531					return err
532				}
533				c.Location = &location
534			}
535		case "name":
536			if v != nil {
537				var name string
538				err = json.Unmarshal(*v, &name)
539				if err != nil {
540					return err
541				}
542				c.Name = &name
543			}
544		case "type":
545			if v != nil {
546				var typeVar string
547				err = json.Unmarshal(*v, &typeVar)
548				if err != nil {
549					return err
550				}
551				c.Type = &typeVar
552			}
553		case "identity":
554			if v != nil {
555				var identity CacheIdentity
556				err = json.Unmarshal(*v, &identity)
557				if err != nil {
558					return err
559				}
560				c.Identity = &identity
561			}
562		case "systemData":
563			if v != nil {
564				var systemData SystemData
565				err = json.Unmarshal(*v, &systemData)
566				if err != nil {
567					return err
568				}
569				c.SystemData = &systemData
570			}
571		case "properties":
572			if v != nil {
573				var cacheProperties CacheProperties
574				err = json.Unmarshal(*v, &cacheProperties)
575				if err != nil {
576					return err
577				}
578				c.CacheProperties = &cacheProperties
579			}
580		case "sku":
581			if v != nil {
582				var sku CacheSku
583				err = json.Unmarshal(*v, &sku)
584				if err != nil {
585					return err
586				}
587				c.Sku = &sku
588			}
589		}
590	}
591
592	return nil
593}
594
595// CacheActiveDirectorySettings active Directory settings used to join a cache to a domain.
596type CacheActiveDirectorySettings struct {
597	// PrimaryDNSIPAddress - Primary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name.
598	PrimaryDNSIPAddress *string `json:"primaryDnsIpAddress,omitempty"`
599	// SecondaryDNSIPAddress - Secondary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name.
600	SecondaryDNSIPAddress *string `json:"secondaryDnsIpAddress,omitempty"`
601	// DomainName - The fully qualified domain name of the Active Directory domain controller.
602	DomainName *string `json:"domainName,omitempty"`
603	// DomainNetBiosName - The Active Directory domain's NetBIOS name.
604	DomainNetBiosName *string `json:"domainNetBiosName,omitempty"`
605	// CacheNetBiosName - The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z].
606	CacheNetBiosName *string `json:"cacheNetBiosName,omitempty"`
607	// DomainJoined - READ-ONLY; True if the HPC Cache is joined to the Active Directory domain. Possible values include: 'Yes', 'No', 'Error'
608	DomainJoined DomainJoinedType `json:"domainJoined,omitempty"`
609	// Credentials - Active Directory admin credentials used to join the HPC Cache to a domain.
610	Credentials *CacheActiveDirectorySettingsCredentials `json:"credentials,omitempty"`
611}
612
613// MarshalJSON is the custom marshaler for CacheActiveDirectorySettings.
614func (cads CacheActiveDirectorySettings) MarshalJSON() ([]byte, error) {
615	objectMap := make(map[string]interface{})
616	if cads.PrimaryDNSIPAddress != nil {
617		objectMap["primaryDnsIpAddress"] = cads.PrimaryDNSIPAddress
618	}
619	if cads.SecondaryDNSIPAddress != nil {
620		objectMap["secondaryDnsIpAddress"] = cads.SecondaryDNSIPAddress
621	}
622	if cads.DomainName != nil {
623		objectMap["domainName"] = cads.DomainName
624	}
625	if cads.DomainNetBiosName != nil {
626		objectMap["domainNetBiosName"] = cads.DomainNetBiosName
627	}
628	if cads.CacheNetBiosName != nil {
629		objectMap["cacheNetBiosName"] = cads.CacheNetBiosName
630	}
631	if cads.Credentials != nil {
632		objectMap["credentials"] = cads.Credentials
633	}
634	return json.Marshal(objectMap)
635}
636
637// CacheActiveDirectorySettingsCredentials active Directory admin credentials used to join the HPC Cache to
638// a domain.
639type CacheActiveDirectorySettingsCredentials struct {
640	// Username - Username of the Active Directory domain administrator. This value is stored encrypted and not returned on response.
641	Username *string `json:"username,omitempty"`
642	// Password - Plain text password of the Active Directory domain administrator. This value is stored encrypted and not returned on response.
643	Password *string `json:"password,omitempty"`
644}
645
646// CacheDirectorySettings cache Directory Services settings.
647type CacheDirectorySettings struct {
648	// ActiveDirectory - Specifies settings for joining the HPC Cache to an Active Directory domain.
649	ActiveDirectory *CacheActiveDirectorySettings `json:"activeDirectory,omitempty"`
650	// UsernameDownload - Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups.
651	UsernameDownload *CacheUsernameDownloadSettings `json:"usernameDownload,omitempty"`
652}
653
654// CacheEncryptionSettings cache encryption settings.
655type CacheEncryptionSettings struct {
656	// KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault.
657	KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"`
658}
659
660// CacheHealth an indication of Cache health. Gives more information about health than just that related to
661// provisioning.
662type CacheHealth struct {
663	// State - List of Cache health states. Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', 'Stopped', 'Upgrading', 'Flushing'
664	State HealthStateType `json:"state,omitempty"`
665	// StatusDescription - Describes explanation of state.
666	StatusDescription *string `json:"statusDescription,omitempty"`
667}
668
669// CacheIdentity cache identity properties.
670type CacheIdentity struct {
671	// PrincipalID - READ-ONLY; The principal id of the cache.
672	PrincipalID *string `json:"principalId,omitempty"`
673	// TenantID - READ-ONLY; The tenant id associated with the cache.
674	TenantID *string `json:"tenantId,omitempty"`
675	// Type - The type of identity used for the cache. Possible values include: 'SystemAssigned', 'None'
676	Type CacheIdentityType `json:"type,omitempty"`
677}
678
679// MarshalJSON is the custom marshaler for CacheIdentity.
680func (ci CacheIdentity) MarshalJSON() ([]byte, error) {
681	objectMap := make(map[string]interface{})
682	if ci.Type != "" {
683		objectMap["type"] = ci.Type
684	}
685	return json.Marshal(objectMap)
686}
687
688// CacheNetworkSettings cache network settings.
689type CacheNetworkSettings struct {
690	// Mtu - The IPv4 maximum transmission unit configured for the subnet.
691	Mtu *int32 `json:"mtu,omitempty"`
692	// UtilityAddresses - READ-ONLY; Array of additional IP addresses used by this Cache.
693	UtilityAddresses *[]string `json:"utilityAddresses,omitempty"`
694}
695
696// MarshalJSON is the custom marshaler for CacheNetworkSettings.
697func (cns CacheNetworkSettings) MarshalJSON() ([]byte, error) {
698	objectMap := make(map[string]interface{})
699	if cns.Mtu != nil {
700		objectMap["mtu"] = cns.Mtu
701	}
702	return json.Marshal(objectMap)
703}
704
705// CacheProperties properties of the Cache.
706type CacheProperties struct {
707	// CacheSizeGB - The size of this Cache, in GB.
708	CacheSizeGB *int32 `json:"cacheSizeGB,omitempty"`
709	// Health - READ-ONLY; Health of the Cache.
710	Health *CacheHealth `json:"health,omitempty"`
711	// MountAddresses - READ-ONLY; Array of IP addresses that can be used by clients mounting this Cache.
712	MountAddresses *[]string `json:"mountAddresses,omitempty"`
713	// 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'
714	ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
715	// Subnet - Subnet used for the Cache.
716	Subnet *string `json:"subnet,omitempty"`
717	// UpgradeStatus - Upgrade status of the Cache.
718	UpgradeStatus *CacheUpgradeStatus `json:"upgradeStatus,omitempty"`
719	// NetworkSettings - Specifies network settings of the cache.
720	NetworkSettings *CacheNetworkSettings `json:"networkSettings,omitempty"`
721	// EncryptionSettings - Specifies encryption settings of the cache.
722	EncryptionSettings *CacheEncryptionSettings `json:"encryptionSettings,omitempty"`
723	// SecuritySettings - Specifies security settings of the cache.
724	SecuritySettings *CacheSecuritySettings `json:"securitySettings,omitempty"`
725	// DirectoryServicesSettings - Specifies Directory Services settings of the cache.
726	DirectoryServicesSettings *CacheDirectorySettings `json:"directoryServicesSettings,omitempty"`
727}
728
729// MarshalJSON is the custom marshaler for CacheProperties.
730func (c CacheProperties) MarshalJSON() ([]byte, error) {
731	objectMap := make(map[string]interface{})
732	if c.CacheSizeGB != nil {
733		objectMap["cacheSizeGB"] = c.CacheSizeGB
734	}
735	if c.ProvisioningState != "" {
736		objectMap["provisioningState"] = c.ProvisioningState
737	}
738	if c.Subnet != nil {
739		objectMap["subnet"] = c.Subnet
740	}
741	if c.UpgradeStatus != nil {
742		objectMap["upgradeStatus"] = c.UpgradeStatus
743	}
744	if c.NetworkSettings != nil {
745		objectMap["networkSettings"] = c.NetworkSettings
746	}
747	if c.EncryptionSettings != nil {
748		objectMap["encryptionSettings"] = c.EncryptionSettings
749	}
750	if c.SecuritySettings != nil {
751		objectMap["securitySettings"] = c.SecuritySettings
752	}
753	if c.DirectoryServicesSettings != nil {
754		objectMap["directoryServicesSettings"] = c.DirectoryServicesSettings
755	}
756	return json.Marshal(objectMap)
757}
758
759// CachesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
760// operation.
761type CachesCreateOrUpdateFuture struct {
762	azure.FutureAPI
763	// Result returns the result of the asynchronous operation.
764	// If the operation has not completed it will return an error.
765	Result func(CachesClient) (Cache, error)
766}
767
768// CachesDebugInfoFuture an abstraction for monitoring and retrieving the results of a long-running
769// operation.
770type CachesDebugInfoFuture struct {
771	azure.FutureAPI
772	// Result returns the result of the asynchronous operation.
773	// If the operation has not completed it will return an error.
774	Result func(CachesClient) (autorest.Response, error)
775}
776
777// CachesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
778type CachesDeleteFuture struct {
779	azure.FutureAPI
780	// Result returns the result of the asynchronous operation.
781	// If the operation has not completed it will return an error.
782	Result func(CachesClient) (autorest.Response, error)
783}
784
785// CacheSecuritySettings cache security settings.
786type CacheSecuritySettings struct {
787	// AccessPolicies - NFS access policies defined for this cache.
788	AccessPolicies *[]NfsAccessPolicy `json:"accessPolicies,omitempty"`
789}
790
791// CachesFlushFuture an abstraction for monitoring and retrieving the results of a long-running operation.
792type CachesFlushFuture struct {
793	azure.FutureAPI
794	// Result returns the result of the asynchronous operation.
795	// If the operation has not completed it will return an error.
796	Result func(CachesClient) (autorest.Response, error)
797}
798
799// CacheSku SKU for the Cache.
800type CacheSku struct {
801	// Name - SKU name for this Cache.
802	Name *string `json:"name,omitempty"`
803}
804
805// CachesListResult result of the request to list Caches. It contains a list of Caches and a URL link to
806// get the next set of results.
807type CachesListResult struct {
808	autorest.Response `json:"-"`
809	// NextLink - URL to get the next set of Cache list results, if there are any.
810	NextLink *string `json:"nextLink,omitempty"`
811	// Value - List of Caches.
812	Value *[]Cache `json:"value,omitempty"`
813}
814
815// CachesListResultIterator provides access to a complete listing of Cache values.
816type CachesListResultIterator struct {
817	i    int
818	page CachesListResultPage
819}
820
821// NextWithContext advances to the next value.  If there was an error making
822// the request the iterator does not advance and the error is returned.
823func (iter *CachesListResultIterator) NextWithContext(ctx context.Context) (err error) {
824	if tracing.IsEnabled() {
825		ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultIterator.NextWithContext")
826		defer func() {
827			sc := -1
828			if iter.Response().Response.Response != nil {
829				sc = iter.Response().Response.Response.StatusCode
830			}
831			tracing.EndSpan(ctx, sc, err)
832		}()
833	}
834	iter.i++
835	if iter.i < len(iter.page.Values()) {
836		return nil
837	}
838	err = iter.page.NextWithContext(ctx)
839	if err != nil {
840		iter.i--
841		return err
842	}
843	iter.i = 0
844	return nil
845}
846
847// Next advances to the next value.  If there was an error making
848// the request the iterator does not advance and the error is returned.
849// Deprecated: Use NextWithContext() instead.
850func (iter *CachesListResultIterator) Next() error {
851	return iter.NextWithContext(context.Background())
852}
853
854// NotDone returns true if the enumeration should be started or is not yet complete.
855func (iter CachesListResultIterator) NotDone() bool {
856	return iter.page.NotDone() && iter.i < len(iter.page.Values())
857}
858
859// Response returns the raw server response from the last page request.
860func (iter CachesListResultIterator) Response() CachesListResult {
861	return iter.page.Response()
862}
863
864// Value returns the current value or a zero-initialized value if the
865// iterator has advanced beyond the end of the collection.
866func (iter CachesListResultIterator) Value() Cache {
867	if !iter.page.NotDone() {
868		return Cache{}
869	}
870	return iter.page.Values()[iter.i]
871}
872
873// Creates a new instance of the CachesListResultIterator type.
874func NewCachesListResultIterator(page CachesListResultPage) CachesListResultIterator {
875	return CachesListResultIterator{page: page}
876}
877
878// IsEmpty returns true if the ListResult contains no values.
879func (clr CachesListResult) IsEmpty() bool {
880	return clr.Value == nil || len(*clr.Value) == 0
881}
882
883// hasNextLink returns true if the NextLink is not empty.
884func (clr CachesListResult) hasNextLink() bool {
885	return clr.NextLink != nil && len(*clr.NextLink) != 0
886}
887
888// cachesListResultPreparer prepares a request to retrieve the next set of results.
889// It returns nil if no more results exist.
890func (clr CachesListResult) cachesListResultPreparer(ctx context.Context) (*http.Request, error) {
891	if !clr.hasNextLink() {
892		return nil, nil
893	}
894	return autorest.Prepare((&http.Request{}).WithContext(ctx),
895		autorest.AsJSON(),
896		autorest.AsGet(),
897		autorest.WithBaseURL(to.String(clr.NextLink)))
898}
899
900// CachesListResultPage contains a page of Cache values.
901type CachesListResultPage struct {
902	fn  func(context.Context, CachesListResult) (CachesListResult, error)
903	clr CachesListResult
904}
905
906// NextWithContext advances to the next page of values.  If there was an error making
907// the request the page does not advance and the error is returned.
908func (page *CachesListResultPage) NextWithContext(ctx context.Context) (err error) {
909	if tracing.IsEnabled() {
910		ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultPage.NextWithContext")
911		defer func() {
912			sc := -1
913			if page.Response().Response.Response != nil {
914				sc = page.Response().Response.Response.StatusCode
915			}
916			tracing.EndSpan(ctx, sc, err)
917		}()
918	}
919	for {
920		next, err := page.fn(ctx, page.clr)
921		if err != nil {
922			return err
923		}
924		page.clr = next
925		if !next.hasNextLink() || !next.IsEmpty() {
926			break
927		}
928	}
929	return nil
930}
931
932// Next advances to the next page of values.  If there was an error making
933// the request the page does not advance and the error is returned.
934// Deprecated: Use NextWithContext() instead.
935func (page *CachesListResultPage) Next() error {
936	return page.NextWithContext(context.Background())
937}
938
939// NotDone returns true if the page enumeration should be started or is not yet complete.
940func (page CachesListResultPage) NotDone() bool {
941	return !page.clr.IsEmpty()
942}
943
944// Response returns the raw server response from the last page request.
945func (page CachesListResultPage) Response() CachesListResult {
946	return page.clr
947}
948
949// Values returns the slice of values for the current page or nil if there are no values.
950func (page CachesListResultPage) Values() []Cache {
951	if page.clr.IsEmpty() {
952		return nil
953	}
954	return *page.clr.Value
955}
956
957// Creates a new instance of the CachesListResultPage type.
958func NewCachesListResultPage(cur CachesListResult, getNextPage func(context.Context, CachesListResult) (CachesListResult, error)) CachesListResultPage {
959	return CachesListResultPage{
960		fn:  getNextPage,
961		clr: cur,
962	}
963}
964
965// CachesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
966type CachesStartFuture struct {
967	azure.FutureAPI
968	// Result returns the result of the asynchronous operation.
969	// If the operation has not completed it will return an error.
970	Result func(CachesClient) (autorest.Response, error)
971}
972
973// CachesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
974type CachesStopFuture struct {
975	azure.FutureAPI
976	// Result returns the result of the asynchronous operation.
977	// If the operation has not completed it will return an error.
978	Result func(CachesClient) (autorest.Response, error)
979}
980
981// CachesUpgradeFirmwareFuture an abstraction for monitoring and retrieving the results of a long-running
982// operation.
983type CachesUpgradeFirmwareFuture struct {
984	azure.FutureAPI
985	// Result returns the result of the asynchronous operation.
986	// If the operation has not completed it will return an error.
987	Result func(CachesClient) (autorest.Response, error)
988}
989
990// CacheUpgradeStatus properties describing the software upgrade state of the Cache.
991type CacheUpgradeStatus struct {
992	// CurrentFirmwareVersion - READ-ONLY; Version string of the firmware currently installed on this Cache.
993	CurrentFirmwareVersion *string `json:"currentFirmwareVersion,omitempty"`
994	// 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'
995	FirmwareUpdateStatus FirmwareStatusType `json:"firmwareUpdateStatus,omitempty"`
996	// FirmwareUpdateDeadline - READ-ONLY; Time at which the pending firmware update will automatically be installed on the Cache.
997	FirmwareUpdateDeadline *date.Time `json:"firmwareUpdateDeadline,omitempty"`
998	// LastFirmwareUpdate - READ-ONLY; Time of the last successful firmware update.
999	LastFirmwareUpdate *date.Time `json:"lastFirmwareUpdate,omitempty"`
1000	// PendingFirmwareVersion - READ-ONLY; When firmwareUpdateAvailable is true, this field holds the version string for the update.
1001	PendingFirmwareVersion *string `json:"pendingFirmwareVersion,omitempty"`
1002}
1003
1004// CacheUsernameDownloadSettings settings for Extended Groups username and group download.
1005type CacheUsernameDownloadSettings struct {
1006	// ExtendedGroups - Whether or not Extended Groups is enabled.
1007	ExtendedGroups *bool `json:"extendedGroups,omitempty"`
1008	// UsernameSource - This setting determines how the cache gets username and group names for clients. Possible values include: 'UsernameSourceAD', 'UsernameSourceLDAP', 'UsernameSourceFile', 'UsernameSourceNone'
1009	UsernameSource UsernameSource `json:"usernameSource,omitempty"`
1010	// GroupFileURI - The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'.
1011	GroupFileURI *string `json:"groupFileURI,omitempty"`
1012	// UserFileURI - The URI of the file containing user information (in /etc/passwd file format). This field must be populated when 'usernameSource' is set to 'File'.
1013	UserFileURI *string `json:"userFileURI,omitempty"`
1014	// LdapServer - The fully qualified domain name or IP address of the LDAP server to use.
1015	LdapServer *string `json:"ldapServer,omitempty"`
1016	// LdapBaseDN - The base distinguished name for the LDAP domain.
1017	LdapBaseDN *string `json:"ldapBaseDN,omitempty"`
1018	// EncryptLdapConnection - Whether or not the LDAP connection should be encrypted.
1019	EncryptLdapConnection *bool `json:"encryptLdapConnection,omitempty"`
1020	// RequireValidCertificate - Determines if the certificates must be validated by a certificate authority. When true, caCertificateURI must be provided.
1021	RequireValidCertificate *bool `json:"requireValidCertificate,omitempty"`
1022	// AutoDownloadCertificate - Determines if the certificate should be automatically downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true.
1023	AutoDownloadCertificate *bool `json:"autoDownloadCertificate,omitempty"`
1024	// CaCertificateURI - The URI of the CA certificate to validate the LDAP secure connection. This field must be populated when 'requireValidCertificate' is set to true.
1025	CaCertificateURI *string `json:"caCertificateURI,omitempty"`
1026	// UsernameDownloaded - READ-ONLY; Indicates whether or not the HPC Cache has performed the username download successfully. Possible values include: 'UsernameDownloadedTypeYes', 'UsernameDownloadedTypeNo', 'UsernameDownloadedTypeError'
1027	UsernameDownloaded UsernameDownloadedType `json:"usernameDownloaded,omitempty"`
1028	// Credentials - When present, these are the credentials for the secure LDAP connection.
1029	Credentials *CacheUsernameDownloadSettingsCredentials `json:"credentials,omitempty"`
1030}
1031
1032// MarshalJSON is the custom marshaler for CacheUsernameDownloadSettings.
1033func (cuds CacheUsernameDownloadSettings) MarshalJSON() ([]byte, error) {
1034	objectMap := make(map[string]interface{})
1035	if cuds.ExtendedGroups != nil {
1036		objectMap["extendedGroups"] = cuds.ExtendedGroups
1037	}
1038	if cuds.UsernameSource != "" {
1039		objectMap["usernameSource"] = cuds.UsernameSource
1040	}
1041	if cuds.GroupFileURI != nil {
1042		objectMap["groupFileURI"] = cuds.GroupFileURI
1043	}
1044	if cuds.UserFileURI != nil {
1045		objectMap["userFileURI"] = cuds.UserFileURI
1046	}
1047	if cuds.LdapServer != nil {
1048		objectMap["ldapServer"] = cuds.LdapServer
1049	}
1050	if cuds.LdapBaseDN != nil {
1051		objectMap["ldapBaseDN"] = cuds.LdapBaseDN
1052	}
1053	if cuds.EncryptLdapConnection != nil {
1054		objectMap["encryptLdapConnection"] = cuds.EncryptLdapConnection
1055	}
1056	if cuds.RequireValidCertificate != nil {
1057		objectMap["requireValidCertificate"] = cuds.RequireValidCertificate
1058	}
1059	if cuds.AutoDownloadCertificate != nil {
1060		objectMap["autoDownloadCertificate"] = cuds.AutoDownloadCertificate
1061	}
1062	if cuds.CaCertificateURI != nil {
1063		objectMap["caCertificateURI"] = cuds.CaCertificateURI
1064	}
1065	if cuds.Credentials != nil {
1066		objectMap["credentials"] = cuds.Credentials
1067	}
1068	return json.Marshal(objectMap)
1069}
1070
1071// CacheUsernameDownloadSettingsCredentials when present, these are the credentials for the secure LDAP
1072// connection.
1073type CacheUsernameDownloadSettingsCredentials struct {
1074	// BindDn - The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is stored encrypted and not returned on response.
1075	BindDn *string `json:"bindDn,omitempty"`
1076	// BindPassword - The Bind password to be used in the secure LDAP connection. This value is stored encrypted and not returned on response.
1077	BindPassword *string `json:"bindPassword,omitempty"`
1078}
1079
1080// ClfsTarget properties pertaining to the ClfsTarget
1081type ClfsTarget struct {
1082	// Target - Resource ID of storage container.
1083	Target *string `json:"target,omitempty"`
1084}
1085
1086// ClfsTargetProperties storage container for use as a CLFS Storage Target.
1087type ClfsTargetProperties struct {
1088	// Junctions - List of Cache namespace junctions to target for namespace associations.
1089	Junctions *[]NamespaceJunction `json:"junctions,omitempty"`
1090	// 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'
1091	ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
1092	// Nfs3 - Properties when targetType is nfs3.
1093	Nfs3 *Nfs3Target `json:"nfs3,omitempty"`
1094	// Clfs - Properties when targetType is clfs.
1095	Clfs *ClfsTarget `json:"clfs,omitempty"`
1096	// Unknown - Properties when targetType is unknown.
1097	Unknown *UnknownTarget `json:"unknown,omitempty"`
1098	// TargetType - Possible values include: 'TargetTypeStorageTargetProperties', 'TargetTypeNfs3', 'TargetTypeClfs', 'TargetTypeUnknown'
1099	TargetType TargetType `json:"targetType,omitempty"`
1100}
1101
1102// MarshalJSON is the custom marshaler for ClfsTargetProperties.
1103func (ctp ClfsTargetProperties) MarshalJSON() ([]byte, error) {
1104	ctp.TargetType = TargetTypeClfs
1105	objectMap := make(map[string]interface{})
1106	if ctp.Junctions != nil {
1107		objectMap["junctions"] = ctp.Junctions
1108	}
1109	if ctp.ProvisioningState != "" {
1110		objectMap["provisioningState"] = ctp.ProvisioningState
1111	}
1112	if ctp.Nfs3 != nil {
1113		objectMap["nfs3"] = ctp.Nfs3
1114	}
1115	if ctp.Clfs != nil {
1116		objectMap["clfs"] = ctp.Clfs
1117	}
1118	if ctp.Unknown != nil {
1119		objectMap["unknown"] = ctp.Unknown
1120	}
1121	if ctp.TargetType != "" {
1122		objectMap["targetType"] = ctp.TargetType
1123	}
1124	return json.Marshal(objectMap)
1125}
1126
1127// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties.
1128func (ctp ClfsTargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) {
1129	return nil, false
1130}
1131
1132// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties.
1133func (ctp ClfsTargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) {
1134	return &ctp, true
1135}
1136
1137// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties.
1138func (ctp ClfsTargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) {
1139	return nil, false
1140}
1141
1142// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties.
1143func (ctp ClfsTargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) {
1144	return nil, false
1145}
1146
1147// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for ClfsTargetProperties.
1148func (ctp ClfsTargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) {
1149	return &ctp, true
1150}
1151
1152// CloudError an error response.
1153type CloudError struct {
1154	// Error - The body of the error.
1155	Error *CloudErrorBody `json:"error,omitempty"`
1156}
1157
1158// CloudErrorBody an error response.
1159type CloudErrorBody struct {
1160	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
1161	Code *string `json:"code,omitempty"`
1162	// Details - A list of additional details about the error.
1163	Details *[]CloudErrorBody `json:"details,omitempty"`
1164	// Message - A message describing the error, intended to be suitable for display in a user interface.
1165	Message *string `json:"message,omitempty"`
1166	// Target - The target of the particular error. For example, the name of the property in error.
1167	Target *string `json:"target,omitempty"`
1168}
1169
1170// ErrorResponse describes the format of Error response.
1171type ErrorResponse struct {
1172	// Code - Error code
1173	Code *string `json:"code,omitempty"`
1174	// Message - Error message indicating why the operation failed.
1175	Message *string `json:"message,omitempty"`
1176}
1177
1178// KeyVaultKeyReference describes a reference to Key Vault Key.
1179type KeyVaultKeyReference struct {
1180	// KeyURL - The URL referencing a key encryption key in Key Vault.
1181	KeyURL *string `json:"keyUrl,omitempty"`
1182	// SourceVault - Describes a resource Id to source Key Vault.
1183	SourceVault *KeyVaultKeyReferenceSourceVault `json:"sourceVault,omitempty"`
1184}
1185
1186// KeyVaultKeyReferenceSourceVault describes a resource Id to source Key Vault.
1187type KeyVaultKeyReferenceSourceVault struct {
1188	// ID - Resource Id.
1189	ID *string `json:"id,omitempty"`
1190}
1191
1192// MetricDimension specifications of the Dimension of metrics.
1193type MetricDimension struct {
1194	// Name - Name of the dimension
1195	Name *string `json:"name,omitempty"`
1196	// DisplayName - Localized friendly display name of the dimension
1197	DisplayName *string `json:"displayName,omitempty"`
1198	// InternalName - Internal name of the dimension.
1199	InternalName *string `json:"internalName,omitempty"`
1200	// ToBeExportedForShoebox - To be exported to shoe box.
1201	ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"`
1202}
1203
1204// MetricSpecification details about operation related to metrics.
1205type MetricSpecification struct {
1206	// Name - The name of the metric.
1207	Name *string `json:"name,omitempty"`
1208	// DisplayName - Localized display name of the metric.
1209	DisplayName *string `json:"displayName,omitempty"`
1210	// DisplayDescription - The description of the metric.
1211	DisplayDescription *string `json:"displayDescription,omitempty"`
1212	// Unit - The unit that the metric is measured in.
1213	Unit *string `json:"unit,omitempty"`
1214	// AggregationType - The type of metric aggregation.
1215	AggregationType *string `json:"aggregationType,omitempty"`
1216	// SupportedAggregationTypes - Support metric aggregation type.
1217	SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"`
1218	// MetricClass - Type of metrics.
1219	MetricClass *string `json:"metricClass,omitempty"`
1220	// Dimensions - Dimensions of the metric
1221	Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
1222}
1223
1224// NamespaceJunction a namespace junction.
1225type NamespaceJunction struct {
1226	// NamespacePath - Namespace path on a Cache for a Storage Target.
1227	NamespacePath *string `json:"namespacePath,omitempty"`
1228	// TargetPath - Path in Storage Target to which namespacePath points.
1229	TargetPath *string `json:"targetPath,omitempty"`
1230	// NfsExport - NFS export where targetPath exists.
1231	NfsExport *string `json:"nfsExport,omitempty"`
1232	// NfsAccessPolicy - Name of the access policy applied to this junction.
1233	NfsAccessPolicy *string `json:"nfsAccessPolicy,omitempty"`
1234}
1235
1236// Nfs3Target properties pertaining to the Nfs3Target
1237type Nfs3Target struct {
1238	// Target - IP address or host name of an NFSv3 host (e.g., 10.0.44.44).
1239	Target *string `json:"target,omitempty"`
1240	// UsageModel - Identifies the usage model to be used for this Storage Target. Get choices from .../usageModels
1241	UsageModel *string `json:"usageModel,omitempty"`
1242}
1243
1244// Nfs3TargetProperties an NFSv3 mount point for use as a Storage Target.
1245type Nfs3TargetProperties struct {
1246	// Junctions - List of Cache namespace junctions to target for namespace associations.
1247	Junctions *[]NamespaceJunction `json:"junctions,omitempty"`
1248	// 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'
1249	ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
1250	// Nfs3 - Properties when targetType is nfs3.
1251	Nfs3 *Nfs3Target `json:"nfs3,omitempty"`
1252	// Clfs - Properties when targetType is clfs.
1253	Clfs *ClfsTarget `json:"clfs,omitempty"`
1254	// Unknown - Properties when targetType is unknown.
1255	Unknown *UnknownTarget `json:"unknown,omitempty"`
1256	// TargetType - Possible values include: 'TargetTypeStorageTargetProperties', 'TargetTypeNfs3', 'TargetTypeClfs', 'TargetTypeUnknown'
1257	TargetType TargetType `json:"targetType,omitempty"`
1258}
1259
1260// MarshalJSON is the custom marshaler for Nfs3TargetProperties.
1261func (n3tp Nfs3TargetProperties) MarshalJSON() ([]byte, error) {
1262	n3tp.TargetType = TargetTypeNfs3
1263	objectMap := make(map[string]interface{})
1264	if n3tp.Junctions != nil {
1265		objectMap["junctions"] = n3tp.Junctions
1266	}
1267	if n3tp.ProvisioningState != "" {
1268		objectMap["provisioningState"] = n3tp.ProvisioningState
1269	}
1270	if n3tp.Nfs3 != nil {
1271		objectMap["nfs3"] = n3tp.Nfs3
1272	}
1273	if n3tp.Clfs != nil {
1274		objectMap["clfs"] = n3tp.Clfs
1275	}
1276	if n3tp.Unknown != nil {
1277		objectMap["unknown"] = n3tp.Unknown
1278	}
1279	if n3tp.TargetType != "" {
1280		objectMap["targetType"] = n3tp.TargetType
1281	}
1282	return json.Marshal(objectMap)
1283}
1284
1285// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties.
1286func (n3tp Nfs3TargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) {
1287	return &n3tp, true
1288}
1289
1290// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties.
1291func (n3tp Nfs3TargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) {
1292	return nil, false
1293}
1294
1295// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties.
1296func (n3tp Nfs3TargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) {
1297	return nil, false
1298}
1299
1300// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties.
1301func (n3tp Nfs3TargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) {
1302	return nil, false
1303}
1304
1305// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for Nfs3TargetProperties.
1306func (n3tp Nfs3TargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) {
1307	return &n3tp, true
1308}
1309
1310// NfsAccessPolicy a set of rules describing access policies applied to NFSv3 clients of the cache.
1311type NfsAccessPolicy struct {
1312	// Name - Name identifying this policy. Access Policy names are not case sensitive.
1313	Name *string `json:"name,omitempty"`
1314	// AccessRules - The set of rules describing client accesses allowed under this policy.
1315	AccessRules *[]NfsAccessRule `json:"accessRules,omitempty"`
1316}
1317
1318// NfsAccessRule rule to place restrictions on portions of the cache namespace being presented to clients.
1319type NfsAccessRule struct {
1320	// Scope - Scope for this rule. The scope and filter determine which clients match the rule. Possible values include: 'Default', 'Network', 'Host'
1321	Scope NfsAccessRuleScope `json:"scope,omitempty"`
1322	// Filter - Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not match any filter rule and there is no default rule, access is denied.
1323	Filter *string `json:"filter,omitempty"`
1324	// Access - Access allowed by this rule. Possible values include: 'NfsAccessRuleAccessNo', 'NfsAccessRuleAccessRo', 'NfsAccessRuleAccessRw'
1325	Access NfsAccessRuleAccess `json:"access,omitempty"`
1326	// Suid - Allow SUID semantics.
1327	Suid *bool `json:"suid,omitempty"`
1328	// SubmountAccess - For the default policy, allow access to subdirectories under the root export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like '/a/b'.
1329	SubmountAccess *bool `json:"submountAccess,omitempty"`
1330	// RootSquash - Map root accesses to anonymousUID and anonymousGID.
1331	RootSquash *bool `json:"rootSquash,omitempty"`
1332	// AnonymousUID - UID value that replaces 0 when rootSquash is true.
1333	AnonymousUID *string `json:"anonymousUID,omitempty"`
1334	// AnonymousGID - GID value that replaces 0 when rootSquash is true.
1335	AnonymousGID *string `json:"anonymousGID,omitempty"`
1336}
1337
1338// ResourceSku a resource SKU.
1339type ResourceSku struct {
1340	// ResourceType - READ-ONLY; The type of resource the SKU applies to.
1341	ResourceType *string `json:"resourceType,omitempty"`
1342	// Capabilities - A list of capabilities of this SKU, such as throughput or ops/sec.
1343	Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"`
1344	// Locations - READ-ONLY; The set of locations where the SKU is available. This is the supported and registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.).
1345	Locations *[]string `json:"locations,omitempty"`
1346	// LocationInfo - The set of locations where the SKU is available.
1347	LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"`
1348	// Name - The name of this SKU.
1349	Name *string `json:"name,omitempty"`
1350	// Restrictions - The restrictions preventing this SKU from being used. This is empty if there are no restrictions.
1351	Restrictions *[]Restriction `json:"restrictions,omitempty"`
1352}
1353
1354// MarshalJSON is the custom marshaler for ResourceSku.
1355func (rs ResourceSku) MarshalJSON() ([]byte, error) {
1356	objectMap := make(map[string]interface{})
1357	if rs.Capabilities != nil {
1358		objectMap["capabilities"] = rs.Capabilities
1359	}
1360	if rs.LocationInfo != nil {
1361		objectMap["locationInfo"] = rs.LocationInfo
1362	}
1363	if rs.Name != nil {
1364		objectMap["name"] = rs.Name
1365	}
1366	if rs.Restrictions != nil {
1367		objectMap["restrictions"] = rs.Restrictions
1368	}
1369	return json.Marshal(objectMap)
1370}
1371
1372// ResourceSkuCapabilities a resource SKU capability.
1373type ResourceSkuCapabilities struct {
1374	// Name - Name of a capability, such as ops/sec.
1375	Name *string `json:"name,omitempty"`
1376	// Value - Quantity, if the capability is measured by quantity.
1377	Value *string `json:"value,omitempty"`
1378}
1379
1380// ResourceSkuLocationInfo resource SKU location information.
1381type ResourceSkuLocationInfo struct {
1382	// Location - Location where this SKU is available.
1383	Location *string `json:"location,omitempty"`
1384	// Zones - Zones if any.
1385	Zones *[]string `json:"zones,omitempty"`
1386}
1387
1388// ResourceSkusResult the response from the List Cache SKUs operation.
1389type ResourceSkusResult struct {
1390	autorest.Response `json:"-"`
1391	// NextLink - The URI to fetch the next page of Cache SKUs.
1392	NextLink *string `json:"nextLink,omitempty"`
1393	// Value - READ-ONLY; The list of SKUs available for the subscription.
1394	Value *[]ResourceSku `json:"value,omitempty"`
1395}
1396
1397// MarshalJSON is the custom marshaler for ResourceSkusResult.
1398func (rsr ResourceSkusResult) MarshalJSON() ([]byte, error) {
1399	objectMap := make(map[string]interface{})
1400	if rsr.NextLink != nil {
1401		objectMap["nextLink"] = rsr.NextLink
1402	}
1403	return json.Marshal(objectMap)
1404}
1405
1406// ResourceSkusResultIterator provides access to a complete listing of ResourceSku values.
1407type ResourceSkusResultIterator struct {
1408	i    int
1409	page ResourceSkusResultPage
1410}
1411
1412// NextWithContext advances to the next value.  If there was an error making
1413// the request the iterator does not advance and the error is returned.
1414func (iter *ResourceSkusResultIterator) NextWithContext(ctx context.Context) (err error) {
1415	if tracing.IsEnabled() {
1416		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultIterator.NextWithContext")
1417		defer func() {
1418			sc := -1
1419			if iter.Response().Response.Response != nil {
1420				sc = iter.Response().Response.Response.StatusCode
1421			}
1422			tracing.EndSpan(ctx, sc, err)
1423		}()
1424	}
1425	iter.i++
1426	if iter.i < len(iter.page.Values()) {
1427		return nil
1428	}
1429	err = iter.page.NextWithContext(ctx)
1430	if err != nil {
1431		iter.i--
1432		return err
1433	}
1434	iter.i = 0
1435	return nil
1436}
1437
1438// Next advances to the next value.  If there was an error making
1439// the request the iterator does not advance and the error is returned.
1440// Deprecated: Use NextWithContext() instead.
1441func (iter *ResourceSkusResultIterator) Next() error {
1442	return iter.NextWithContext(context.Background())
1443}
1444
1445// NotDone returns true if the enumeration should be started or is not yet complete.
1446func (iter ResourceSkusResultIterator) NotDone() bool {
1447	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1448}
1449
1450// Response returns the raw server response from the last page request.
1451func (iter ResourceSkusResultIterator) Response() ResourceSkusResult {
1452	return iter.page.Response()
1453}
1454
1455// Value returns the current value or a zero-initialized value if the
1456// iterator has advanced beyond the end of the collection.
1457func (iter ResourceSkusResultIterator) Value() ResourceSku {
1458	if !iter.page.NotDone() {
1459		return ResourceSku{}
1460	}
1461	return iter.page.Values()[iter.i]
1462}
1463
1464// Creates a new instance of the ResourceSkusResultIterator type.
1465func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResultIterator {
1466	return ResourceSkusResultIterator{page: page}
1467}
1468
1469// IsEmpty returns true if the ListResult contains no values.
1470func (rsr ResourceSkusResult) IsEmpty() bool {
1471	return rsr.Value == nil || len(*rsr.Value) == 0
1472}
1473
1474// hasNextLink returns true if the NextLink is not empty.
1475func (rsr ResourceSkusResult) hasNextLink() bool {
1476	return rsr.NextLink != nil && len(*rsr.NextLink) != 0
1477}
1478
1479// resourceSkusResultPreparer prepares a request to retrieve the next set of results.
1480// It returns nil if no more results exist.
1481func (rsr ResourceSkusResult) resourceSkusResultPreparer(ctx context.Context) (*http.Request, error) {
1482	if !rsr.hasNextLink() {
1483		return nil, nil
1484	}
1485	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1486		autorest.AsJSON(),
1487		autorest.AsGet(),
1488		autorest.WithBaseURL(to.String(rsr.NextLink)))
1489}
1490
1491// ResourceSkusResultPage contains a page of ResourceSku values.
1492type ResourceSkusResultPage struct {
1493	fn  func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)
1494	rsr ResourceSkusResult
1495}
1496
1497// NextWithContext advances to the next page of values.  If there was an error making
1498// the request the page does not advance and the error is returned.
1499func (page *ResourceSkusResultPage) NextWithContext(ctx context.Context) (err error) {
1500	if tracing.IsEnabled() {
1501		ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultPage.NextWithContext")
1502		defer func() {
1503			sc := -1
1504			if page.Response().Response.Response != nil {
1505				sc = page.Response().Response.Response.StatusCode
1506			}
1507			tracing.EndSpan(ctx, sc, err)
1508		}()
1509	}
1510	for {
1511		next, err := page.fn(ctx, page.rsr)
1512		if err != nil {
1513			return err
1514		}
1515		page.rsr = next
1516		if !next.hasNextLink() || !next.IsEmpty() {
1517			break
1518		}
1519	}
1520	return nil
1521}
1522
1523// Next advances to the next page of values.  If there was an error making
1524// the request the page does not advance and the error is returned.
1525// Deprecated: Use NextWithContext() instead.
1526func (page *ResourceSkusResultPage) Next() error {
1527	return page.NextWithContext(context.Background())
1528}
1529
1530// NotDone returns true if the page enumeration should be started or is not yet complete.
1531func (page ResourceSkusResultPage) NotDone() bool {
1532	return !page.rsr.IsEmpty()
1533}
1534
1535// Response returns the raw server response from the last page request.
1536func (page ResourceSkusResultPage) Response() ResourceSkusResult {
1537	return page.rsr
1538}
1539
1540// Values returns the slice of values for the current page or nil if there are no values.
1541func (page ResourceSkusResultPage) Values() []ResourceSku {
1542	if page.rsr.IsEmpty() {
1543		return nil
1544	}
1545	return *page.rsr.Value
1546}
1547
1548// Creates a new instance of the ResourceSkusResultPage type.
1549func NewResourceSkusResultPage(cur ResourceSkusResult, getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage {
1550	return ResourceSkusResultPage{
1551		fn:  getNextPage,
1552		rsr: cur,
1553	}
1554}
1555
1556// Restriction the restrictions preventing this SKU from being used.
1557type Restriction struct {
1558	// Type - READ-ONLY; The type of restrictions. In this version, the only possible value for this is location.
1559	Type *string `json:"type,omitempty"`
1560	// Values - READ-ONLY; The value of restrictions. If the restriction type is set to location, then this would be the different locations where the SKU is restricted.
1561	Values *[]string `json:"values,omitempty"`
1562	// ReasonCode - The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. Possible values include: 'QuotaID', 'NotAvailableForSubscription'
1563	ReasonCode ReasonCode `json:"reasonCode,omitempty"`
1564}
1565
1566// MarshalJSON is the custom marshaler for Restriction.
1567func (r Restriction) MarshalJSON() ([]byte, error) {
1568	objectMap := make(map[string]interface{})
1569	if r.ReasonCode != "" {
1570		objectMap["reasonCode"] = r.ReasonCode
1571	}
1572	return json.Marshal(objectMap)
1573}
1574
1575// StorageTarget type of the Storage Target.
1576type StorageTarget struct {
1577	autorest.Response `json:"-"`
1578	// BasicStorageTargetProperties - StorageTarget properties
1579	BasicStorageTargetProperties `json:"properties,omitempty"`
1580	// Name - READ-ONLY; Name of the Storage Target.
1581	Name *string `json:"name,omitempty"`
1582	// ID - READ-ONLY; Resource ID of the Storage Target.
1583	ID *string `json:"id,omitempty"`
1584	// Type - READ-ONLY; Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget
1585	Type *string `json:"type,omitempty"`
1586	// Location - READ-ONLY; Region name string.
1587	Location *string `json:"location,omitempty"`
1588	// SystemData - READ-ONLY; The system meta data relating to this resource.
1589	SystemData *SystemData `json:"systemData,omitempty"`
1590}
1591
1592// MarshalJSON is the custom marshaler for StorageTarget.
1593func (st StorageTarget) MarshalJSON() ([]byte, error) {
1594	objectMap := make(map[string]interface{})
1595	objectMap["properties"] = st.BasicStorageTargetProperties
1596	return json.Marshal(objectMap)
1597}
1598
1599// UnmarshalJSON is the custom unmarshaler for StorageTarget struct.
1600func (st *StorageTarget) UnmarshalJSON(body []byte) error {
1601	var m map[string]*json.RawMessage
1602	err := json.Unmarshal(body, &m)
1603	if err != nil {
1604		return err
1605	}
1606	for k, v := range m {
1607		switch k {
1608		case "properties":
1609			if v != nil {
1610				basicStorageTargetProperties, err := unmarshalBasicStorageTargetProperties(*v)
1611				if err != nil {
1612					return err
1613				}
1614				st.BasicStorageTargetProperties = basicStorageTargetProperties
1615			}
1616		case "name":
1617			if v != nil {
1618				var name string
1619				err = json.Unmarshal(*v, &name)
1620				if err != nil {
1621					return err
1622				}
1623				st.Name = &name
1624			}
1625		case "id":
1626			if v != nil {
1627				var ID string
1628				err = json.Unmarshal(*v, &ID)
1629				if err != nil {
1630					return err
1631				}
1632				st.ID = &ID
1633			}
1634		case "type":
1635			if v != nil {
1636				var typeVar string
1637				err = json.Unmarshal(*v, &typeVar)
1638				if err != nil {
1639					return err
1640				}
1641				st.Type = &typeVar
1642			}
1643		case "location":
1644			if v != nil {
1645				var location string
1646				err = json.Unmarshal(*v, &location)
1647				if err != nil {
1648					return err
1649				}
1650				st.Location = &location
1651			}
1652		case "systemData":
1653			if v != nil {
1654				var systemData SystemData
1655				err = json.Unmarshal(*v, &systemData)
1656				if err != nil {
1657					return err
1658				}
1659				st.SystemData = &systemData
1660			}
1661		}
1662	}
1663
1664	return nil
1665}
1666
1667// BasicStorageTargetProperties properties of the Storage Target.
1668type BasicStorageTargetProperties interface {
1669	AsNfs3TargetProperties() (*Nfs3TargetProperties, bool)
1670	AsClfsTargetProperties() (*ClfsTargetProperties, bool)
1671	AsUnknownTargetProperties() (*UnknownTargetProperties, bool)
1672	AsStorageTargetProperties() (*StorageTargetProperties, bool)
1673}
1674
1675// StorageTargetProperties properties of the Storage Target.
1676type StorageTargetProperties struct {
1677	// Junctions - List of Cache namespace junctions to target for namespace associations.
1678	Junctions *[]NamespaceJunction `json:"junctions,omitempty"`
1679	// 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'
1680	ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
1681	// Nfs3 - Properties when targetType is nfs3.
1682	Nfs3 *Nfs3Target `json:"nfs3,omitempty"`
1683	// Clfs - Properties when targetType is clfs.
1684	Clfs *ClfsTarget `json:"clfs,omitempty"`
1685	// Unknown - Properties when targetType is unknown.
1686	Unknown *UnknownTarget `json:"unknown,omitempty"`
1687	// TargetType - Possible values include: 'TargetTypeStorageTargetProperties', 'TargetTypeNfs3', 'TargetTypeClfs', 'TargetTypeUnknown'
1688	TargetType TargetType `json:"targetType,omitempty"`
1689}
1690
1691func unmarshalBasicStorageTargetProperties(body []byte) (BasicStorageTargetProperties, error) {
1692	var m map[string]interface{}
1693	err := json.Unmarshal(body, &m)
1694	if err != nil {
1695		return nil, err
1696	}
1697
1698	switch m["targetType"] {
1699	case string(TargetTypeNfs3):
1700		var n3tp Nfs3TargetProperties
1701		err := json.Unmarshal(body, &n3tp)
1702		return n3tp, err
1703	case string(TargetTypeClfs):
1704		var ctp ClfsTargetProperties
1705		err := json.Unmarshal(body, &ctp)
1706		return ctp, err
1707	case string(TargetTypeUnknown):
1708		var utp UnknownTargetProperties
1709		err := json.Unmarshal(body, &utp)
1710		return utp, err
1711	default:
1712		var stp StorageTargetProperties
1713		err := json.Unmarshal(body, &stp)
1714		return stp, err
1715	}
1716}
1717func unmarshalBasicStorageTargetPropertiesArray(body []byte) ([]BasicStorageTargetProperties, error) {
1718	var rawMessages []*json.RawMessage
1719	err := json.Unmarshal(body, &rawMessages)
1720	if err != nil {
1721		return nil, err
1722	}
1723
1724	stpArray := make([]BasicStorageTargetProperties, len(rawMessages))
1725
1726	for index, rawMessage := range rawMessages {
1727		stp, err := unmarshalBasicStorageTargetProperties(*rawMessage)
1728		if err != nil {
1729			return nil, err
1730		}
1731		stpArray[index] = stp
1732	}
1733	return stpArray, nil
1734}
1735
1736// MarshalJSON is the custom marshaler for StorageTargetProperties.
1737func (stp StorageTargetProperties) MarshalJSON() ([]byte, error) {
1738	stp.TargetType = TargetTypeStorageTargetProperties
1739	objectMap := make(map[string]interface{})
1740	if stp.Junctions != nil {
1741		objectMap["junctions"] = stp.Junctions
1742	}
1743	if stp.ProvisioningState != "" {
1744		objectMap["provisioningState"] = stp.ProvisioningState
1745	}
1746	if stp.Nfs3 != nil {
1747		objectMap["nfs3"] = stp.Nfs3
1748	}
1749	if stp.Clfs != nil {
1750		objectMap["clfs"] = stp.Clfs
1751	}
1752	if stp.Unknown != nil {
1753		objectMap["unknown"] = stp.Unknown
1754	}
1755	if stp.TargetType != "" {
1756		objectMap["targetType"] = stp.TargetType
1757	}
1758	return json.Marshal(objectMap)
1759}
1760
1761// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties.
1762func (stp StorageTargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) {
1763	return nil, false
1764}
1765
1766// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties.
1767func (stp StorageTargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) {
1768	return nil, false
1769}
1770
1771// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties.
1772func (stp StorageTargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) {
1773	return nil, false
1774}
1775
1776// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties.
1777func (stp StorageTargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) {
1778	return &stp, true
1779}
1780
1781// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for StorageTargetProperties.
1782func (stp StorageTargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) {
1783	return &stp, true
1784}
1785
1786// StorageTargetResource resource used by a Cache.
1787type StorageTargetResource struct {
1788	// Name - READ-ONLY; Name of the Storage Target.
1789	Name *string `json:"name,omitempty"`
1790	// ID - READ-ONLY; Resource ID of the Storage Target.
1791	ID *string `json:"id,omitempty"`
1792	// Type - READ-ONLY; Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget
1793	Type *string `json:"type,omitempty"`
1794	// Location - READ-ONLY; Region name string.
1795	Location *string `json:"location,omitempty"`
1796	// SystemData - READ-ONLY; The system meta data relating to this resource.
1797	SystemData *SystemData `json:"systemData,omitempty"`
1798}
1799
1800// StorageTargetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
1801// long-running operation.
1802type StorageTargetsCreateOrUpdateFuture struct {
1803	azure.FutureAPI
1804	// Result returns the result of the asynchronous operation.
1805	// If the operation has not completed it will return an error.
1806	Result func(StorageTargetsClient) (StorageTarget, error)
1807}
1808
1809// StorageTargetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1810// operation.
1811type StorageTargetsDeleteFuture struct {
1812	azure.FutureAPI
1813	// Result returns the result of the asynchronous operation.
1814	// If the operation has not completed it will return an error.
1815	Result func(StorageTargetsClient) (autorest.Response, error)
1816}
1817
1818// StorageTargetsResult a list of Storage Targets.
1819type StorageTargetsResult struct {
1820	autorest.Response `json:"-"`
1821	// NextLink - The URI to fetch the next page of Storage Targets.
1822	NextLink *string `json:"nextLink,omitempty"`
1823	// Value - The list of Storage Targets defined for the Cache.
1824	Value *[]StorageTarget `json:"value,omitempty"`
1825}
1826
1827// StorageTargetsResultIterator provides access to a complete listing of StorageTarget values.
1828type StorageTargetsResultIterator struct {
1829	i    int
1830	page StorageTargetsResultPage
1831}
1832
1833// NextWithContext advances to the next value.  If there was an error making
1834// the request the iterator does not advance and the error is returned.
1835func (iter *StorageTargetsResultIterator) NextWithContext(ctx context.Context) (err error) {
1836	if tracing.IsEnabled() {
1837		ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsResultIterator.NextWithContext")
1838		defer func() {
1839			sc := -1
1840			if iter.Response().Response.Response != nil {
1841				sc = iter.Response().Response.Response.StatusCode
1842			}
1843			tracing.EndSpan(ctx, sc, err)
1844		}()
1845	}
1846	iter.i++
1847	if iter.i < len(iter.page.Values()) {
1848		return nil
1849	}
1850	err = iter.page.NextWithContext(ctx)
1851	if err != nil {
1852		iter.i--
1853		return err
1854	}
1855	iter.i = 0
1856	return nil
1857}
1858
1859// Next advances to the next value.  If there was an error making
1860// the request the iterator does not advance and the error is returned.
1861// Deprecated: Use NextWithContext() instead.
1862func (iter *StorageTargetsResultIterator) Next() error {
1863	return iter.NextWithContext(context.Background())
1864}
1865
1866// NotDone returns true if the enumeration should be started or is not yet complete.
1867func (iter StorageTargetsResultIterator) NotDone() bool {
1868	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1869}
1870
1871// Response returns the raw server response from the last page request.
1872func (iter StorageTargetsResultIterator) Response() StorageTargetsResult {
1873	return iter.page.Response()
1874}
1875
1876// Value returns the current value or a zero-initialized value if the
1877// iterator has advanced beyond the end of the collection.
1878func (iter StorageTargetsResultIterator) Value() StorageTarget {
1879	if !iter.page.NotDone() {
1880		return StorageTarget{}
1881	}
1882	return iter.page.Values()[iter.i]
1883}
1884
1885// Creates a new instance of the StorageTargetsResultIterator type.
1886func NewStorageTargetsResultIterator(page StorageTargetsResultPage) StorageTargetsResultIterator {
1887	return StorageTargetsResultIterator{page: page}
1888}
1889
1890// IsEmpty returns true if the ListResult contains no values.
1891func (str StorageTargetsResult) IsEmpty() bool {
1892	return str.Value == nil || len(*str.Value) == 0
1893}
1894
1895// hasNextLink returns true if the NextLink is not empty.
1896func (str StorageTargetsResult) hasNextLink() bool {
1897	return str.NextLink != nil && len(*str.NextLink) != 0
1898}
1899
1900// storageTargetsResultPreparer prepares a request to retrieve the next set of results.
1901// It returns nil if no more results exist.
1902func (str StorageTargetsResult) storageTargetsResultPreparer(ctx context.Context) (*http.Request, error) {
1903	if !str.hasNextLink() {
1904		return nil, nil
1905	}
1906	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1907		autorest.AsJSON(),
1908		autorest.AsGet(),
1909		autorest.WithBaseURL(to.String(str.NextLink)))
1910}
1911
1912// StorageTargetsResultPage contains a page of StorageTarget values.
1913type StorageTargetsResultPage struct {
1914	fn  func(context.Context, StorageTargetsResult) (StorageTargetsResult, error)
1915	str StorageTargetsResult
1916}
1917
1918// NextWithContext advances to the next page of values.  If there was an error making
1919// the request the page does not advance and the error is returned.
1920func (page *StorageTargetsResultPage) NextWithContext(ctx context.Context) (err error) {
1921	if tracing.IsEnabled() {
1922		ctx = tracing.StartSpan(ctx, fqdn+"/StorageTargetsResultPage.NextWithContext")
1923		defer func() {
1924			sc := -1
1925			if page.Response().Response.Response != nil {
1926				sc = page.Response().Response.Response.StatusCode
1927			}
1928			tracing.EndSpan(ctx, sc, err)
1929		}()
1930	}
1931	for {
1932		next, err := page.fn(ctx, page.str)
1933		if err != nil {
1934			return err
1935		}
1936		page.str = next
1937		if !next.hasNextLink() || !next.IsEmpty() {
1938			break
1939		}
1940	}
1941	return nil
1942}
1943
1944// Next advances to the next page of values.  If there was an error making
1945// the request the page does not advance and the error is returned.
1946// Deprecated: Use NextWithContext() instead.
1947func (page *StorageTargetsResultPage) Next() error {
1948	return page.NextWithContext(context.Background())
1949}
1950
1951// NotDone returns true if the page enumeration should be started or is not yet complete.
1952func (page StorageTargetsResultPage) NotDone() bool {
1953	return !page.str.IsEmpty()
1954}
1955
1956// Response returns the raw server response from the last page request.
1957func (page StorageTargetsResultPage) Response() StorageTargetsResult {
1958	return page.str
1959}
1960
1961// Values returns the slice of values for the current page or nil if there are no values.
1962func (page StorageTargetsResultPage) Values() []StorageTarget {
1963	if page.str.IsEmpty() {
1964		return nil
1965	}
1966	return *page.str.Value
1967}
1968
1969// Creates a new instance of the StorageTargetsResultPage type.
1970func NewStorageTargetsResultPage(cur StorageTargetsResult, getNextPage func(context.Context, StorageTargetsResult) (StorageTargetsResult, error)) StorageTargetsResultPage {
1971	return StorageTargetsResultPage{
1972		fn:  getNextPage,
1973		str: cur,
1974	}
1975}
1976
1977// SystemData metadata pertaining to creation and last modification of the resource.
1978type SystemData struct {
1979	// CreatedBy - The identity that created the resource.
1980	CreatedBy *string `json:"createdBy,omitempty"`
1981	// CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key'
1982	CreatedByType CreatedByType `json:"createdByType,omitempty"`
1983	// CreatedAt - The timestamp of resource creation (UTC).
1984	CreatedAt *date.Time `json:"createdAt,omitempty"`
1985	// LastModifiedBy - The identity that last modified the resource.
1986	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
1987	// LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key'
1988	LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
1989	// LastModifiedAt - The timestamp of resource last modification (UTC)
1990	LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
1991}
1992
1993// UnknownTarget properties pertaining to the UnknownTarget
1994type UnknownTarget struct {
1995	// UnknownMap - Dictionary of string->string pairs containing information about the Storage Target.
1996	UnknownMap map[string]*string `json:"unknownMap"`
1997}
1998
1999// MarshalJSON is the custom marshaler for UnknownTarget.
2000func (ut UnknownTarget) MarshalJSON() ([]byte, error) {
2001	objectMap := make(map[string]interface{})
2002	if ut.UnknownMap != nil {
2003		objectMap["unknownMap"] = ut.UnknownMap
2004	}
2005	return json.Marshal(objectMap)
2006}
2007
2008// UnknownTargetProperties storage container for use as an Unknown Storage Target.
2009type UnknownTargetProperties struct {
2010	// Junctions - List of Cache namespace junctions to target for namespace associations.
2011	Junctions *[]NamespaceJunction `json:"junctions,omitempty"`
2012	// 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'
2013	ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
2014	// Nfs3 - Properties when targetType is nfs3.
2015	Nfs3 *Nfs3Target `json:"nfs3,omitempty"`
2016	// Clfs - Properties when targetType is clfs.
2017	Clfs *ClfsTarget `json:"clfs,omitempty"`
2018	// Unknown - Properties when targetType is unknown.
2019	Unknown *UnknownTarget `json:"unknown,omitempty"`
2020	// TargetType - Possible values include: 'TargetTypeStorageTargetProperties', 'TargetTypeNfs3', 'TargetTypeClfs', 'TargetTypeUnknown'
2021	TargetType TargetType `json:"targetType,omitempty"`
2022}
2023
2024// MarshalJSON is the custom marshaler for UnknownTargetProperties.
2025func (utp UnknownTargetProperties) MarshalJSON() ([]byte, error) {
2026	utp.TargetType = TargetTypeUnknown
2027	objectMap := make(map[string]interface{})
2028	if utp.Junctions != nil {
2029		objectMap["junctions"] = utp.Junctions
2030	}
2031	if utp.ProvisioningState != "" {
2032		objectMap["provisioningState"] = utp.ProvisioningState
2033	}
2034	if utp.Nfs3 != nil {
2035		objectMap["nfs3"] = utp.Nfs3
2036	}
2037	if utp.Clfs != nil {
2038		objectMap["clfs"] = utp.Clfs
2039	}
2040	if utp.Unknown != nil {
2041		objectMap["unknown"] = utp.Unknown
2042	}
2043	if utp.TargetType != "" {
2044		objectMap["targetType"] = utp.TargetType
2045	}
2046	return json.Marshal(objectMap)
2047}
2048
2049// AsNfs3TargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties.
2050func (utp UnknownTargetProperties) AsNfs3TargetProperties() (*Nfs3TargetProperties, bool) {
2051	return nil, false
2052}
2053
2054// AsClfsTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties.
2055func (utp UnknownTargetProperties) AsClfsTargetProperties() (*ClfsTargetProperties, bool) {
2056	return nil, false
2057}
2058
2059// AsUnknownTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties.
2060func (utp UnknownTargetProperties) AsUnknownTargetProperties() (*UnknownTargetProperties, bool) {
2061	return &utp, true
2062}
2063
2064// AsStorageTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties.
2065func (utp UnknownTargetProperties) AsStorageTargetProperties() (*StorageTargetProperties, bool) {
2066	return nil, false
2067}
2068
2069// AsBasicStorageTargetProperties is the BasicStorageTargetProperties implementation for UnknownTargetProperties.
2070func (utp UnknownTargetProperties) AsBasicStorageTargetProperties() (BasicStorageTargetProperties, bool) {
2071	return &utp, true
2072}
2073
2074// UsageModel a usage model.
2075type UsageModel struct {
2076	// Display - Localized information describing this usage model.
2077	Display *UsageModelDisplay `json:"display,omitempty"`
2078	// ModelName - Non-localized keyword name for this usage model.
2079	ModelName *string `json:"modelName,omitempty"`
2080	// TargetType - The type of Storage Target to which this model is applicable (only nfs3 as of this version).
2081	TargetType *string `json:"targetType,omitempty"`
2082}
2083
2084// UsageModelDisplay localized information describing this usage model.
2085type UsageModelDisplay struct {
2086	// Description - String to display for this usage model.
2087	Description *string `json:"description,omitempty"`
2088}
2089
2090// UsageModelsResult a list of Cache usage models.
2091type UsageModelsResult struct {
2092	autorest.Response `json:"-"`
2093	// NextLink - The URI to fetch the next page of Cache usage models.
2094	NextLink *string `json:"nextLink,omitempty"`
2095	// Value - The list of usage models available for the subscription.
2096	Value *[]UsageModel `json:"value,omitempty"`
2097}
2098
2099// UsageModelsResultIterator provides access to a complete listing of UsageModel values.
2100type UsageModelsResultIterator struct {
2101	i    int
2102	page UsageModelsResultPage
2103}
2104
2105// NextWithContext advances to the next value.  If there was an error making
2106// the request the iterator does not advance and the error is returned.
2107func (iter *UsageModelsResultIterator) NextWithContext(ctx context.Context) (err error) {
2108	if tracing.IsEnabled() {
2109		ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsResultIterator.NextWithContext")
2110		defer func() {
2111			sc := -1
2112			if iter.Response().Response.Response != nil {
2113				sc = iter.Response().Response.Response.StatusCode
2114			}
2115			tracing.EndSpan(ctx, sc, err)
2116		}()
2117	}
2118	iter.i++
2119	if iter.i < len(iter.page.Values()) {
2120		return nil
2121	}
2122	err = iter.page.NextWithContext(ctx)
2123	if err != nil {
2124		iter.i--
2125		return err
2126	}
2127	iter.i = 0
2128	return nil
2129}
2130
2131// Next advances to the next value.  If there was an error making
2132// the request the iterator does not advance and the error is returned.
2133// Deprecated: Use NextWithContext() instead.
2134func (iter *UsageModelsResultIterator) Next() error {
2135	return iter.NextWithContext(context.Background())
2136}
2137
2138// NotDone returns true if the enumeration should be started or is not yet complete.
2139func (iter UsageModelsResultIterator) NotDone() bool {
2140	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2141}
2142
2143// Response returns the raw server response from the last page request.
2144func (iter UsageModelsResultIterator) Response() UsageModelsResult {
2145	return iter.page.Response()
2146}
2147
2148// Value returns the current value or a zero-initialized value if the
2149// iterator has advanced beyond the end of the collection.
2150func (iter UsageModelsResultIterator) Value() UsageModel {
2151	if !iter.page.NotDone() {
2152		return UsageModel{}
2153	}
2154	return iter.page.Values()[iter.i]
2155}
2156
2157// Creates a new instance of the UsageModelsResultIterator type.
2158func NewUsageModelsResultIterator(page UsageModelsResultPage) UsageModelsResultIterator {
2159	return UsageModelsResultIterator{page: page}
2160}
2161
2162// IsEmpty returns true if the ListResult contains no values.
2163func (umr UsageModelsResult) IsEmpty() bool {
2164	return umr.Value == nil || len(*umr.Value) == 0
2165}
2166
2167// hasNextLink returns true if the NextLink is not empty.
2168func (umr UsageModelsResult) hasNextLink() bool {
2169	return umr.NextLink != nil && len(*umr.NextLink) != 0
2170}
2171
2172// usageModelsResultPreparer prepares a request to retrieve the next set of results.
2173// It returns nil if no more results exist.
2174func (umr UsageModelsResult) usageModelsResultPreparer(ctx context.Context) (*http.Request, error) {
2175	if !umr.hasNextLink() {
2176		return nil, nil
2177	}
2178	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2179		autorest.AsJSON(),
2180		autorest.AsGet(),
2181		autorest.WithBaseURL(to.String(umr.NextLink)))
2182}
2183
2184// UsageModelsResultPage contains a page of UsageModel values.
2185type UsageModelsResultPage struct {
2186	fn  func(context.Context, UsageModelsResult) (UsageModelsResult, error)
2187	umr UsageModelsResult
2188}
2189
2190// NextWithContext advances to the next page of values.  If there was an error making
2191// the request the page does not advance and the error is returned.
2192func (page *UsageModelsResultPage) NextWithContext(ctx context.Context) (err error) {
2193	if tracing.IsEnabled() {
2194		ctx = tracing.StartSpan(ctx, fqdn+"/UsageModelsResultPage.NextWithContext")
2195		defer func() {
2196			sc := -1
2197			if page.Response().Response.Response != nil {
2198				sc = page.Response().Response.Response.StatusCode
2199			}
2200			tracing.EndSpan(ctx, sc, err)
2201		}()
2202	}
2203	for {
2204		next, err := page.fn(ctx, page.umr)
2205		if err != nil {
2206			return err
2207		}
2208		page.umr = next
2209		if !next.hasNextLink() || !next.IsEmpty() {
2210			break
2211		}
2212	}
2213	return nil
2214}
2215
2216// Next advances to the next page of values.  If there was an error making
2217// the request the page does not advance and the error is returned.
2218// Deprecated: Use NextWithContext() instead.
2219func (page *UsageModelsResultPage) Next() error {
2220	return page.NextWithContext(context.Background())
2221}
2222
2223// NotDone returns true if the page enumeration should be started or is not yet complete.
2224func (page UsageModelsResultPage) NotDone() bool {
2225	return !page.umr.IsEmpty()
2226}
2227
2228// Response returns the raw server response from the last page request.
2229func (page UsageModelsResultPage) Response() UsageModelsResult {
2230	return page.umr
2231}
2232
2233// Values returns the slice of values for the current page or nil if there are no values.
2234func (page UsageModelsResultPage) Values() []UsageModel {
2235	if page.umr.IsEmpty() {
2236		return nil
2237	}
2238	return *page.umr.Value
2239}
2240
2241// Creates a new instance of the UsageModelsResultPage type.
2242func NewUsageModelsResultPage(cur UsageModelsResult, getNextPage func(context.Context, UsageModelsResult) (UsageModelsResult, error)) UsageModelsResultPage {
2243	return UsageModelsResultPage{
2244		fn:  getNextPage,
2245		umr: cur,
2246	}
2247}
2248