-
Notifications
You must be signed in to change notification settings - Fork 821
/
models.go
3018 lines (2738 loc) · 110 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package hybridnetwork
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/management/2020-01-01-preview/hybridnetwork"
// Device hybrid network device resource.
type Device struct {
autorest.Response `json:"-"`
// BasicDevicePropertiesFormat - Hybrid network device properties.
BasicDevicePropertiesFormat `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Location - Resource location.
Location *string `json:"location,omitempty"`
// Tags - Resource tags.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Device.
func (d Device) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
objectMap["properties"] = d.BasicDevicePropertiesFormat
if d.Location != nil {
objectMap["location"] = d.Location
}
if d.Tags != nil {
objectMap["tags"] = d.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Device struct.
func (d *Device) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
basicDevicePropertiesFormat, err := unmarshalBasicDevicePropertiesFormat(*v)
if err != nil {
return err
}
d.BasicDevicePropertiesFormat = basicDevicePropertiesFormat
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
d.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
d.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
d.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
d.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
d.Tags = tags
}
}
}
return nil
}
// DeviceListResult response for hybrid network devices API service call.
type DeviceListResult struct {
autorest.Response `json:"-"`
// Value - A list of hybrid network devices.
Value *[]Device `json:"value,omitempty"`
// NextLink - READ-ONLY; The URL to get the next set of results.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for DeviceListResult.
func (dlr DeviceListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if dlr.Value != nil {
objectMap["value"] = dlr.Value
}
return json.Marshal(objectMap)
}
// DeviceListResultIterator provides access to a complete listing of Device values.
type DeviceListResultIterator struct {
i int
page DeviceListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *DeviceListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/DeviceListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *DeviceListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter DeviceListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter DeviceListResultIterator) Response() DeviceListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter DeviceListResultIterator) Value() Device {
if !iter.page.NotDone() {
return Device{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the DeviceListResultIterator type.
func NewDeviceListResultIterator(page DeviceListResultPage) DeviceListResultIterator {
return DeviceListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (dlr DeviceListResult) IsEmpty() bool {
return dlr.Value == nil || len(*dlr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (dlr DeviceListResult) hasNextLink() bool {
return dlr.NextLink != nil && len(*dlr.NextLink) != 0
}
// deviceListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (dlr DeviceListResult) deviceListResultPreparer(ctx context.Context) (*http.Request, error) {
if !dlr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(dlr.NextLink)))
}
// DeviceListResultPage contains a page of Device values.
type DeviceListResultPage struct {
fn func(context.Context, DeviceListResult) (DeviceListResult, error)
dlr DeviceListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *DeviceListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/DeviceListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.dlr)
if err != nil {
return err
}
page.dlr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *DeviceListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page DeviceListResultPage) NotDone() bool {
return !page.dlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page DeviceListResultPage) Response() DeviceListResult {
return page.dlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page DeviceListResultPage) Values() []Device {
if page.dlr.IsEmpty() {
return nil
}
return *page.dlr.Value
}
// Creates a new instance of the DeviceListResultPage type.
func NewDeviceListResultPage(getNextPage func(context.Context, DeviceListResult) (DeviceListResult, error)) DeviceListResultPage {
return DeviceListResultPage{fn: getNextPage}
}
// BasicDevicePropertiesFormat hybrid network device properties.
type BasicDevicePropertiesFormat interface {
AsDevicePropertiesFormat() (*DevicePropertiesFormat, bool)
}
// DevicePropertiesFormat hybrid network device properties.
type DevicePropertiesFormat struct {
// Status - READ-ONLY; The current device status. Possible values include: 'StatusUnknown', 'StatusNotRegistered', 'StatusRegistered'
Status Status `json:"status,omitempty"`
// ProvisioningState - READ-ONLY; The provisioning state of the hybrid network device resource. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateSucceeded', 'ProvisioningStateAccepted', 'ProvisioningStateDeleting', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted'
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
// AzureStackEdge - The reference to the azure stack edge device.
AzureStackEdge *SubResource `json:"azureStackEdge,omitempty"`
// VirtualNetworkFunctions - READ-ONLY; The list of virtual network functions deployed on the hybrid network device.
VirtualNetworkFunctions *[]SubResource `json:"virtualNetworkFunctions,omitempty"`
// DeviceType - Possible values include: 'DeviceTypeDevicePropertiesFormat'
DeviceType DeviceType `json:"deviceType,omitempty"`
}
func unmarshalBasicDevicePropertiesFormat(body []byte) (BasicDevicePropertiesFormat, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["deviceType"] {
default:
var dpf DevicePropertiesFormat
err := json.Unmarshal(body, &dpf)
return dpf, err
}
}
func unmarshalBasicDevicePropertiesFormatArray(body []byte) ([]BasicDevicePropertiesFormat, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
dpfArray := make([]BasicDevicePropertiesFormat, len(rawMessages))
for index, rawMessage := range rawMessages {
dpf, err := unmarshalBasicDevicePropertiesFormat(*rawMessage)
if err != nil {
return nil, err
}
dpfArray[index] = dpf
}
return dpfArray, nil
}
// MarshalJSON is the custom marshaler for DevicePropertiesFormat.
func (dpf DevicePropertiesFormat) MarshalJSON() ([]byte, error) {
dpf.DeviceType = DeviceTypeDevicePropertiesFormat
objectMap := make(map[string]interface{})
if dpf.AzureStackEdge != nil {
objectMap["azureStackEdge"] = dpf.AzureStackEdge
}
if dpf.DeviceType != "" {
objectMap["deviceType"] = dpf.DeviceType
}
return json.Marshal(objectMap)
}
// AsDevicePropertiesFormat is the BasicDevicePropertiesFormat implementation for DevicePropertiesFormat.
func (dpf DevicePropertiesFormat) AsDevicePropertiesFormat() (*DevicePropertiesFormat, bool) {
return &dpf, true
}
// AsBasicDevicePropertiesFormat is the BasicDevicePropertiesFormat implementation for DevicePropertiesFormat.
func (dpf DevicePropertiesFormat) AsBasicDevicePropertiesFormat() (BasicDevicePropertiesFormat, bool) {
return &dpf, true
}
// DeviceRegistrationKey the hybrid network device registration key
type DeviceRegistrationKey struct {
autorest.Response `json:"-"`
// RegistrationKey - READ-ONLY; The registration key for hybrid network device.
RegistrationKey *string `json:"registrationKey,omitempty"`
}
// DevicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type DevicesCreateOrUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *DevicesCreateOrUpdateFuture) Result(client DevicesClient) (d Device, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "hybridnetwork.DevicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("hybridnetwork.DevicesCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
d, err = client.CreateOrUpdateResponder(d.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "hybridnetwork.DevicesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
}
}
return
}
// DevicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type DevicesDeleteFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *DevicesDeleteFuture) Result(client DevicesClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "hybridnetwork.DevicesDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("hybridnetwork.DevicesDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// ErrorDetails the error response that indicates why an operation has failed.
type ErrorDetails struct {
Error *ErrorResponse `json:"error,omitempty"`
}
// ErrorResponse the error response details containing error code and error message
type ErrorResponse struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
// Code - READ-ONLY; The error code.
Code *string `json:"code,omitempty"`
// Message - READ-ONLY; The error message.
Message *string `json:"message,omitempty"`
}
// MarshalJSON is the custom marshaler for ErrorResponse.
func (er ErrorResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
for k, v := range er.AdditionalProperties {
objectMap[k] = v
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ErrorResponse struct.
func (er *ErrorResponse) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
default:
if v != nil {
var additionalProperties interface{}
err = json.Unmarshal(*v, &additionalProperties)
if err != nil {
return err
}
if er.AdditionalProperties == nil {
er.AdditionalProperties = make(map[string]interface{})
}
er.AdditionalProperties[k] = additionalProperties
}
case "code":
if v != nil {
var code string
err = json.Unmarshal(*v, &code)
if err != nil {
return err
}
er.Code = &code
}
case "message":
if v != nil {
var message string
err = json.Unmarshal(*v, &message)
if err != nil {
return err
}
er.Message = &message
}
}
}
return nil
}
// ImageReference the image reference properties.
type ImageReference struct {
// OsType - The OS type. Possible values include: 'OperatingSystemTypesUnknown', 'OperatingSystemTypesWindows', 'OperatingSystemTypesLinux'
OsType OperatingSystemTypes `json:"osType,omitempty"`
// VhdName - The VHD name.
VhdName *string `json:"vhdName,omitempty"`
// VhdType - The VHD type. Possible values include: 'VHDTypeUnknown', 'VHDTypeVHD', 'VHDTypeVHDX'
VhdType VHDType `json:"vhdType,omitempty"`
// SasURI - The VHD SAS URI.
SasURI *string `json:"sasUri,omitempty"`
}
// NetworkInterface network interface properties.
type NetworkInterface struct {
// NetworkInterfaceName - The name of the network interface.
NetworkInterfaceName *string `json:"networkInterfaceName,omitempty"`
// MacAddress - The MAC address of the network interface.
MacAddress *string `json:"macAddress,omitempty"`
// IPConfigurations - A list of IP configurations of the network interface.
IPConfigurations *[]NetworkInterfaceIPConfiguration `json:"ipConfigurations,omitempty"`
// VMSwitchType - The type of VM switch. Possible values include: 'VMSwitchTypeUnknown', 'VMSwitchTypeManagement', 'VMSwitchTypeWan', 'VMSwitchTypeLan', 'VMSwitchTypeInternal'
VMSwitchType VMSwitchType `json:"vmSwitchType,omitempty"`
}
// NetworkInterfaceIPConfiguration network interface IP configuration properties.
type NetworkInterfaceIPConfiguration struct {
// IPAllocationMethod - IP address allocation method. Possible values include: 'Unknown', 'Static', 'Dynamic'
IPAllocationMethod IPAllocationMethod `json:"ipAllocationMethod,omitempty"`
// IPAddress - The value of the IP address.
IPAddress *string `json:"ipAddress,omitempty"`
// Subnet - The value of the subnet.
Subnet *string `json:"subnet,omitempty"`
// Gateway - The value of the gateway.
Gateway *string `json:"gateway,omitempty"`
// IPVersion - IP address version. Possible values include: 'IPVersionUnknown', 'IPVersionIPv4'
IPVersion IPVersion `json:"ipVersion,omitempty"`
// DNSServers - The list of DNS servers IP addresses.
DNSServers *[]string `json:"dnsServers,omitempty"`
}
// Operation object that describes a single Microsoft.HybridNetwork operation.
type Operation struct {
// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}
Name *string `json:"name,omitempty"`
// Display - READ-ONLY; The object that represents the operation.
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay the object that represents the operation.
type OperationDisplay struct {
// Provider - Service provider: Microsoft.HybridNetwork
Provider *string `json:"provider,omitempty"`
// Resource - Resource on which the operation is performed: Registration definition, registration assignment etc.
Resource *string `json:"resource,omitempty"`
// Operation - Operation type: Read, write, delete, etc.
Operation *string `json:"operation,omitempty"`
// Description - Description of the operation.
Description *string `json:"description,omitempty"`
}
// OperationList list of the operations.
type OperationList struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; List of Microsoft.HybridNetwork operations.
Value *[]Operation `json:"value,omitempty"`
// NextLink - READ-ONLY; The URL to get the next set of results.
NextLink *string `json:"nextLink,omitempty"`
}
// OperationListIterator provides access to a complete listing of Operation values.
type OperationListIterator struct {
i int
page OperationListPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *OperationListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter OperationListIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter OperationListIterator) Response() OperationList {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter OperationListIterator) Value() Operation {
if !iter.page.NotDone() {
return Operation{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the OperationListIterator type.
func NewOperationListIterator(page OperationListPage) OperationListIterator {
return OperationListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (ol OperationList) IsEmpty() bool {
return ol.Value == nil || len(*ol.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (ol OperationList) hasNextLink() bool {
return ol.NextLink != nil && len(*ol.NextLink) != 0
}
// operationListPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) {
if !ol.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(ol.NextLink)))
}
// OperationListPage contains a page of Operation values.
type OperationListPage struct {
fn func(context.Context, OperationList) (OperationList, error)
ol OperationList
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.ol)
if err != nil {
return err
}
page.ol = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *OperationListPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page OperationListPage) NotDone() bool {
return !page.ol.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page OperationListPage) Response() OperationList {
return page.ol
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page OperationListPage) Values() []Operation {
if page.ol.IsEmpty() {
return nil
}
return *page.ol.Value
}
// Creates a new instance of the OperationListPage type.
func NewOperationListPage(getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage {
return OperationListPage{fn: getNextPage}
}
// OsProfile specifies the operating system settings for the role instance.
type OsProfile struct {
// AdminUsername - Specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters <br><br><li> For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)<br><li> For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
AdminUsername *string `json:"adminUsername,omitempty"`
// AdminPassword - Specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password).
AdminPassword *string `json:"adminPassword,omitempty"`
// SSHPublicKey - Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed.
SSHPublicKey *string `json:"sshPublicKey,omitempty"`
}
// PreviewSubscription customer subscription which can use a sku.
type PreviewSubscription struct {
autorest.Response `json:"-"`
// Name - READ-ONLY; Preview subscription id
Name *string `json:"name,omitempty"`
// ID - READ-ONLY; ARM id of the resource
ID *string `json:"id,omitempty"`
// Type - READ-ONLY; Type of the resource
Type *string `json:"type,omitempty"`
}
// PreviewSubscriptionsList list of customer subscriptions which can use a sku.
type PreviewSubscriptionsList struct {
autorest.Response `json:"-"`
// Value - A list of preview subscriptions.
Value *[]PreviewSubscription `json:"value,omitempty"`
// NextLink - READ-ONLY; The URL to get the next set of results.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for PreviewSubscriptionsList.
func (psl PreviewSubscriptionsList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if psl.Value != nil {
objectMap["value"] = psl.Value
}
return json.Marshal(objectMap)
}
// PreviewSubscriptionsListIterator provides access to a complete listing of PreviewSubscription values.
type PreviewSubscriptionsListIterator struct {
i int
page PreviewSubscriptionsListPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *PreviewSubscriptionsListIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PreviewSubscriptionsListIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *PreviewSubscriptionsListIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter PreviewSubscriptionsListIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter PreviewSubscriptionsListIterator) Response() PreviewSubscriptionsList {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter PreviewSubscriptionsListIterator) Value() PreviewSubscription {
if !iter.page.NotDone() {
return PreviewSubscription{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the PreviewSubscriptionsListIterator type.
func NewPreviewSubscriptionsListIterator(page PreviewSubscriptionsListPage) PreviewSubscriptionsListIterator {
return PreviewSubscriptionsListIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (psl PreviewSubscriptionsList) IsEmpty() bool {
return psl.Value == nil || len(*psl.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (psl PreviewSubscriptionsList) hasNextLink() bool {
return psl.NextLink != nil && len(*psl.NextLink) != 0
}
// previewSubscriptionsListPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (psl PreviewSubscriptionsList) previewSubscriptionsListPreparer(ctx context.Context) (*http.Request, error) {
if !psl.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(psl.NextLink)))
}
// PreviewSubscriptionsListPage contains a page of PreviewSubscription values.
type PreviewSubscriptionsListPage struct {
fn func(context.Context, PreviewSubscriptionsList) (PreviewSubscriptionsList, error)
psl PreviewSubscriptionsList
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *PreviewSubscriptionsListPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/PreviewSubscriptionsListPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.psl)
if err != nil {
return err
}
page.psl = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *PreviewSubscriptionsListPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page PreviewSubscriptionsListPage) NotDone() bool {
return !page.psl.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page PreviewSubscriptionsListPage) Response() PreviewSubscriptionsList {
return page.psl
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page PreviewSubscriptionsListPage) Values() []PreviewSubscription {
if page.psl.IsEmpty() {
return nil
}
return *page.psl.Value
}
// Creates a new instance of the PreviewSubscriptionsListPage type.
func NewPreviewSubscriptionsListPage(getNextPage func(context.Context, PreviewSubscriptionsList) (PreviewSubscriptionsList, error)) PreviewSubscriptionsListPage {
return PreviewSubscriptionsListPage{fn: getNextPage}
}
// Resource common resource representation.
type Resource struct {
// ID - READ-ONLY; Resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Location - Resource location.
Location *string `json:"location,omitempty"`
// Tags - Resource tags.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.Location != nil {
objectMap["location"] = r.Location
}
if r.Tags != nil {
objectMap["tags"] = r.Tags
}
return json.Marshal(objectMap)
}
// SkuOverview the virtual network function sku overview.
type SkuOverview struct {
// SkuName - The vendor sku name.
SkuName *string `json:"skuName,omitempty"`
// SkuType - The vendor sku type. Possible values include: 'SkuTypeUnknown', 'SkuTypeEvolvedPacketCore', 'SkuTypeSDWAN'
SkuType SkuType `json:"skuType,omitempty"`
}
// SubResource reference to another sub resource.
type SubResource struct {
// ID - Resource ID.
ID *string `json:"id,omitempty"`
}
// TagsObject tags object for patch operations.
type TagsObject struct {
// Tags - Resource tags.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for TagsObject.
func (toVar TagsObject) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if toVar.Tags != nil {
objectMap["tags"] = toVar.Tags
}
return json.Marshal(objectMap)
}
// Vendor vendor resource.
type Vendor struct {
autorest.Response `json:"-"`
// VendorPropertiesFormat - Vendor properties.
*VendorPropertiesFormat `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
// Location - Resource location.
Location *string `json:"location,omitempty"`
// Tags - Resource tags.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Vendor.
func (vVar Vendor) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if vVar.VendorPropertiesFormat != nil {
objectMap["properties"] = vVar.VendorPropertiesFormat
}
if vVar.Location != nil {
objectMap["location"] = vVar.Location
}
if vVar.Tags != nil {
objectMap["tags"] = vVar.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Vendor struct.
func (vVar *Vendor) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var vendorPropertiesFormat VendorPropertiesFormat
err = json.Unmarshal(*v, &vendorPropertiesFormat)
if err != nil {