forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
9029 lines (8511 loc) · 318 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 documentdb
// 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/cosmos-db/mgmt/2020-06-01-preview/documentdb"
// APIProperties ...
type APIProperties struct {
// ServerVersion - Describes the ServerVersion of an a MongoDB account. Possible values include: 'ThreeFullStopTwo', 'ThreeFullStopSix'
ServerVersion ServerVersion `json:"serverVersion,omitempty"`
}
// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other
// than required location and tags
type ARMProxyResource struct {
// ID - READ-ONLY; The unique resource identifier of the database account.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the database account.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of Azure resource.
Type *string `json:"type,omitempty"`
}
// ARMResourceProperties the core properties of ARM resources.
type ARMResourceProperties struct {
// ID - READ-ONLY; The unique resource identifier of the ARM resource.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the ARM resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of Azure resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource group to which the resource belongs.
Location *string `json:"location,omitempty"`
Tags map[string]*string `json:"tags"`
Identity *ManagedServiceIdentity `json:"identity,omitempty"`
}
// MarshalJSON is the custom marshaler for ARMResourceProperties.
func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if arp.Location != nil {
objectMap["location"] = arp.Location
}
if arp.Tags != nil {
objectMap["tags"] = arp.Tags
}
if arp.Identity != nil {
objectMap["identity"] = arp.Identity
}
return json.Marshal(objectMap)
}
// AutoscaleSettings ...
type AutoscaleSettings struct {
// MaxThroughput - Represents maximum throughput, the resource can scale up to.
MaxThroughput *int32 `json:"maxThroughput,omitempty"`
}
// AutoscaleSettingsResource cosmos DB provisioned throughput settings object
type AutoscaleSettingsResource struct {
// MaxThroughput - Represents maximum throughput container can scale up to.
MaxThroughput *int32 `json:"maxThroughput,omitempty"`
// AutoUpgradePolicy - Cosmos DB resource auto-upgrade policy
AutoUpgradePolicy *AutoUpgradePolicyResource `json:"autoUpgradePolicy,omitempty"`
// TargetMaxThroughput - READ-ONLY; Represents target maximum throughput container can scale up to once offer is no longer in pending state.
TargetMaxThroughput *int32 `json:"targetMaxThroughput,omitempty"`
}
// MarshalJSON is the custom marshaler for AutoscaleSettingsResource.
func (asr AutoscaleSettingsResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if asr.MaxThroughput != nil {
objectMap["maxThroughput"] = asr.MaxThroughput
}
if asr.AutoUpgradePolicy != nil {
objectMap["autoUpgradePolicy"] = asr.AutoUpgradePolicy
}
return json.Marshal(objectMap)
}
// AutoUpgradePolicyResource cosmos DB resource auto-upgrade policy
type AutoUpgradePolicyResource struct {
// ThroughputPolicy - Represents throughput policy which service must adhere to for auto-upgrade
ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,omitempty"`
}
// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
type AzureEntityResource struct {
// Etag - READ-ONLY; Resource Etag.
Etag *string `json:"etag,omitempty"`
// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the resource
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string `json:"type,omitempty"`
}
// BasicBackupPolicy the object representing the policy for taking backups on an account.
type BasicBackupPolicy interface {
AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool)
AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool)
AsBackupPolicy() (*BackupPolicy, bool)
}
// BackupPolicy the object representing the policy for taking backups on an account.
type BackupPolicy struct {
// Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous'
Type Type `json:"type,omitempty"`
}
func unmarshalBasicBackupPolicy(body []byte) (BasicBackupPolicy, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["type"] {
case string(TypePeriodic):
var pmbp PeriodicModeBackupPolicy
err := json.Unmarshal(body, &pmbp)
return pmbp, err
case string(TypeContinuous):
var cmbp ContinuousModeBackupPolicy
err := json.Unmarshal(body, &cmbp)
return cmbp, err
default:
var bp BackupPolicy
err := json.Unmarshal(body, &bp)
return bp, err
}
}
func unmarshalBasicBackupPolicyArray(body []byte) ([]BasicBackupPolicy, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
bpArray := make([]BasicBackupPolicy, len(rawMessages))
for index, rawMessage := range rawMessages {
bp, err := unmarshalBasicBackupPolicy(*rawMessage)
if err != nil {
return nil, err
}
bpArray[index] = bp
}
return bpArray, nil
}
// MarshalJSON is the custom marshaler for BackupPolicy.
func (bp BackupPolicy) MarshalJSON() ([]byte, error) {
bp.Type = TypeBackupPolicy
objectMap := make(map[string]interface{})
if bp.Type != "" {
objectMap["type"] = bp.Type
}
return json.Marshal(objectMap)
}
// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy.
func (bp BackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) {
return nil, false
}
// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy.
func (bp BackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) {
return nil, false
}
// AsBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy.
func (bp BackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) {
return &bp, true
}
// AsBasicBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy.
func (bp BackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) {
return &bp, true
}
// Capability cosmos DB capability object
type Capability struct {
// Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin".
Name *string `json:"name,omitempty"`
}
// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace.
type CassandraKeyspaceCreateUpdateParameters struct {
// CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace.
*CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The unique resource identifier of the ARM resource.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the ARM resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of Azure resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource group to which the resource belongs.
Location *string `json:"location,omitempty"`
Tags map[string]*string `json:"tags"`
Identity *ManagedServiceIdentity `json:"identity,omitempty"`
}
// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters.
func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ckcup.CassandraKeyspaceCreateUpdateProperties != nil {
objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties
}
if ckcup.Location != nil {
objectMap["location"] = ckcup.Location
}
if ckcup.Tags != nil {
objectMap["tags"] = ckcup.Tags
}
if ckcup.Identity != nil {
objectMap["identity"] = ckcup.Identity
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct.
func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties
err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties)
if err != nil {
return err
}
ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ckcup.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ckcup.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ckcup.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
ckcup.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
ckcup.Tags = tags
}
case "identity":
if v != nil {
var identity ManagedServiceIdentity
err = json.Unmarshal(*v, &identity)
if err != nil {
return err
}
ckcup.Identity = &identity
}
}
}
return nil
}
// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra
// keyspace.
type CassandraKeyspaceCreateUpdateProperties struct {
// Resource - The standard JSON format of a Cassandra keyspace
Resource *CassandraKeyspaceResource `json:"resource,omitempty"`
// Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
Options *CreateUpdateOptions `json:"options,omitempty"`
}
// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace
type CassandraKeyspaceGetProperties struct {
Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"`
Options *CassandraKeyspaceGetPropertiesOptions `json:"options,omitempty"`
}
// CassandraKeyspaceGetPropertiesOptions ...
type CassandraKeyspaceGetPropertiesOptions struct {
// Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details.
Throughput *int32 `json:"throughput,omitempty"`
// AutoscaleSettings - Specifies the Autoscale settings.
AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"`
}
// CassandraKeyspaceGetPropertiesResource ...
type CassandraKeyspaceGetPropertiesResource struct {
// ID - Name of the Cosmos DB Cassandra keyspace
ID *string `json:"id,omitempty"`
// Rid - READ-ONLY; A system generated property. A unique identifier.
Rid *string `json:"_rid,omitempty"`
// Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource.
Ts interface{} `json:"_ts,omitempty"`
// Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control.
Etag *string `json:"_etag,omitempty"`
}
// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource.
func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ckgp.ID != nil {
objectMap["id"] = ckgp.ID
}
return json.Marshal(objectMap)
}
// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace.
type CassandraKeyspaceGetResults struct {
autorest.Response `json:"-"`
// CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace
*CassandraKeyspaceGetProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The unique resource identifier of the ARM resource.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the ARM resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of Azure resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource group to which the resource belongs.
Location *string `json:"location,omitempty"`
Tags map[string]*string `json:"tags"`
Identity *ManagedServiceIdentity `json:"identity,omitempty"`
}
// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults.
func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ckgr.CassandraKeyspaceGetProperties != nil {
objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties
}
if ckgr.Location != nil {
objectMap["location"] = ckgr.Location
}
if ckgr.Tags != nil {
objectMap["tags"] = ckgr.Tags
}
if ckgr.Identity != nil {
objectMap["identity"] = ckgr.Identity
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct.
func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties
err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties)
if err != nil {
return err
}
ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ckgr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ckgr.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ckgr.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
ckgr.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
ckgr.Tags = tags
}
case "identity":
if v != nil {
var identity ManagedServiceIdentity
err = json.Unmarshal(*v, &identity)
if err != nil {
return err
}
ckgr.Identity = &identity
}
}
}
return nil
}
// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their
// properties.
type CassandraKeyspaceListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; List of Cassandra keyspaces and their properties.
Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"`
}
// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object
type CassandraKeyspaceResource struct {
// ID - Name of the Cosmos DB Cassandra keyspace
ID *string `json:"id,omitempty"`
}
// CassandraPartitionKey cosmos DB Cassandra table partition key
type CassandraPartitionKey struct {
// Name - Name of the Cosmos DB Cassandra table partition key
Name *string `json:"name,omitempty"`
}
// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the
// results of a long-running operation.
type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) Result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent {
ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request")
}
}
return
}
// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the
// results of a long-running operation.
type CassandraResourcesCreateUpdateCassandraTableFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *CassandraResourcesCreateUpdateCassandraTableFuture) Result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent {
ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request")
}
}
return
}
// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results
// of a long-running operation.
type CassandraResourcesDeleteCassandraKeyspaceFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) Result(client CassandraResourcesClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture")
return
}
ar.Response = future.Response()
return
}
// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of
// a long-running operation.
type CassandraResourcesDeleteCassandraTableFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *CassandraResourcesDeleteCassandraTableFuture) Result(client CassandraResourcesClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture")
return
}
ar.Response = future.Response()
return
}
// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving
// the results of a long-running operation.
type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) Result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent {
tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request")
}
}
return
}
// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the
// results of a long-running operation.
type CassandraResourcesUpdateCassandraTableThroughputFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) Result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent {
tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request")
}
}
return
}
// CassandraSchema cosmos DB Cassandra table schema
type CassandraSchema struct {
// Columns - List of Cassandra table columns.
Columns *[]Column `json:"columns,omitempty"`
// PartitionKeys - List of partition key.
PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"`
// ClusterKeys - List of cluster key.
ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"`
}
// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table.
type CassandraTableCreateUpdateParameters struct {
// CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table.
*CassandraTableCreateUpdateProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The unique resource identifier of the ARM resource.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the ARM resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of Azure resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource group to which the resource belongs.
Location *string `json:"location,omitempty"`
Tags map[string]*string `json:"tags"`
Identity *ManagedServiceIdentity `json:"identity,omitempty"`
}
// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters.
func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ctcup.CassandraTableCreateUpdateProperties != nil {
objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties
}
if ctcup.Location != nil {
objectMap["location"] = ctcup.Location
}
if ctcup.Tags != nil {
objectMap["tags"] = ctcup.Tags
}
if ctcup.Identity != nil {
objectMap["identity"] = ctcup.Identity
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct.
func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties
err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties)
if err != nil {
return err
}
ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ctcup.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ctcup.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ctcup.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
ctcup.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
ctcup.Tags = tags
}
case "identity":
if v != nil {
var identity ManagedServiceIdentity
err = json.Unmarshal(*v, &identity)
if err != nil {
return err
}
ctcup.Identity = &identity
}
}
}
return nil
}
// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table.
type CassandraTableCreateUpdateProperties struct {
// Resource - The standard JSON format of a Cassandra table
Resource *CassandraTableResource `json:"resource,omitempty"`
// Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
Options *CreateUpdateOptions `json:"options,omitempty"`
}
// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table
type CassandraTableGetProperties struct {
Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"`
Options *CassandraTableGetPropertiesOptions `json:"options,omitempty"`
}
// CassandraTableGetPropertiesOptions ...
type CassandraTableGetPropertiesOptions struct {
// Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details.
Throughput *int32 `json:"throughput,omitempty"`
// AutoscaleSettings - Specifies the Autoscale settings.
AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"`
}
// CassandraTableGetPropertiesResource ...
type CassandraTableGetPropertiesResource struct {
// ID - Name of the Cosmos DB Cassandra table
ID *string `json:"id,omitempty"`
// DefaultTTL - Time to live of the Cosmos DB Cassandra table
DefaultTTL *int32 `json:"defaultTtl,omitempty"`
// Schema - Schema of the Cosmos DB Cassandra table
Schema *CassandraSchema `json:"schema,omitempty"`
// AnalyticalStorageTTL - Analytical TTL.
AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"`
// Rid - READ-ONLY; A system generated property. A unique identifier.
Rid *string `json:"_rid,omitempty"`
// Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource.
Ts interface{} `json:"_ts,omitempty"`
// Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control.
Etag *string `json:"_etag,omitempty"`
}
// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource.
func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ctgp.ID != nil {
objectMap["id"] = ctgp.ID
}
if ctgp.DefaultTTL != nil {
objectMap["defaultTtl"] = ctgp.DefaultTTL
}
if ctgp.Schema != nil {
objectMap["schema"] = ctgp.Schema
}
if ctgp.AnalyticalStorageTTL != nil {
objectMap["analyticalStorageTtl"] = ctgp.AnalyticalStorageTTL
}
return json.Marshal(objectMap)
}
// CassandraTableGetResults an Azure Cosmos DB Cassandra table.
type CassandraTableGetResults struct {
autorest.Response `json:"-"`
// CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table
*CassandraTableGetProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The unique resource identifier of the ARM resource.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the ARM resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of Azure resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource group to which the resource belongs.
Location *string `json:"location,omitempty"`
Tags map[string]*string `json:"tags"`
Identity *ManagedServiceIdentity `json:"identity,omitempty"`
}
// MarshalJSON is the custom marshaler for CassandraTableGetResults.
func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ctgr.CassandraTableGetProperties != nil {
objectMap["properties"] = ctgr.CassandraTableGetProperties
}
if ctgr.Location != nil {
objectMap["location"] = ctgr.Location
}
if ctgr.Tags != nil {
objectMap["tags"] = ctgr.Tags
}
if ctgr.Identity != nil {
objectMap["identity"] = ctgr.Identity
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct.
func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties
err = json.Unmarshal(*v, &cassandraTableGetProperties)
if err != nil {
return err
}
ctgr.CassandraTableGetProperties = &cassandraTableGetProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ctgr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ctgr.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ctgr.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
ctgr.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
ctgr.Tags = tags
}
case "identity":
if v != nil {
var identity ManagedServiceIdentity
err = json.Unmarshal(*v, &identity)
if err != nil {
return err
}
ctgr.Identity = &identity
}
}
}
return nil
}
// CassandraTableListResult the List operation response, that contains the Cassandra tables and their
// properties.
type CassandraTableListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; List of Cassandra tables and their properties.
Value *[]CassandraTableGetResults `json:"value,omitempty"`
}
// CassandraTableResource cosmos DB Cassandra table resource object
type CassandraTableResource struct {
// ID - Name of the Cosmos DB Cassandra table
ID *string `json:"id,omitempty"`
// DefaultTTL - Time to live of the Cosmos DB Cassandra table
DefaultTTL *int32 `json:"defaultTtl,omitempty"`
// Schema - Schema of the Cosmos DB Cassandra table
Schema *CassandraSchema `json:"schema,omitempty"`
// AnalyticalStorageTTL - Analytical TTL.
AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"`
}
// ClusterKey cosmos DB Cassandra table cluster key
type ClusterKey struct {
// Name - Name of the Cosmos DB Cassandra table cluster key
Name *string `json:"name,omitempty"`
// OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc"
OrderBy *string `json:"orderBy,omitempty"`
}
// Column cosmos DB Cassandra table column
type Column struct {
// Name - Name of the Cosmos DB Cassandra table column
Name *string `json:"name,omitempty"`
// Type - Type of the Cosmos DB Cassandra table column
Type *string `json:"type,omitempty"`
}
// CompositePath ...
type CompositePath struct {
// Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)
Path *string `json:"path,omitempty"`
// Order - Sort order for composite paths. Possible values include: 'Ascending', 'Descending'