-
Notifications
You must be signed in to change notification settings - Fork 842
/
models.go
4055 lines (3800 loc) · 167 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 servicefabric
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// 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/servicefabric/mgmt/2019-03-01/servicefabric"
// ApplicationDeltaHealthPolicy defines a delta health policy used to evaluate the health of an application
// or one of its child entities when upgrading the cluster.
type ApplicationDeltaHealthPolicy struct {
// DefaultServiceTypeDeltaHealthPolicy - The delta health policy used by default to evaluate the health of a service type when upgrading the cluster.
DefaultServiceTypeDeltaHealthPolicy *ServiceTypeDeltaHealthPolicy `json:"defaultServiceTypeDeltaHealthPolicy,omitempty"`
// ServiceTypeDeltaHealthPolicies - The map with service type delta health policy per service type name. The map is empty by default.
ServiceTypeDeltaHealthPolicies map[string]*ServiceTypeDeltaHealthPolicy `json:"serviceTypeDeltaHealthPolicies"`
}
// MarshalJSON is the custom marshaler for ApplicationDeltaHealthPolicy.
func (adhp ApplicationDeltaHealthPolicy) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if adhp.DefaultServiceTypeDeltaHealthPolicy != nil {
objectMap["defaultServiceTypeDeltaHealthPolicy"] = adhp.DefaultServiceTypeDeltaHealthPolicy
}
if adhp.ServiceTypeDeltaHealthPolicies != nil {
objectMap["serviceTypeDeltaHealthPolicies"] = adhp.ServiceTypeDeltaHealthPolicies
}
return json.Marshal(objectMap)
}
// ApplicationHealthPolicy defines a health policy used to evaluate the health of an application or one of
// its children entities.
type ApplicationHealthPolicy struct {
// DefaultServiceTypeHealthPolicy - The health policy used by default to evaluate the health of a service type.
DefaultServiceTypeHealthPolicy *ServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"`
// ServiceTypeHealthPolicies - The map with service type health policy per service type name. The map is empty by default.
ServiceTypeHealthPolicies map[string]*ServiceTypeHealthPolicy `json:"serviceTypeHealthPolicies"`
}
// MarshalJSON is the custom marshaler for ApplicationHealthPolicy.
func (ahp ApplicationHealthPolicy) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ahp.DefaultServiceTypeHealthPolicy != nil {
objectMap["defaultServiceTypeHealthPolicy"] = ahp.DefaultServiceTypeHealthPolicy
}
if ahp.ServiceTypeHealthPolicies != nil {
objectMap["serviceTypeHealthPolicies"] = ahp.ServiceTypeHealthPolicies
}
return json.Marshal(objectMap)
}
// ApplicationMetricDescription describes capacity information for a custom resource balancing metric. This
// can be used to limit the total consumption of this metric by the services of this application.
type ApplicationMetricDescription struct {
// Name - The name of the metric.
Name *string `json:"name,omitempty"`
// MaximumCapacity - The maximum node capacity for Service Fabric application.
// This is the maximum Load for an instance of this application on a single node. Even if the capacity of node is greater than this value, Service Fabric will limit the total load of services within the application on each node to this value.
// If set to zero, capacity for this metric is unlimited on each node.
// When creating a new application with application capacity defined, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity.
// When updating existing application with application capacity, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity.
MaximumCapacity *int64 `json:"maximumCapacity,omitempty"`
// ReservationCapacity - The node reservation capacity for Service Fabric application.
// This is the amount of load which is reserved on nodes which have instances of this application.
// If MinimumNodes is specified, then the product of these values will be the capacity reserved in the cluster for the application.
// If set to zero, no capacity is reserved for this metric.
// When setting application capacity or when updating application capacity; this value must be smaller than or equal to MaximumCapacity for each metric.
ReservationCapacity *int64 `json:"reservationCapacity,omitempty"`
// TotalApplicationCapacity - The total metric capacity for Service Fabric application.
// This is the total metric capacity for this application in the cluster. Service Fabric will try to limit the sum of loads of services within the application to this value.
// When creating a new application with application capacity defined, the product of MaximumNodes and MaximumCapacity must always be smaller than or equal to this value.
TotalApplicationCapacity *int64 `json:"totalApplicationCapacity,omitempty"`
}
// ApplicationResource the application resource.
type ApplicationResource struct {
autorest.Response `json:"-"`
// ApplicationResourceProperties - The application resource properties.
*ApplicationResourceProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Azure resource identifier.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Azure resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Azure resource type.
Type *string `json:"type,omitempty"`
// Location - It will be deprecated in New API, resource location depends on the parent resource.
Location *string `json:"location,omitempty"`
// Tags - Azure resource tags.
Tags map[string]*string `json:"tags"`
// Etag - READ-ONLY; Azure resource etag.
Etag *string `json:"etag,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationResource.
func (ar ApplicationResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ar.ApplicationResourceProperties != nil {
objectMap["properties"] = ar.ApplicationResourceProperties
}
if ar.Location != nil {
objectMap["location"] = ar.Location
}
if ar.Tags != nil {
objectMap["tags"] = ar.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ApplicationResource struct.
func (ar *ApplicationResource) 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 applicationResourceProperties ApplicationResourceProperties
err = json.Unmarshal(*v, &applicationResourceProperties)
if err != nil {
return err
}
ar.ApplicationResourceProperties = &applicationResourceProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ar.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ar.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ar.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
ar.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
ar.Tags = tags
}
case "etag":
if v != nil {
var etag string
err = json.Unmarshal(*v, &etag)
if err != nil {
return err
}
ar.Etag = &etag
}
}
}
return nil
}
// ApplicationResourceList the list of application resources.
type ApplicationResourceList struct {
autorest.Response `json:"-"`
Value *[]ApplicationResource `json:"value,omitempty"`
// NextLink - READ-ONLY; URL to get the next set of application list results if there are any.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationResourceList.
func (arl ApplicationResourceList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if arl.Value != nil {
objectMap["value"] = arl.Value
}
return json.Marshal(objectMap)
}
// ApplicationResourceProperties the application resource properties.
type ApplicationResourceProperties struct {
// ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response
ProvisioningState *string `json:"provisioningState,omitempty"`
// TypeName - The application type name as defined in the application manifest.
TypeName *string `json:"typeName,omitempty"`
// TypeVersion - The version of the application type as defined in the application manifest.
TypeVersion *string `json:"typeVersion,omitempty"`
// Parameters - List of application parameters with overridden values from their default values specified in the application manifest.
Parameters map[string]*string `json:"parameters"`
// UpgradePolicy - Describes the policy for a monitored application upgrade.
UpgradePolicy *ApplicationUpgradePolicy `json:"upgradePolicy,omitempty"`
// MinimumNodes - The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property.
MinimumNodes *int64 `json:"minimumNodes,omitempty"`
// MaximumNodes - The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node.
MaximumNodes *int64 `json:"maximumNodes,omitempty"`
// RemoveApplicationCapacity - Remove the current application capacity settings.
RemoveApplicationCapacity *bool `json:"removeApplicationCapacity,omitempty"`
// Metrics - List of application capacity metric description.
Metrics *[]ApplicationMetricDescription `json:"metrics,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationResourceProperties.
func (arp ApplicationResourceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if arp.TypeName != nil {
objectMap["typeName"] = arp.TypeName
}
if arp.TypeVersion != nil {
objectMap["typeVersion"] = arp.TypeVersion
}
if arp.Parameters != nil {
objectMap["parameters"] = arp.Parameters
}
if arp.UpgradePolicy != nil {
objectMap["upgradePolicy"] = arp.UpgradePolicy
}
if arp.MinimumNodes != nil {
objectMap["minimumNodes"] = arp.MinimumNodes
}
if arp.MaximumNodes != nil {
objectMap["maximumNodes"] = arp.MaximumNodes
}
if arp.RemoveApplicationCapacity != nil {
objectMap["removeApplicationCapacity"] = arp.RemoveApplicationCapacity
}
if arp.Metrics != nil {
objectMap["metrics"] = arp.Metrics
}
return json.Marshal(objectMap)
}
// ApplicationResourceUpdate the application resource for patch operations.
type ApplicationResourceUpdate struct {
// ApplicationResourceUpdateProperties - The application resource properties for patch operations.
*ApplicationResourceUpdateProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Azure resource identifier.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Azure resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Azure resource type.
Type *string `json:"type,omitempty"`
// Location - It will be deprecated in New API, resource location depends on the parent resource.
Location *string `json:"location,omitempty"`
// Tags - Azure resource tags.
Tags map[string]*string `json:"tags"`
// Etag - READ-ONLY; Azure resource etag.
Etag *string `json:"etag,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationResourceUpdate.
func (aru ApplicationResourceUpdate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if aru.ApplicationResourceUpdateProperties != nil {
objectMap["properties"] = aru.ApplicationResourceUpdateProperties
}
if aru.Location != nil {
objectMap["location"] = aru.Location
}
if aru.Tags != nil {
objectMap["tags"] = aru.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ApplicationResourceUpdate struct.
func (aru *ApplicationResourceUpdate) 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 applicationResourceUpdateProperties ApplicationResourceUpdateProperties
err = json.Unmarshal(*v, &applicationResourceUpdateProperties)
if err != nil {
return err
}
aru.ApplicationResourceUpdateProperties = &applicationResourceUpdateProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
aru.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
aru.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
aru.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
aru.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
aru.Tags = tags
}
case "etag":
if v != nil {
var etag string
err = json.Unmarshal(*v, &etag)
if err != nil {
return err
}
aru.Etag = &etag
}
}
}
return nil
}
// ApplicationResourceUpdateProperties the application resource properties for patch operations.
type ApplicationResourceUpdateProperties struct {
// TypeVersion - The version of the application type as defined in the application manifest.
TypeVersion *string `json:"typeVersion,omitempty"`
// Parameters - List of application parameters with overridden values from their default values specified in the application manifest.
Parameters map[string]*string `json:"parameters"`
// UpgradePolicy - Describes the policy for a monitored application upgrade.
UpgradePolicy *ApplicationUpgradePolicy `json:"upgradePolicy,omitempty"`
// MinimumNodes - The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property.
MinimumNodes *int64 `json:"minimumNodes,omitempty"`
// MaximumNodes - The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node.
MaximumNodes *int64 `json:"maximumNodes,omitempty"`
// RemoveApplicationCapacity - Remove the current application capacity settings.
RemoveApplicationCapacity *bool `json:"removeApplicationCapacity,omitempty"`
// Metrics - List of application capacity metric description.
Metrics *[]ApplicationMetricDescription `json:"metrics,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationResourceUpdateProperties.
func (arup ApplicationResourceUpdateProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if arup.TypeVersion != nil {
objectMap["typeVersion"] = arup.TypeVersion
}
if arup.Parameters != nil {
objectMap["parameters"] = arup.Parameters
}
if arup.UpgradePolicy != nil {
objectMap["upgradePolicy"] = arup.UpgradePolicy
}
if arup.MinimumNodes != nil {
objectMap["minimumNodes"] = arup.MinimumNodes
}
if arup.MaximumNodes != nil {
objectMap["maximumNodes"] = arup.MaximumNodes
}
if arup.RemoveApplicationCapacity != nil {
objectMap["removeApplicationCapacity"] = arup.RemoveApplicationCapacity
}
if arup.Metrics != nil {
objectMap["metrics"] = arup.Metrics
}
return json.Marshal(objectMap)
}
// ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type ApplicationsCreateOrUpdateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(ApplicationsClient) (ApplicationResource, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for ApplicationsCreateOrUpdateFuture.Result.
func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (ar ApplicationResource, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
ar.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent {
ar, err = client.CreateOrUpdateResponder(ar.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request")
}
}
return
}
// ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ApplicationsDeleteFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(ApplicationsClient) (autorest.Response, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for ApplicationsDeleteFuture.Result.
func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
ar.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// ApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ApplicationsUpdateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(ApplicationsClient) (ApplicationResource, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for ApplicationsUpdateFuture.Result.
func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ar ApplicationResource, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
ar.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent {
ar, err = client.UpdateResponder(ar.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request")
}
}
return
}
// ApplicationTypeResource the application type name resource
type ApplicationTypeResource struct {
autorest.Response `json:"-"`
// ApplicationTypeResourceProperties - The application type name properties
*ApplicationTypeResourceProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Azure resource identifier.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Azure resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Azure resource type.
Type *string `json:"type,omitempty"`
// Location - It will be deprecated in New API, resource location depends on the parent resource.
Location *string `json:"location,omitempty"`
// Tags - Azure resource tags.
Tags map[string]*string `json:"tags"`
// Etag - READ-ONLY; Azure resource etag.
Etag *string `json:"etag,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationTypeResource.
func (atr ApplicationTypeResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if atr.ApplicationTypeResourceProperties != nil {
objectMap["properties"] = atr.ApplicationTypeResourceProperties
}
if atr.Location != nil {
objectMap["location"] = atr.Location
}
if atr.Tags != nil {
objectMap["tags"] = atr.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ApplicationTypeResource struct.
func (atr *ApplicationTypeResource) 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 applicationTypeResourceProperties ApplicationTypeResourceProperties
err = json.Unmarshal(*v, &applicationTypeResourceProperties)
if err != nil {
return err
}
atr.ApplicationTypeResourceProperties = &applicationTypeResourceProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
atr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
atr.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
atr.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
atr.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
atr.Tags = tags
}
case "etag":
if v != nil {
var etag string
err = json.Unmarshal(*v, &etag)
if err != nil {
return err
}
atr.Etag = &etag
}
}
}
return nil
}
// ApplicationTypeResourceList the list of application type names.
type ApplicationTypeResourceList struct {
autorest.Response `json:"-"`
Value *[]ApplicationTypeResource `json:"value,omitempty"`
// NextLink - READ-ONLY; URL to get the next set of application type list results if there are any.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationTypeResourceList.
func (atrl ApplicationTypeResourceList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if atrl.Value != nil {
objectMap["value"] = atrl.Value
}
return json.Marshal(objectMap)
}
// ApplicationTypeResourceProperties the application type name properties
type ApplicationTypeResourceProperties struct {
// ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response.
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationTypeResourceProperties.
func (atrp ApplicationTypeResourceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ApplicationTypesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ApplicationTypesDeleteFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(ApplicationTypesClient) (autorest.Response, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *ApplicationTypesDeleteFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for ApplicationTypesDeleteFuture.Result.
func (future *ApplicationTypesDeleteFuture) result(client ApplicationTypesClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
ar.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypesDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// ApplicationTypeVersionResource an application type version resource for the specified application type
// name resource.
type ApplicationTypeVersionResource struct {
autorest.Response `json:"-"`
// ApplicationTypeVersionResourceProperties - The properties of the application type version resource.
*ApplicationTypeVersionResourceProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Azure resource identifier.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Azure resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Azure resource type.
Type *string `json:"type,omitempty"`
// Location - It will be deprecated in New API, resource location depends on the parent resource.
Location *string `json:"location,omitempty"`
// Tags - Azure resource tags.
Tags map[string]*string `json:"tags"`
// Etag - READ-ONLY; Azure resource etag.
Etag *string `json:"etag,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationTypeVersionResource.
func (atvr ApplicationTypeVersionResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if atvr.ApplicationTypeVersionResourceProperties != nil {
objectMap["properties"] = atvr.ApplicationTypeVersionResourceProperties
}
if atvr.Location != nil {
objectMap["location"] = atvr.Location
}
if atvr.Tags != nil {
objectMap["tags"] = atvr.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ApplicationTypeVersionResource struct.
func (atvr *ApplicationTypeVersionResource) 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 applicationTypeVersionResourceProperties ApplicationTypeVersionResourceProperties
err = json.Unmarshal(*v, &applicationTypeVersionResourceProperties)
if err != nil {
return err
}
atvr.ApplicationTypeVersionResourceProperties = &applicationTypeVersionResourceProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
atvr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
atvr.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
atvr.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
atvr.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
atvr.Tags = tags
}
case "etag":
if v != nil {
var etag string
err = json.Unmarshal(*v, &etag)
if err != nil {
return err
}
atvr.Etag = &etag
}
}
}
return nil
}
// ApplicationTypeVersionResourceList the list of application type version resources for the specified
// application type name resource.
type ApplicationTypeVersionResourceList struct {
autorest.Response `json:"-"`
Value *[]ApplicationTypeVersionResource `json:"value,omitempty"`
// NextLink - READ-ONLY; URL to get the next set of application type version list results if there are any.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplicationTypeVersionResourceList.
func (atvrl ApplicationTypeVersionResourceList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if atvrl.Value != nil {
objectMap["value"] = atvrl.Value
}
return json.Marshal(objectMap)
}
// ApplicationTypeVersionResourceProperties the properties of the application type version resource.
type ApplicationTypeVersionResourceProperties struct {
// ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response
ProvisioningState *string `json:"provisioningState,omitempty"`
// AppPackageURL - The URL to the application package
AppPackageURL *string `json:"appPackageUrl,omitempty"`
// DefaultParameterList - READ-ONLY; List of application type parameters that can be overridden when creating or updating the application.
DefaultParameterList map[string]*string `json:"defaultParameterList"`
}
// MarshalJSON is the custom marshaler for ApplicationTypeVersionResourceProperties.
func (atvrp ApplicationTypeVersionResourceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if atvrp.AppPackageURL != nil {
objectMap["appPackageUrl"] = atvrp.AppPackageURL
}
return json.Marshal(objectMap)
}
// ApplicationTypeVersionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of
// a long-running operation.
type ApplicationTypeVersionsCreateOrUpdateFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(ApplicationTypeVersionsClient) (ApplicationTypeVersionResource, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *ApplicationTypeVersionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for ApplicationTypeVersionsCreateOrUpdateFuture.Result.
func (future *ApplicationTypeVersionsCreateOrUpdateFuture) result(client ApplicationTypeVersionsClient) (atvr ApplicationTypeVersionResource, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
atvr.Response.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if atvr.Response.Response, err = future.GetResult(sender); err == nil && atvr.Response.Response.StatusCode != http.StatusNoContent {
atvr, err = client.CreateOrUpdateResponder(atvr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture", "Result", atvr.Response.Response, "Failure responding to request")
}
}
return
}
// ApplicationTypeVersionsDeleteFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type ApplicationTypeVersionsDeleteFuture struct {
azure.FutureAPI
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
Result func(ApplicationTypeVersionsClient) (autorest.Response, error)
}
// UnmarshalJSON is the custom unmarshaller for CreateFuture.
func (future *ApplicationTypeVersionsDeleteFuture) UnmarshalJSON(body []byte) error {
var azFuture azure.Future
if err := json.Unmarshal(body, &azFuture); err != nil {
return err
}
future.FutureAPI = &azFuture
future.Result = future.result
return nil
}
// result is the default implementation for ApplicationTypeVersionsDeleteFuture.Result.
func (future *ApplicationTypeVersionsDeleteFuture) result(client ApplicationTypeVersionsClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
ar.Response = future.Response()
err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypeVersionsDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// ApplicationUpgradePolicy describes the policy for a monitored application upgrade.
type ApplicationUpgradePolicy struct {
// UpgradeReplicaSetCheckTimeout - The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).
UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"`
// ForceRestart - If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data).
ForceRestart *bool `json:"forceRestart,omitempty"`
// RollingUpgradeMonitoringPolicy - The policy used for monitoring the application upgrade
RollingUpgradeMonitoringPolicy *ArmRollingUpgradeMonitoringPolicy `json:"rollingUpgradeMonitoringPolicy,omitempty"`
// ApplicationHealthPolicy - Defines a health policy used to evaluate the health of an application or one of its children entities.
ApplicationHealthPolicy *ArmApplicationHealthPolicy `json:"applicationHealthPolicy,omitempty"`
}
// ArmApplicationHealthPolicy defines a health policy used to evaluate the health of an application or one
// of its children entities.
type ArmApplicationHealthPolicy struct {
// ConsiderWarningAsError - Indicates whether warnings are treated with the same severity as errors.
ConsiderWarningAsError *bool `json:"considerWarningAsError,omitempty"`
// MaxPercentUnhealthyDeployedApplications - The maximum allowed percentage of unhealthy deployed applications. Allowed values are Byte values from zero to 100.
// The percentage represents the maximum tolerated percentage of deployed applications that can be unhealthy before the application is considered in error.
// This is calculated by dividing the number of unhealthy deployed applications over the number of nodes where the application is currently deployed on in the cluster.
// The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero.
MaxPercentUnhealthyDeployedApplications *int32 `json:"maxPercentUnhealthyDeployedApplications,omitempty"`
// DefaultServiceTypeHealthPolicy - The health policy used by default to evaluate the health of a service type.
DefaultServiceTypeHealthPolicy *ArmServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"`
// ServiceTypeHealthPolicyMap - The map with service type health policy per service type name. The map is empty by default.
ServiceTypeHealthPolicyMap map[string]*ArmServiceTypeHealthPolicy `json:"serviceTypeHealthPolicyMap"`
}
// MarshalJSON is the custom marshaler for ArmApplicationHealthPolicy.
func (aahp ArmApplicationHealthPolicy) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if aahp.ConsiderWarningAsError != nil {
objectMap["considerWarningAsError"] = aahp.ConsiderWarningAsError
}
if aahp.MaxPercentUnhealthyDeployedApplications != nil {
objectMap["maxPercentUnhealthyDeployedApplications"] = aahp.MaxPercentUnhealthyDeployedApplications
}
if aahp.DefaultServiceTypeHealthPolicy != nil {
objectMap["defaultServiceTypeHealthPolicy"] = aahp.DefaultServiceTypeHealthPolicy
}
if aahp.ServiceTypeHealthPolicyMap != nil {
objectMap["serviceTypeHealthPolicyMap"] = aahp.ServiceTypeHealthPolicyMap
}
return json.Marshal(objectMap)
}