1package storagepool
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"github.com/Azure/go-autorest/autorest/to"
15	"github.com/Azure/go-autorest/tracing"
16	"net/http"
17)
18
19// The package's fully qualified name.
20const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/storagepool/mgmt/2020-03-15-preview/storagepool"
21
22// ACL access Control List (ACL) for an iSCSI target lun
23type ACL struct {
24	// InitiatorIqn - iSCSI initiator iqn (iSCSI Qualified Name); example: iqn.2005-03.org.iscsi:client
25	InitiatorIqn *string `json:"initiatorIqn,omitempty"`
26	// MappedLuns - Array of lun names mapped to the ACL
27	MappedLuns *[]string `json:"mappedLuns,omitempty"`
28	// IscsiTargetCredentials - CHAP credentials for iSCSI target.
29	*IscsiTargetCredentials `json:"credentials,omitempty"`
30}
31
32// MarshalJSON is the custom marshaler for ACL.
33func (a ACL) MarshalJSON() ([]byte, error) {
34	objectMap := make(map[string]interface{})
35	if a.InitiatorIqn != nil {
36		objectMap["initiatorIqn"] = a.InitiatorIqn
37	}
38	if a.MappedLuns != nil {
39		objectMap["mappedLuns"] = a.MappedLuns
40	}
41	if a.IscsiTargetCredentials != nil {
42		objectMap["credentials"] = a.IscsiTargetCredentials
43	}
44	return json.Marshal(objectMap)
45}
46
47// UnmarshalJSON is the custom unmarshaler for ACL struct.
48func (a *ACL) UnmarshalJSON(body []byte) error {
49	var m map[string]*json.RawMessage
50	err := json.Unmarshal(body, &m)
51	if err != nil {
52		return err
53	}
54	for k, v := range m {
55		switch k {
56		case "initiatorIqn":
57			if v != nil {
58				var initiatorIqn string
59				err = json.Unmarshal(*v, &initiatorIqn)
60				if err != nil {
61					return err
62				}
63				a.InitiatorIqn = &initiatorIqn
64			}
65		case "mappedLuns":
66			if v != nil {
67				var mappedLuns []string
68				err = json.Unmarshal(*v, &mappedLuns)
69				if err != nil {
70					return err
71				}
72				a.MappedLuns = &mappedLuns
73			}
74		case "credentials":
75			if v != nil {
76				var iscsiTargetCredentials IscsiTargetCredentials
77				err = json.Unmarshal(*v, &iscsiTargetCredentials)
78				if err != nil {
79					return err
80				}
81				a.IscsiTargetCredentials = &iscsiTargetCredentials
82			}
83		}
84	}
85
86	return nil
87}
88
89// Attributes attributes of an iSCSI target
90type Attributes struct {
91	// Authentication - Indicates whether or not authentication is enabled on the ACL.
92	Authentication *bool `json:"authentication,omitempty"`
93	// ProdModeWriteProtect - Indicates whether or not write protect is enabled on the luns.
94	ProdModeWriteProtect *bool `json:"prodModeWriteProtect,omitempty"`
95}
96
97// Disk managed disk to attach to the DiskPool. Required.
98type Disk struct {
99	// ID - Unique Azure resource id of the managed disk. Required.
100	ID *string `json:"id,omitempty"`
101}
102
103// DiskPool request payload for Create or Update Disk Pool requests.
104type DiskPool struct {
105	autorest.Response `json:"-"`
106	// DiskPoolProperties - RP defined properties for Disk Pool operations.
107	*DiskPoolProperties `json:"properties,omitempty"`
108	// Sku - Sku description.
109	Sku *Sku `json:"sku,omitempty"`
110	// SystemData - READ-ONLY; Resource metadata required by ARM RPC
111	SystemData *SystemMetadata `json:"systemData,omitempty"`
112	// Tags - Resource tags.
113	Tags map[string]*string `json:"tags"`
114	// Location - The geo-location where the resource lives
115	Location *string `json:"location,omitempty"`
116	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
117	ID *string `json:"id,omitempty"`
118	// Name - READ-ONLY; The name of the resource
119	Name *string `json:"name,omitempty"`
120	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
121	Type *string `json:"type,omitempty"`
122}
123
124// MarshalJSON is the custom marshaler for DiskPool.
125func (dp DiskPool) MarshalJSON() ([]byte, error) {
126	objectMap := make(map[string]interface{})
127	if dp.DiskPoolProperties != nil {
128		objectMap["properties"] = dp.DiskPoolProperties
129	}
130	if dp.Sku != nil {
131		objectMap["sku"] = dp.Sku
132	}
133	if dp.Tags != nil {
134		objectMap["tags"] = dp.Tags
135	}
136	if dp.Location != nil {
137		objectMap["location"] = dp.Location
138	}
139	return json.Marshal(objectMap)
140}
141
142// UnmarshalJSON is the custom unmarshaler for DiskPool struct.
143func (dp *DiskPool) UnmarshalJSON(body []byte) error {
144	var m map[string]*json.RawMessage
145	err := json.Unmarshal(body, &m)
146	if err != nil {
147		return err
148	}
149	for k, v := range m {
150		switch k {
151		case "properties":
152			if v != nil {
153				var diskPoolProperties DiskPoolProperties
154				err = json.Unmarshal(*v, &diskPoolProperties)
155				if err != nil {
156					return err
157				}
158				dp.DiskPoolProperties = &diskPoolProperties
159			}
160		case "sku":
161			if v != nil {
162				var sku Sku
163				err = json.Unmarshal(*v, &sku)
164				if err != nil {
165					return err
166				}
167				dp.Sku = &sku
168			}
169		case "systemData":
170			if v != nil {
171				var systemData SystemMetadata
172				err = json.Unmarshal(*v, &systemData)
173				if err != nil {
174					return err
175				}
176				dp.SystemData = &systemData
177			}
178		case "tags":
179			if v != nil {
180				var tags map[string]*string
181				err = json.Unmarshal(*v, &tags)
182				if err != nil {
183					return err
184				}
185				dp.Tags = tags
186			}
187		case "location":
188			if v != nil {
189				var location string
190				err = json.Unmarshal(*v, &location)
191				if err != nil {
192					return err
193				}
194				dp.Location = &location
195			}
196		case "id":
197			if v != nil {
198				var ID string
199				err = json.Unmarshal(*v, &ID)
200				if err != nil {
201					return err
202				}
203				dp.ID = &ID
204			}
205		case "name":
206			if v != nil {
207				var name string
208				err = json.Unmarshal(*v, &name)
209				if err != nil {
210					return err
211				}
212				dp.Name = &name
213			}
214		case "type":
215			if v != nil {
216				var typeVar string
217				err = json.Unmarshal(*v, &typeVar)
218				if err != nil {
219					return err
220				}
221				dp.Type = &typeVar
222			}
223		}
224	}
225
226	return nil
227}
228
229// DiskPoolListResult list of Disk Pools
230type DiskPoolListResult struct {
231	autorest.Response `json:"-"`
232	// Value - An array of Disk Pool objects.
233	Value *[]DiskPool `json:"value,omitempty"`
234	// NextLink - READ-ONLY; URI to fetch the next section of the paginated response.
235	NextLink *string `json:"nextLink,omitempty"`
236}
237
238// MarshalJSON is the custom marshaler for DiskPoolListResult.
239func (dplr DiskPoolListResult) MarshalJSON() ([]byte, error) {
240	objectMap := make(map[string]interface{})
241	if dplr.Value != nil {
242		objectMap["value"] = dplr.Value
243	}
244	return json.Marshal(objectMap)
245}
246
247// DiskPoolListResultIterator provides access to a complete listing of DiskPool values.
248type DiskPoolListResultIterator struct {
249	i    int
250	page DiskPoolListResultPage
251}
252
253// NextWithContext advances to the next value.  If there was an error making
254// the request the iterator does not advance and the error is returned.
255func (iter *DiskPoolListResultIterator) NextWithContext(ctx context.Context) (err error) {
256	if tracing.IsEnabled() {
257		ctx = tracing.StartSpan(ctx, fqdn+"/DiskPoolListResultIterator.NextWithContext")
258		defer func() {
259			sc := -1
260			if iter.Response().Response.Response != nil {
261				sc = iter.Response().Response.Response.StatusCode
262			}
263			tracing.EndSpan(ctx, sc, err)
264		}()
265	}
266	iter.i++
267	if iter.i < len(iter.page.Values()) {
268		return nil
269	}
270	err = iter.page.NextWithContext(ctx)
271	if err != nil {
272		iter.i--
273		return err
274	}
275	iter.i = 0
276	return nil
277}
278
279// Next advances to the next value.  If there was an error making
280// the request the iterator does not advance and the error is returned.
281// Deprecated: Use NextWithContext() instead.
282func (iter *DiskPoolListResultIterator) Next() error {
283	return iter.NextWithContext(context.Background())
284}
285
286// NotDone returns true if the enumeration should be started or is not yet complete.
287func (iter DiskPoolListResultIterator) NotDone() bool {
288	return iter.page.NotDone() && iter.i < len(iter.page.Values())
289}
290
291// Response returns the raw server response from the last page request.
292func (iter DiskPoolListResultIterator) Response() DiskPoolListResult {
293	return iter.page.Response()
294}
295
296// Value returns the current value or a zero-initialized value if the
297// iterator has advanced beyond the end of the collection.
298func (iter DiskPoolListResultIterator) Value() DiskPool {
299	if !iter.page.NotDone() {
300		return DiskPool{}
301	}
302	return iter.page.Values()[iter.i]
303}
304
305// Creates a new instance of the DiskPoolListResultIterator type.
306func NewDiskPoolListResultIterator(page DiskPoolListResultPage) DiskPoolListResultIterator {
307	return DiskPoolListResultIterator{page: page}
308}
309
310// IsEmpty returns true if the ListResult contains no values.
311func (dplr DiskPoolListResult) IsEmpty() bool {
312	return dplr.Value == nil || len(*dplr.Value) == 0
313}
314
315// hasNextLink returns true if the NextLink is not empty.
316func (dplr DiskPoolListResult) hasNextLink() bool {
317	return dplr.NextLink != nil && len(*dplr.NextLink) != 0
318}
319
320// diskPoolListResultPreparer prepares a request to retrieve the next set of results.
321// It returns nil if no more results exist.
322func (dplr DiskPoolListResult) diskPoolListResultPreparer(ctx context.Context) (*http.Request, error) {
323	if !dplr.hasNextLink() {
324		return nil, nil
325	}
326	return autorest.Prepare((&http.Request{}).WithContext(ctx),
327		autorest.AsJSON(),
328		autorest.AsGet(),
329		autorest.WithBaseURL(to.String(dplr.NextLink)))
330}
331
332// DiskPoolListResultPage contains a page of DiskPool values.
333type DiskPoolListResultPage struct {
334	fn   func(context.Context, DiskPoolListResult) (DiskPoolListResult, error)
335	dplr DiskPoolListResult
336}
337
338// NextWithContext advances to the next page of values.  If there was an error making
339// the request the page does not advance and the error is returned.
340func (page *DiskPoolListResultPage) NextWithContext(ctx context.Context) (err error) {
341	if tracing.IsEnabled() {
342		ctx = tracing.StartSpan(ctx, fqdn+"/DiskPoolListResultPage.NextWithContext")
343		defer func() {
344			sc := -1
345			if page.Response().Response.Response != nil {
346				sc = page.Response().Response.Response.StatusCode
347			}
348			tracing.EndSpan(ctx, sc, err)
349		}()
350	}
351	for {
352		next, err := page.fn(ctx, page.dplr)
353		if err != nil {
354			return err
355		}
356		page.dplr = next
357		if !next.hasNextLink() || !next.IsEmpty() {
358			break
359		}
360	}
361	return nil
362}
363
364// Next advances to the next page of values.  If there was an error making
365// the request the page does not advance and the error is returned.
366// Deprecated: Use NextWithContext() instead.
367func (page *DiskPoolListResultPage) Next() error {
368	return page.NextWithContext(context.Background())
369}
370
371// NotDone returns true if the page enumeration should be started or is not yet complete.
372func (page DiskPoolListResultPage) NotDone() bool {
373	return !page.dplr.IsEmpty()
374}
375
376// Response returns the raw server response from the last page request.
377func (page DiskPoolListResultPage) Response() DiskPoolListResult {
378	return page.dplr
379}
380
381// Values returns the slice of values for the current page or nil if there are no values.
382func (page DiskPoolListResultPage) Values() []DiskPool {
383	if page.dplr.IsEmpty() {
384		return nil
385	}
386	return *page.dplr.Value
387}
388
389// Creates a new instance of the DiskPoolListResultPage type.
390func NewDiskPoolListResultPage(cur DiskPoolListResult, getNextPage func(context.Context, DiskPoolListResult) (DiskPoolListResult, error)) DiskPoolListResultPage {
391	return DiskPoolListResultPage{
392		fn:   getNextPage,
393		dplr: cur,
394	}
395}
396
397// DiskPoolProperties properties section of the Disk Pool request payload.
398type DiskPoolProperties struct {
399	// ProvisioningState - READ-ONLY; State of the operation on the resource. Possible values include: 'ProvisioningStatesInvalid', 'ProvisioningStatesSucceeded', 'ProvisioningStatesFailed', 'ProvisioningStatesCanceled', 'ProvisioningStatesPending', 'ProvisioningStatesCreating', 'ProvisioningStatesUpdating', 'ProvisioningStatesDeleting'
400	ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"`
401	// AvailabilityZones - Logical zone for DiskPool resource.
402	AvailabilityZones *[]string `json:"availabilityZones,omitempty"`
403	// Status - READ-ONLY; Operational status of the Disk pool. Possible values include: 'Invalid', 'Unknown', 'Healthy', 'Unhealthy'
404	Status OperationalStatus `json:"status,omitempty"`
405	// Disks - List of Azure managed disks to attach to a DiskPool
406	Disks *[]Disk `json:"disks,omitempty"`
407	// SubnetID - Azure resource id of the subnet for the DiskPool
408	SubnetID *string `json:"subnetId,omitempty"`
409}
410
411// MarshalJSON is the custom marshaler for DiskPoolProperties.
412func (dpp DiskPoolProperties) MarshalJSON() ([]byte, error) {
413	objectMap := make(map[string]interface{})
414	if dpp.AvailabilityZones != nil {
415		objectMap["availabilityZones"] = dpp.AvailabilityZones
416	}
417	if dpp.Disks != nil {
418		objectMap["disks"] = dpp.Disks
419	}
420	if dpp.SubnetID != nil {
421		objectMap["subnetId"] = dpp.SubnetID
422	}
423	return json.Marshal(objectMap)
424}
425
426// DiskPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
427// operation.
428type DiskPoolsCreateOrUpdateFuture struct {
429	azure.FutureAPI
430	// Result returns the result of the asynchronous operation.
431	// If the operation has not completed it will return an error.
432	Result func(DiskPoolsClient) (DiskPool, error)
433}
434
435// UnmarshalJSON is the custom unmarshaller for CreateFuture.
436func (future *DiskPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
437	var azFuture azure.Future
438	if err := json.Unmarshal(body, &azFuture); err != nil {
439		return err
440	}
441	future.FutureAPI = &azFuture
442	future.Result = future.result
443	return nil
444}
445
446// result is the default implementation for DiskPoolsCreateOrUpdateFuture.Result.
447func (future *DiskPoolsCreateOrUpdateFuture) result(client DiskPoolsClient) (dp DiskPool, err error) {
448	var done bool
449	done, err = future.DoneWithContext(context.Background(), client)
450	if err != nil {
451		err = autorest.NewErrorWithError(err, "storagepool.DiskPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
452		return
453	}
454	if !done {
455		dp.Response.Response = future.Response()
456		err = azure.NewAsyncOpIncompleteError("storagepool.DiskPoolsCreateOrUpdateFuture")
457		return
458	}
459	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
460	if dp.Response.Response, err = future.GetResult(sender); err == nil && dp.Response.Response.StatusCode != http.StatusNoContent {
461		dp, err = client.CreateOrUpdateResponder(dp.Response.Response)
462		if err != nil {
463			err = autorest.NewErrorWithError(err, "storagepool.DiskPoolsCreateOrUpdateFuture", "Result", dp.Response.Response, "Failure responding to request")
464		}
465	}
466	return
467}
468
469// DiskPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
470// operation.
471type DiskPoolsDeleteFuture struct {
472	azure.FutureAPI
473	// Result returns the result of the asynchronous operation.
474	// If the operation has not completed it will return an error.
475	Result func(DiskPoolsClient) (autorest.Response, error)
476}
477
478// UnmarshalJSON is the custom unmarshaller for CreateFuture.
479func (future *DiskPoolsDeleteFuture) UnmarshalJSON(body []byte) error {
480	var azFuture azure.Future
481	if err := json.Unmarshal(body, &azFuture); err != nil {
482		return err
483	}
484	future.FutureAPI = &azFuture
485	future.Result = future.result
486	return nil
487}
488
489// result is the default implementation for DiskPoolsDeleteFuture.Result.
490func (future *DiskPoolsDeleteFuture) result(client DiskPoolsClient) (ar autorest.Response, err error) {
491	var done bool
492	done, err = future.DoneWithContext(context.Background(), client)
493	if err != nil {
494		err = autorest.NewErrorWithError(err, "storagepool.DiskPoolsDeleteFuture", "Result", future.Response(), "Polling failure")
495		return
496	}
497	if !done {
498		ar.Response = future.Response()
499		err = azure.NewAsyncOpIncompleteError("storagepool.DiskPoolsDeleteFuture")
500		return
501	}
502	ar.Response = future.Response()
503	return
504}
505
506// Error the resource management error response.
507type Error struct {
508	// Error - RP error response
509	Error *ErrorResponse `json:"error,omitempty"`
510}
511
512// ErrorAdditionalInfo the resource management error additional info.
513type ErrorAdditionalInfo struct {
514	// Type - READ-ONLY; The additional info type.
515	Type *string `json:"type,omitempty"`
516	// Info - READ-ONLY; The additional info.
517	Info interface{} `json:"info,omitempty"`
518}
519
520// MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
521func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
522	objectMap := make(map[string]interface{})
523	return json.Marshal(objectMap)
524}
525
526// ErrorResponse the resource management error response.
527type ErrorResponse struct {
528	// Code - READ-ONLY; The error code.
529	Code *string `json:"code,omitempty"`
530	// Message - READ-ONLY; The error message.
531	Message *string `json:"message,omitempty"`
532	// Target - READ-ONLY; The error target.
533	Target *string `json:"target,omitempty"`
534	// Details - READ-ONLY; The error details.
535	Details *[]ErrorResponse `json:"details,omitempty"`
536	// AdditionalInfo - READ-ONLY; The error additional info.
537	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
538}
539
540// MarshalJSON is the custom marshaler for ErrorResponse.
541func (er ErrorResponse) MarshalJSON() ([]byte, error) {
542	objectMap := make(map[string]interface{})
543	return json.Marshal(objectMap)
544}
545
546// IscsiLun lun to expose the ManagedDisk.
547type IscsiLun struct {
548	// Name - Lun name.
549	Name *string `json:"name,omitempty"`
550	// ManagedDiskAzureResourceID - Unique Azure resource id of the managed disk. Required.
551	ManagedDiskAzureResourceID *string `json:"managedDiskAzureResourceId,omitempty"`
552}
553
554// IscsiTarget payload for iSCSI Target Create or Update requests.
555type IscsiTarget struct {
556	autorest.Response `json:"-"`
557	// IscsiTargetProperties - RP defined properties for iSCSI Target operations.
558	*IscsiTargetProperties `json:"properties,omitempty"`
559	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
560	ID *string `json:"id,omitempty"`
561	// Name - READ-ONLY; The name of the resource
562	Name *string `json:"name,omitempty"`
563	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
564	Type *string `json:"type,omitempty"`
565}
566
567// MarshalJSON is the custom marshaler for IscsiTarget.
568func (it IscsiTarget) MarshalJSON() ([]byte, error) {
569	objectMap := make(map[string]interface{})
570	if it.IscsiTargetProperties != nil {
571		objectMap["properties"] = it.IscsiTargetProperties
572	}
573	return json.Marshal(objectMap)
574}
575
576// UnmarshalJSON is the custom unmarshaler for IscsiTarget struct.
577func (it *IscsiTarget) UnmarshalJSON(body []byte) error {
578	var m map[string]*json.RawMessage
579	err := json.Unmarshal(body, &m)
580	if err != nil {
581		return err
582	}
583	for k, v := range m {
584		switch k {
585		case "properties":
586			if v != nil {
587				var iscsiTargetProperties IscsiTargetProperties
588				err = json.Unmarshal(*v, &iscsiTargetProperties)
589				if err != nil {
590					return err
591				}
592				it.IscsiTargetProperties = &iscsiTargetProperties
593			}
594		case "id":
595			if v != nil {
596				var ID string
597				err = json.Unmarshal(*v, &ID)
598				if err != nil {
599					return err
600				}
601				it.ID = &ID
602			}
603		case "name":
604			if v != nil {
605				var name string
606				err = json.Unmarshal(*v, &name)
607				if err != nil {
608					return err
609				}
610				it.Name = &name
611			}
612		case "type":
613			if v != nil {
614				var typeVar string
615				err = json.Unmarshal(*v, &typeVar)
616				if err != nil {
617					return err
618				}
619				it.Type = &typeVar
620			}
621		}
622	}
623
624	return nil
625}
626
627// IscsiTargetCredentials CHAP credentials for an iSCSI target
628type IscsiTargetCredentials struct {
629	// Username - Username for Challenge Handshake Authentication Protocol (CHAP) authentication
630	Username *string `json:"username,omitempty"`
631	// Password - Password for Challenge Handshake Authentication Protocol (CHAP) authentication
632	Password *string `json:"password,omitempty"`
633}
634
635// IscsiTargetList list of iSCSI Targets.
636type IscsiTargetList struct {
637	autorest.Response `json:"-"`
638	// Value - An array of iSCSI targets within a Disk Pool.
639	Value *[]IscsiTarget `json:"value,omitempty"`
640	// NextLink - READ-ONLY; URI to fetch the next section of the paginated response.
641	NextLink *string `json:"nextLink,omitempty"`
642}
643
644// MarshalJSON is the custom marshaler for IscsiTargetList.
645func (itl IscsiTargetList) MarshalJSON() ([]byte, error) {
646	objectMap := make(map[string]interface{})
647	if itl.Value != nil {
648		objectMap["value"] = itl.Value
649	}
650	return json.Marshal(objectMap)
651}
652
653// IscsiTargetListIterator provides access to a complete listing of IscsiTarget values.
654type IscsiTargetListIterator struct {
655	i    int
656	page IscsiTargetListPage
657}
658
659// NextWithContext advances to the next value.  If there was an error making
660// the request the iterator does not advance and the error is returned.
661func (iter *IscsiTargetListIterator) NextWithContext(ctx context.Context) (err error) {
662	if tracing.IsEnabled() {
663		ctx = tracing.StartSpan(ctx, fqdn+"/IscsiTargetListIterator.NextWithContext")
664		defer func() {
665			sc := -1
666			if iter.Response().Response.Response != nil {
667				sc = iter.Response().Response.Response.StatusCode
668			}
669			tracing.EndSpan(ctx, sc, err)
670		}()
671	}
672	iter.i++
673	if iter.i < len(iter.page.Values()) {
674		return nil
675	}
676	err = iter.page.NextWithContext(ctx)
677	if err != nil {
678		iter.i--
679		return err
680	}
681	iter.i = 0
682	return nil
683}
684
685// Next advances to the next value.  If there was an error making
686// the request the iterator does not advance and the error is returned.
687// Deprecated: Use NextWithContext() instead.
688func (iter *IscsiTargetListIterator) Next() error {
689	return iter.NextWithContext(context.Background())
690}
691
692// NotDone returns true if the enumeration should be started or is not yet complete.
693func (iter IscsiTargetListIterator) NotDone() bool {
694	return iter.page.NotDone() && iter.i < len(iter.page.Values())
695}
696
697// Response returns the raw server response from the last page request.
698func (iter IscsiTargetListIterator) Response() IscsiTargetList {
699	return iter.page.Response()
700}
701
702// Value returns the current value or a zero-initialized value if the
703// iterator has advanced beyond the end of the collection.
704func (iter IscsiTargetListIterator) Value() IscsiTarget {
705	if !iter.page.NotDone() {
706		return IscsiTarget{}
707	}
708	return iter.page.Values()[iter.i]
709}
710
711// Creates a new instance of the IscsiTargetListIterator type.
712func NewIscsiTargetListIterator(page IscsiTargetListPage) IscsiTargetListIterator {
713	return IscsiTargetListIterator{page: page}
714}
715
716// IsEmpty returns true if the ListResult contains no values.
717func (itl IscsiTargetList) IsEmpty() bool {
718	return itl.Value == nil || len(*itl.Value) == 0
719}
720
721// hasNextLink returns true if the NextLink is not empty.
722func (itl IscsiTargetList) hasNextLink() bool {
723	return itl.NextLink != nil && len(*itl.NextLink) != 0
724}
725
726// iscsiTargetListPreparer prepares a request to retrieve the next set of results.
727// It returns nil if no more results exist.
728func (itl IscsiTargetList) iscsiTargetListPreparer(ctx context.Context) (*http.Request, error) {
729	if !itl.hasNextLink() {
730		return nil, nil
731	}
732	return autorest.Prepare((&http.Request{}).WithContext(ctx),
733		autorest.AsJSON(),
734		autorest.AsGet(),
735		autorest.WithBaseURL(to.String(itl.NextLink)))
736}
737
738// IscsiTargetListPage contains a page of IscsiTarget values.
739type IscsiTargetListPage struct {
740	fn  func(context.Context, IscsiTargetList) (IscsiTargetList, error)
741	itl IscsiTargetList
742}
743
744// NextWithContext advances to the next page of values.  If there was an error making
745// the request the page does not advance and the error is returned.
746func (page *IscsiTargetListPage) NextWithContext(ctx context.Context) (err error) {
747	if tracing.IsEnabled() {
748		ctx = tracing.StartSpan(ctx, fqdn+"/IscsiTargetListPage.NextWithContext")
749		defer func() {
750			sc := -1
751			if page.Response().Response.Response != nil {
752				sc = page.Response().Response.Response.StatusCode
753			}
754			tracing.EndSpan(ctx, sc, err)
755		}()
756	}
757	for {
758		next, err := page.fn(ctx, page.itl)
759		if err != nil {
760			return err
761		}
762		page.itl = next
763		if !next.hasNextLink() || !next.IsEmpty() {
764			break
765		}
766	}
767	return nil
768}
769
770// Next advances to the next page of values.  If there was an error making
771// the request the page does not advance and the error is returned.
772// Deprecated: Use NextWithContext() instead.
773func (page *IscsiTargetListPage) Next() error {
774	return page.NextWithContext(context.Background())
775}
776
777// NotDone returns true if the page enumeration should be started or is not yet complete.
778func (page IscsiTargetListPage) NotDone() bool {
779	return !page.itl.IsEmpty()
780}
781
782// Response returns the raw server response from the last page request.
783func (page IscsiTargetListPage) Response() IscsiTargetList {
784	return page.itl
785}
786
787// Values returns the slice of values for the current page or nil if there are no values.
788func (page IscsiTargetListPage) Values() []IscsiTarget {
789	if page.itl.IsEmpty() {
790		return nil
791	}
792	return *page.itl.Value
793}
794
795// Creates a new instance of the IscsiTargetListPage type.
796func NewIscsiTargetListPage(cur IscsiTargetList, getNextPage func(context.Context, IscsiTargetList) (IscsiTargetList, error)) IscsiTargetListPage {
797	return IscsiTargetListPage{
798		fn:  getNextPage,
799		itl: cur,
800	}
801}
802
803// IscsiTargetProperties properties of iSCSI Target request payload.
804type IscsiTargetProperties struct {
805	// ProvisioningState - READ-ONLY; State of the operation on the resource. Possible values include: 'ProvisioningStatesInvalid', 'ProvisioningStatesSucceeded', 'ProvisioningStatesFailed', 'ProvisioningStatesCanceled', 'ProvisioningStatesPending', 'ProvisioningStatesCreating', 'ProvisioningStatesUpdating', 'ProvisioningStatesDeleting'
806	ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"`
807	// Status - READ-ONLY; Operational status of the Disk pool. Possible values include: 'Invalid', 'Unknown', 'Healthy', 'Unhealthy'
808	Status OperationalStatus `json:"status,omitempty"`
809	// Tpgs - list of iSCSI target portal groups
810	Tpgs *[]TargetPortalGroup `json:"tpgs,omitempty"`
811	// TargetIqn - iSCSI target iqn (iSCSI Qualified Name); example: iqn.2005-03.org.iscsi:server
812	TargetIqn *string `json:"targetIqn,omitempty"`
813}
814
815// MarshalJSON is the custom marshaler for IscsiTargetProperties.
816func (itp IscsiTargetProperties) MarshalJSON() ([]byte, error) {
817	objectMap := make(map[string]interface{})
818	if itp.Tpgs != nil {
819		objectMap["tpgs"] = itp.Tpgs
820	}
821	if itp.TargetIqn != nil {
822		objectMap["targetIqn"] = itp.TargetIqn
823	}
824	return json.Marshal(objectMap)
825}
826
827// IscsiTargetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
828// long-running operation.
829type IscsiTargetsCreateOrUpdateFuture struct {
830	azure.FutureAPI
831	// Result returns the result of the asynchronous operation.
832	// If the operation has not completed it will return an error.
833	Result func(IscsiTargetsClient) (IscsiTarget, error)
834}
835
836// UnmarshalJSON is the custom unmarshaller for CreateFuture.
837func (future *IscsiTargetsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
838	var azFuture azure.Future
839	if err := json.Unmarshal(body, &azFuture); err != nil {
840		return err
841	}
842	future.FutureAPI = &azFuture
843	future.Result = future.result
844	return nil
845}
846
847// result is the default implementation for IscsiTargetsCreateOrUpdateFuture.Result.
848func (future *IscsiTargetsCreateOrUpdateFuture) result(client IscsiTargetsClient) (it IscsiTarget, err error) {
849	var done bool
850	done, err = future.DoneWithContext(context.Background(), client)
851	if err != nil {
852		err = autorest.NewErrorWithError(err, "storagepool.IscsiTargetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
853		return
854	}
855	if !done {
856		it.Response.Response = future.Response()
857		err = azure.NewAsyncOpIncompleteError("storagepool.IscsiTargetsCreateOrUpdateFuture")
858		return
859	}
860	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
861	if it.Response.Response, err = future.GetResult(sender); err == nil && it.Response.Response.StatusCode != http.StatusNoContent {
862		it, err = client.CreateOrUpdateResponder(it.Response.Response)
863		if err != nil {
864			err = autorest.NewErrorWithError(err, "storagepool.IscsiTargetsCreateOrUpdateFuture", "Result", it.Response.Response, "Failure responding to request")
865		}
866	}
867	return
868}
869
870// IscsiTargetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
871// operation.
872type IscsiTargetsDeleteFuture struct {
873	azure.FutureAPI
874	// Result returns the result of the asynchronous operation.
875	// If the operation has not completed it will return an error.
876	Result func(IscsiTargetsClient) (autorest.Response, error)
877}
878
879// UnmarshalJSON is the custom unmarshaller for CreateFuture.
880func (future *IscsiTargetsDeleteFuture) UnmarshalJSON(body []byte) error {
881	var azFuture azure.Future
882	if err := json.Unmarshal(body, &azFuture); err != nil {
883		return err
884	}
885	future.FutureAPI = &azFuture
886	future.Result = future.result
887	return nil
888}
889
890// result is the default implementation for IscsiTargetsDeleteFuture.Result.
891func (future *IscsiTargetsDeleteFuture) result(client IscsiTargetsClient) (ar autorest.Response, err error) {
892	var done bool
893	done, err = future.DoneWithContext(context.Background(), client)
894	if err != nil {
895		err = autorest.NewErrorWithError(err, "storagepool.IscsiTargetsDeleteFuture", "Result", future.Response(), "Polling failure")
896		return
897	}
898	if !done {
899		ar.Response = future.Response()
900		err = azure.NewAsyncOpIncompleteError("storagepool.IscsiTargetsDeleteFuture")
901		return
902	}
903	ar.Response = future.Response()
904	return
905}
906
907// OperationDisplay metadata about an operation.
908type OperationDisplay struct {
909	// Provider - Localized friendly form of the resource provider name.
910	Provider *string `json:"provider,omitempty"`
911	// Resource - Localized friendly form of the resource type related to this action/operation.
912	Resource *string `json:"resource,omitempty"`
913	// Operation - Localized friendly name for the operation, as it should be shown to the user.
914	Operation *string `json:"operation,omitempty"`
915	// Description - Localized friendly description for the operation, as it should be shown to the user.
916	Description *string `json:"description,omitempty"`
917}
918
919// OperationListResult list of operations supported by the RP.
920type OperationListResult struct {
921	autorest.Response `json:"-"`
922	// Value - An array of operations supported by the StoragePool RP.
923	Value *[]RPOperation `json:"value,omitempty"`
924	// NextLink - URI to fetch the next section of the paginated response.
925	NextLink *string `json:"nextLink,omitempty"`
926}
927
928// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than
929// required location and tags
930type ProxyResource struct {
931	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
932	ID *string `json:"id,omitempty"`
933	// Name - READ-ONLY; The name of the resource
934	Name *string `json:"name,omitempty"`
935	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
936	Type *string `json:"type,omitempty"`
937}
938
939// MarshalJSON is the custom marshaler for ProxyResource.
940func (pr ProxyResource) MarshalJSON() ([]byte, error) {
941	objectMap := make(map[string]interface{})
942	return json.Marshal(objectMap)
943}
944
945// Resource ARM resource model definition.
946type Resource struct {
947	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
948	ID *string `json:"id,omitempty"`
949	// Name - READ-ONLY; The name of the resource
950	Name *string `json:"name,omitempty"`
951	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
952	Type *string `json:"type,omitempty"`
953}
954
955// MarshalJSON is the custom marshaler for Resource.
956func (r Resource) MarshalJSON() ([]byte, error) {
957	objectMap := make(map[string]interface{})
958	return json.Marshal(objectMap)
959}
960
961// RPOperation description of a StoragePool RP Operation
962type RPOperation struct {
963	// Name - The name of the operation being performed on this particular object
964	Name *string `json:"name,omitempty"`
965	// IsDataAction - Indicates whether the operation applies to data-plane.
966	IsDataAction *bool `json:"isDataAction,omitempty"`
967	// ActionType - Indicates the action type.
968	ActionType *string `json:"actionType,omitempty"`
969	// Display - Additional metadata about RP operation.
970	Display *OperationDisplay `json:"display,omitempty"`
971	// Origin - The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX.
972	Origin *string `json:"origin,omitempty"`
973}
974
975// Sku the resource model definition representing SKU
976type Sku struct {
977	// Name - The name of the SKU. Ex - P3. It is typically a letter+number code
978	Name *string `json:"name,omitempty"`
979	// Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium'
980	Tier SkuTier `json:"tier,omitempty"`
981	// Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code.
982	Size *string `json:"size,omitempty"`
983	// Family - If the service has different generations of hardware, for the same SKU, then that can be captured here.
984	Family *string `json:"family,omitempty"`
985	// Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted.
986	Capacity *int32 `json:"capacity,omitempty"`
987}
988
989// SystemMetadata resource metadata required by ARM RPC
990type SystemMetadata struct {
991	// CreatedBy - A string identifier for the identity that created the resource.
992	CreatedBy *string `json:"createdBy,omitempty"`
993	// CreatedByType - The type of identity that created the resource: user, application, managedIdentity
994	CreatedByType *string `json:"createdByType,omitempty"`
995	// CreatedAt - The timestamp of resource creation (UTC)
996	CreatedAt *string `json:"createdAt,omitempty"`
997	// LastModifiedBy - A string identifier for the identity that last modified the resource
998	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
999	// LastModifiedByType - The type of identity that last modified the resource: user, application, managedIdentity
1000	LastModifiedByType *string `json:"lastModifiedByType,omitempty"`
1001	// LastModifiedAt - The timestamp of resource last modification (UTC)
1002	LastModifiedAt *string `json:"lastModifiedAt,omitempty"`
1003}
1004
1005// TargetPortalGroup iSCSI target portal group
1006type TargetPortalGroup struct {
1007	// Luns - Lun list to be exposed through the iSCSI target. Required
1008	Luns *[]IscsiLun `json:"luns,omitempty"`
1009	// Acls - Access Control List (ACL) for an iSCSI target lun
1010	Acls *[]ACL `json:"acls,omitempty"`
1011	// Attributes - Attributes of an iSCSI target
1012	Attributes *Attributes `json:"attributes,omitempty"`
1013	// Endpoints - READ-ONLY; list of public ip addresses to connect to the iSCSI target
1014	Endpoints *[]string `json:"endpoints,omitempty"`
1015	// Tag - READ-ONLY; The tag associated with the iSCSI target portal group
1016	Tag *int32 `json:"tag,omitempty"`
1017	// Port - READ-ONLY; The port at which the iSCSI target is available
1018	Port *int32 `json:"port,omitempty"`
1019}
1020
1021// MarshalJSON is the custom marshaler for TargetPortalGroup.
1022func (tpg TargetPortalGroup) MarshalJSON() ([]byte, error) {
1023	objectMap := make(map[string]interface{})
1024	if tpg.Luns != nil {
1025		objectMap["luns"] = tpg.Luns
1026	}
1027	if tpg.Acls != nil {
1028		objectMap["acls"] = tpg.Acls
1029	}
1030	if tpg.Attributes != nil {
1031		objectMap["attributes"] = tpg.Attributes
1032	}
1033	return json.Marshal(objectMap)
1034}
1035
1036// TrackedResource the resource model definition for a ARM tracked top level resource
1037type TrackedResource struct {
1038	// Tags - Resource tags.
1039	Tags map[string]*string `json:"tags"`
1040	// Location - The geo-location where the resource lives
1041	Location *string `json:"location,omitempty"`
1042	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1043	ID *string `json:"id,omitempty"`
1044	// Name - READ-ONLY; The name of the resource
1045	Name *string `json:"name,omitempty"`
1046	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
1047	Type *string `json:"type,omitempty"`
1048}
1049
1050// MarshalJSON is the custom marshaler for TrackedResource.
1051func (tr TrackedResource) MarshalJSON() ([]byte, error) {
1052	objectMap := make(map[string]interface{})
1053	if tr.Tags != nil {
1054		objectMap["tags"] = tr.Tags
1055	}
1056	if tr.Location != nil {
1057		objectMap["location"] = tr.Location
1058	}
1059	return json.Marshal(objectMap)
1060}
1061