-
Notifications
You must be signed in to change notification settings - Fork 821
/
models.go
1340 lines (1206 loc) · 45.3 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 storagecache
// 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/date"
"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/storagecache/mgmt/2019-08-01-preview/storagecache"
// APIOperation REST API operation description: see
// https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation
type APIOperation struct {
// Display - The object that represents the operation.
Display *APIOperationDisplay `json:"display,omitempty"`
// Name - Operation name: {provider}/{resource}/{operation}
Name *string `json:"name,omitempty"`
}
// APIOperationDisplay the object that represents the operation.
type APIOperationDisplay struct {
// Operation - Operation type: Read, write, delete, etc.
Operation *string `json:"operation,omitempty"`
// Provider - Service provider: Microsoft.StorageCache
Provider *string `json:"provider,omitempty"`
// Resource - Resource on which the operation is performed: cache, etc.
Resource *string `json:"resource,omitempty"`
}
// APIOperationListResult result of the request to list Resource Provider operations. It contains a list of
// operations and a URL link to get the next set of results.
type APIOperationListResult struct {
autorest.Response `json:"-"`
// NextLink - URL to get the next set of operation list results if there are any.
NextLink *string `json:"nextLink,omitempty"`
// Value - List of Resource Provider operations supported by the Microsoft.StorageCache resource provider.
Value *[]APIOperation `json:"value,omitempty"`
}
// APIOperationListResultIterator provides access to a complete listing of APIOperation values.
type APIOperationListResultIterator struct {
i int
page APIOperationListResultPage
}
// 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 *APIOperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultIterator.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 *APIOperationListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter APIOperationListResultIterator) 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 APIOperationListResultIterator) Response() APIOperationListResult {
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 APIOperationListResultIterator) Value() APIOperation {
if !iter.page.NotDone() {
return APIOperation{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the APIOperationListResultIterator type.
func NewAPIOperationListResultIterator(page APIOperationListResultPage) APIOperationListResultIterator {
return APIOperationListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (aolr APIOperationListResult) IsEmpty() bool {
return aolr.Value == nil || len(*aolr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (aolr APIOperationListResult) hasNextLink() bool {
return aolr.NextLink != nil && len(*aolr.NextLink) != 0
}
// aPIOperationListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (aolr APIOperationListResult) aPIOperationListResultPreparer(ctx context.Context) (*http.Request, error) {
if !aolr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(aolr.NextLink)))
}
// APIOperationListResultPage contains a page of APIOperation values.
type APIOperationListResultPage struct {
fn func(context.Context, APIOperationListResult) (APIOperationListResult, error)
aolr APIOperationListResult
}
// 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 *APIOperationListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultPage.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.aolr)
if err != nil {
return err
}
page.aolr = 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 *APIOperationListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page APIOperationListResultPage) NotDone() bool {
return !page.aolr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page APIOperationListResultPage) Response() APIOperationListResult {
return page.aolr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page APIOperationListResultPage) Values() []APIOperation {
if page.aolr.IsEmpty() {
return nil
}
return *page.aolr.Value
}
// Creates a new instance of the APIOperationListResultPage type.
func NewAPIOperationListResultPage(cur APIOperationListResult, getNextPage func(context.Context, APIOperationListResult) (APIOperationListResult, error)) APIOperationListResultPage {
return APIOperationListResultPage{
fn: getNextPage,
aolr: cur,
}
}
// Cache a cache instance. Follows Azure Resource Manager standards:
// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md
type Cache struct {
autorest.Response `json:"-"`
// Tags - ARM tags as name/value pairs.
Tags interface{} `json:"tags,omitempty"`
// ID - READ-ONLY; Fully qualified URL of the cache.
ID *string `json:"id,omitempty"`
// Location - Region name string.
Location *string `json:"location,omitempty"`
// Name - READ-ONLY; Name of cache.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Type for the cache; Microsoft.StorageCache/Cache
Type *string `json:"type,omitempty"`
// CacheProperties - Properties for the cache.
*CacheProperties `json:"properties,omitempty"`
// Sku - Sku for the cache.
Sku *CacheSku `json:"sku,omitempty"`
}
// MarshalJSON is the custom marshaler for Cache.
func (c Cache) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if c.Tags != nil {
objectMap["tags"] = c.Tags
}
if c.Location != nil {
objectMap["location"] = c.Location
}
if c.CacheProperties != nil {
objectMap["properties"] = c.CacheProperties
}
if c.Sku != nil {
objectMap["sku"] = c.Sku
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Cache struct.
func (c *Cache) 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 "tags":
if v != nil {
var tags interface{}
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
c.Tags = tags
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
c.ID = &ID
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
c.Location = &location
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
c.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
c.Type = &typeVar
}
case "properties":
if v != nil {
var cacheProperties CacheProperties
err = json.Unmarshal(*v, &cacheProperties)
if err != nil {
return err
}
c.CacheProperties = &cacheProperties
}
case "sku":
if v != nil {
var sku CacheSku
err = json.Unmarshal(*v, &sku)
if err != nil {
return err
}
c.Sku = &sku
}
}
}
return nil
}
// CacheHealth an indication of cache health. Gives more information about health than just that related
// to provisioning.
type CacheHealth struct {
// State - List of cache health states. Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', 'Stopped', 'Upgrading', 'Flushing'
State HealthStateType `json:"state,omitempty"`
// StatusDescription - Describes explanation of state.
StatusDescription *string `json:"statusDescription,omitempty"`
}
// CacheProperties properties for the cache.
type CacheProperties struct {
// CacheSizeGB - The size of this cache's cache, in GB.
CacheSizeGB *int32 `json:"cacheSizeGB,omitempty"`
// Health - READ-ONLY; Health of the cache.
Health *CacheHealth `json:"health,omitempty"`
// MountAddresses - READ-ONLY; Array of IP addresses that can be used by clients mounting this Cache.
MountAddresses *[]string `json:"mountAddresses,omitempty"`
// 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'
ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
// Subnet - Subnet used for the cache.
Subnet *string `json:"subnet,omitempty"`
// UpgradeStatus - Upgrade status of the cache.
UpgradeStatus *CacheUpgradeStatus `json:"upgradeStatus,omitempty"`
}
// MarshalJSON is the custom marshaler for CacheProperties.
func (c CacheProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if c.CacheSizeGB != nil {
objectMap["cacheSizeGB"] = c.CacheSizeGB
}
if c.ProvisioningState != "" {
objectMap["provisioningState"] = c.ProvisioningState
}
if c.Subnet != nil {
objectMap["subnet"] = c.Subnet
}
if c.UpgradeStatus != nil {
objectMap["upgradeStatus"] = c.UpgradeStatus
}
return json.Marshal(objectMap)
}
// CachesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type CachesCreateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(CachesClient) (Cache, error)
}
// CachesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type CachesDeleteFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(CachesClient) (SetObject, error)
}
// CachesFlushFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type CachesFlushFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(CachesClient) (SetObject, error)
}
// CacheSku sku for the cache.
type CacheSku struct {
// Name - Sku name for this cache.
Name *string `json:"name,omitempty"`
}
// CachesListResult result of the request to list caches. It contains a list of caches and a URL link to
// get the next set of results.
type CachesListResult struct {
autorest.Response `json:"-"`
// NextLink - URL to get the next set of cache list results if there are any.
NextLink *string `json:"nextLink,omitempty"`
// Value - List of caches.
Value *[]Cache `json:"value,omitempty"`
}
// CachesListResultIterator provides access to a complete listing of Cache values.
type CachesListResultIterator struct {
i int
page CachesListResultPage
}
// 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 *CachesListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultIterator.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 *CachesListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter CachesListResultIterator) 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 CachesListResultIterator) Response() CachesListResult {
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 CachesListResultIterator) Value() Cache {
if !iter.page.NotDone() {
return Cache{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the CachesListResultIterator type.
func NewCachesListResultIterator(page CachesListResultPage) CachesListResultIterator {
return CachesListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (clr CachesListResult) IsEmpty() bool {
return clr.Value == nil || len(*clr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (clr CachesListResult) hasNextLink() bool {
return clr.NextLink != nil && len(*clr.NextLink) != 0
}
// cachesListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (clr CachesListResult) cachesListResultPreparer(ctx context.Context) (*http.Request, error) {
if !clr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(clr.NextLink)))
}
// CachesListResultPage contains a page of Cache values.
type CachesListResultPage struct {
fn func(context.Context, CachesListResult) (CachesListResult, error)
clr CachesListResult
}
// 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 *CachesListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesListResultPage.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.clr)
if err != nil {
return err
}
page.clr = 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 *CachesListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page CachesListResultPage) NotDone() bool {
return !page.clr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page CachesListResultPage) Response() CachesListResult {
return page.clr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page CachesListResultPage) Values() []Cache {
if page.clr.IsEmpty() {
return nil
}
return *page.clr.Value
}
// Creates a new instance of the CachesListResultPage type.
func NewCachesListResultPage(cur CachesListResult, getNextPage func(context.Context, CachesListResult) (CachesListResult, error)) CachesListResultPage {
return CachesListResultPage{
fn: getNextPage,
clr: cur,
}
}
// CachesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type CachesStartFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(CachesClient) (SetObject, error)
}
// CachesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type CachesStopFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(CachesClient) (SetObject, error)
}
// CachesUpgradeFirmwareFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type CachesUpgradeFirmwareFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(CachesClient) (SetObject, error)
}
// CacheUpgradeStatus properties describing the software upgrade state of the cache
type CacheUpgradeStatus struct {
// CurrentFirmwareVersion - READ-ONLY; Version string of the firmware currently installed on this cache.
CurrentFirmwareVersion *string `json:"currentFirmwareVersion,omitempty"`
// 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'
FirmwareUpdateStatus FirmwareStatusType `json:"firmwareUpdateStatus,omitempty"`
// FirmwareUpdateDeadline - READ-ONLY; Time at which the pending firmware update will automatically be installed on the cache.
FirmwareUpdateDeadline *date.Time `json:"firmwareUpdateDeadline,omitempty"`
// LastFirmwareUpdate - READ-ONLY; Time of the last successful firmware update.
LastFirmwareUpdate *date.Time `json:"lastFirmwareUpdate,omitempty"`
// PendingFirmwareVersion - READ-ONLY; When firmwareUpdateAvailable is true, this field holds the version string for the update.
PendingFirmwareVersion *string `json:"pendingFirmwareVersion,omitempty"`
}
// ClfsTarget storage container for use as a CLFS StorageTarget.
type ClfsTarget struct {
// Target - URL of storage container.
Target *string `json:"target,omitempty"`
}
// CloudError an error response.
type CloudError struct {
// Error - The body of the error.
Error *CloudErrorBody `json:"error,omitempty"`
}
// CloudErrorBody an error response.
type CloudErrorBody struct {
// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
Code *string `json:"code,omitempty"`
// Details - A list of additional details about the error.
Details *[]CloudErrorBody `json:"details,omitempty"`
// Message - A message describing the error, intended to be suitable for display in a user interface.
Message *string `json:"message,omitempty"`
// Target - The target of the particular error. For example, the name of the property in error.
Target *string `json:"target,omitempty"`
}
// NamespaceJunction a namespace junction.
type NamespaceJunction struct {
// NamespacePath - Namespace path on a cache for a storage target.
NamespacePath *string `json:"namespacePath,omitempty"`
// TargetPath - Path in storage target to which namespacePath points.
TargetPath *string `json:"targetPath,omitempty"`
// NfsExport - NFS export where targetPath exists.
NfsExport *string `json:"nfsExport,omitempty"`
}
// Nfs3Target an NFS mount point for use as a StorageTarget.
type Nfs3Target struct {
// Target - IP or name of an NFS Storage Target host, ie: 10.0.44.44
Target *string `json:"target,omitempty"`
// UsageModel - Identifies the primary usage model to be used for this storage target. GET choices from .../usageModels
UsageModel *string `json:"usageModel,omitempty"`
}
// ResourceSku a resource SKU
type ResourceSku struct {
// ResourceType - READ-ONLY; The type of resource the sku applies to.
ResourceType *string `json:"resourceType,omitempty"`
// Capabilities - A list of capabilities of this SKU, such as throughput or ops/sec
Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"`
// Locations - READ-ONLY; The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.).
Locations *[]string `json:"locations,omitempty"`
// LocationInfo - The set of locations that the SKU is available.
LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"`
// Name - The name of this sku.
Name *string `json:"name,omitempty"`
// Restrictions - The restrictions because of which SKU cannot be used. This is empty if there are no restrictions.
Restrictions *[]Restriction `json:"restrictions,omitempty"`
}
// MarshalJSON is the custom marshaler for ResourceSku.
func (rs ResourceSku) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if rs.Capabilities != nil {
objectMap["capabilities"] = rs.Capabilities
}
if rs.LocationInfo != nil {
objectMap["locationInfo"] = rs.LocationInfo
}
if rs.Name != nil {
objectMap["name"] = rs.Name
}
if rs.Restrictions != nil {
objectMap["restrictions"] = rs.Restrictions
}
return json.Marshal(objectMap)
}
// ResourceSkuCapabilities a resource SKU capability.
type ResourceSkuCapabilities struct {
// Name - Name of a capability, such as ops/sec
Name *string `json:"name,omitempty"`
// Value - Quantity, if the capability is measured by quantity
Value *string `json:"value,omitempty"`
}
// ResourceSkuLocationInfo resource SKU location information.
type ResourceSkuLocationInfo struct {
// Location - Location where this Sku is available
Location *string `json:"location,omitempty"`
// Zones - Zones if any.
Zones *[]string `json:"zones,omitempty"`
}
// ResourceSkusResult the response from the List Cache SKUs operation.
type ResourceSkusResult struct {
autorest.Response `json:"-"`
// NextLink - The uri to fetch the next page of cache Skus.
NextLink *string `json:"nextLink,omitempty"`
// Value - READ-ONLY; The list of skus available for the subscription.
Value *[]ResourceSku `json:"value,omitempty"`
}
// MarshalJSON is the custom marshaler for ResourceSkusResult.
func (rsr ResourceSkusResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if rsr.NextLink != nil {
objectMap["nextLink"] = rsr.NextLink
}
return json.Marshal(objectMap)
}
// ResourceSkusResultIterator provides access to a complete listing of ResourceSku values.
type ResourceSkusResultIterator struct {
i int
page ResourceSkusResultPage
}
// 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 *ResourceSkusResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultIterator.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 *ResourceSkusResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter ResourceSkusResultIterator) 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 ResourceSkusResultIterator) Response() ResourceSkusResult {
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 ResourceSkusResultIterator) Value() ResourceSku {
if !iter.page.NotDone() {
return ResourceSku{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the ResourceSkusResultIterator type.
func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResultIterator {
return ResourceSkusResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (rsr ResourceSkusResult) IsEmpty() bool {
return rsr.Value == nil || len(*rsr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (rsr ResourceSkusResult) hasNextLink() bool {
return rsr.NextLink != nil && len(*rsr.NextLink) != 0
}
// resourceSkusResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (rsr ResourceSkusResult) resourceSkusResultPreparer(ctx context.Context) (*http.Request, error) {
if !rsr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(rsr.NextLink)))
}
// ResourceSkusResultPage contains a page of ResourceSku values.
type ResourceSkusResultPage struct {
fn func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)
rsr ResourceSkusResult
}
// 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 *ResourceSkusResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultPage.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.rsr)
if err != nil {
return err
}
page.rsr = 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 *ResourceSkusResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page ResourceSkusResultPage) NotDone() bool {
return !page.rsr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page ResourceSkusResultPage) Response() ResourceSkusResult {
return page.rsr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page ResourceSkusResultPage) Values() []ResourceSku {
if page.rsr.IsEmpty() {
return nil
}
return *page.rsr.Value
}
// Creates a new instance of the ResourceSkusResultPage type.
func NewResourceSkusResultPage(cur ResourceSkusResult, getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage {
return ResourceSkusResultPage{
fn: getNextPage,
rsr: cur,
}
}
// Restriction the restriction because of which SKU cannot be used.
type Restriction struct {
// Type - READ-ONLY; The type of restrictions. As of now only possible value for this is location.
Type *string `json:"type,omitempty"`
// Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted.
Values *[]string `json:"values,omitempty"`
// ReasonCode - The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: 'QuotaID', 'NotAvailableForSubscription'
ReasonCode ReasonCode `json:"reasonCode,omitempty"`
}
// MarshalJSON is the custom marshaler for Restriction.
func (r Restriction) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.ReasonCode != "" {
objectMap["reasonCode"] = r.ReasonCode
}
return json.Marshal(objectMap)
}
// SetObject ...
type SetObject struct {
autorest.Response `json:"-"`
Value interface{} `json:"value,omitempty"`
}
// StorageTarget a storage system being cached by a Cache.
type StorageTarget struct {
autorest.Response `json:"-"`
// Name - READ-ONLY; A fully qualified URL.
Name *string `json:"name,omitempty"`
// ID - READ-ONLY; Resource Id
ID *string `json:"id,omitempty"`
// Type - READ-ONLY; Type for the storage target; Microsoft.StorageCache/Cache/StorageTarget
Type *string `json:"type,omitempty"`
// StorageTargetProperties - Properties of the storage target.
*StorageTargetProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for StorageTarget.
func (st StorageTarget) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if st.StorageTargetProperties != nil {
objectMap["properties"] = st.StorageTargetProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for StorageTarget struct.
func (st *StorageTarget) 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 "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
st.Name = &name
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
st.ID = &ID
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
st.Type = &typeVar
}
case "properties":
if v != nil {
var storageTargetProperties StorageTargetProperties
err = json.Unmarshal(*v, &storageTargetProperties)
if err != nil {
return err
}
st.StorageTargetProperties = &storageTargetProperties
}
}
}
return nil
}
// StorageTargetProperties properties of the storage target.
type StorageTargetProperties struct {
// Junctions - List of cache namespace to target namespace associations.
Junctions *[]NamespaceJunction `json:"junctions,omitempty"`
// TargetType - Type for storage target. Possible values include: 'StorageTargetTypeNfs3', 'StorageTargetTypeClfs', 'StorageTargetTypeUnknown'
TargetType StorageTargetType `json:"targetType,omitempty"`
// 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'
ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"`
// Nfs3 - Properties when nfs3 target.
Nfs3 *Nfs3Target `json:"nfs3,omitempty"`
// Clfs - Properties when clfs target.
Clfs *ClfsTarget `json:"clfs,omitempty"`
// Unknown - Properties when unknown target.
Unknown *UnknownTarget `json:"unknown,omitempty"`
}
// StorageTargetsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type StorageTargetsCreateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(StorageTargetsClient) (StorageTarget, error)
}
// StorageTargetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type StorageTargetsDeleteFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(StorageTargetsClient) (SetObject, error)
}
// StorageTargetsResult a list of storage targets.
type StorageTargetsResult struct {
autorest.Response `json:"-"`
// NextLink - The uri to fetch the next page of storage targets.
NextLink *string `json:"nextLink,omitempty"`
// Value - The list of storage targets defined for the cache.
Value *[]StorageTarget `json:"value,omitempty"`
}