/
namespaces_topics_subscription_types_gen.go
1885 lines (1561 loc) · 69.4 KB
/
namespaces_topics_subscription_types_gen.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
// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package v1api20211101
import (
"fmt"
v20211101s "github.com/Azure/azure-service-operator/v2/api/servicebus/v1api20211101/storage"
"github.com/Azure/azure-service-operator/v2/internal/reflecthelpers"
"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/conversion"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Generator information:
// - Generated from: /servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/subscriptions.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}
type NamespacesTopicsSubscription struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec Namespaces_Topics_Subscription_Spec `json:"spec,omitempty"`
Status Namespaces_Topics_Subscription_STATUS `json:"status,omitempty"`
}
var _ conditions.Conditioner = &NamespacesTopicsSubscription{}
// GetConditions returns the conditions of the resource
func (subscription *NamespacesTopicsSubscription) GetConditions() conditions.Conditions {
return subscription.Status.Conditions
}
// SetConditions sets the conditions on the resource status
func (subscription *NamespacesTopicsSubscription) SetConditions(conditions conditions.Conditions) {
subscription.Status.Conditions = conditions
}
var _ conversion.Convertible = &NamespacesTopicsSubscription{}
// ConvertFrom populates our NamespacesTopicsSubscription from the provided hub NamespacesTopicsSubscription
func (subscription *NamespacesTopicsSubscription) ConvertFrom(hub conversion.Hub) error {
source, ok := hub.(*v20211101s.NamespacesTopicsSubscription)
if !ok {
return fmt.Errorf("expected servicebus/v1api20211101/storage/NamespacesTopicsSubscription but received %T instead", hub)
}
return subscription.AssignProperties_From_NamespacesTopicsSubscription(source)
}
// ConvertTo populates the provided hub NamespacesTopicsSubscription from our NamespacesTopicsSubscription
func (subscription *NamespacesTopicsSubscription) ConvertTo(hub conversion.Hub) error {
destination, ok := hub.(*v20211101s.NamespacesTopicsSubscription)
if !ok {
return fmt.Errorf("expected servicebus/v1api20211101/storage/NamespacesTopicsSubscription but received %T instead", hub)
}
return subscription.AssignProperties_To_NamespacesTopicsSubscription(destination)
}
// +kubebuilder:webhook:path=/mutate-servicebus-azure-com-v1api20211101-namespacestopicssubscription,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=servicebus.azure.com,resources=namespacestopicssubscriptions,verbs=create;update,versions=v1api20211101,name=default.v1api20211101.namespacestopicssubscriptions.servicebus.azure.com,admissionReviewVersions=v1
var _ admission.Defaulter = &NamespacesTopicsSubscription{}
// Default applies defaults to the NamespacesTopicsSubscription resource
func (subscription *NamespacesTopicsSubscription) Default() {
subscription.defaultImpl()
var temp any = subscription
if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {
runtimeDefaulter.CustomDefault()
}
}
// defaultAzureName defaults the Azure name of the resource to the Kubernetes name
func (subscription *NamespacesTopicsSubscription) defaultAzureName() {
if subscription.Spec.AzureName == "" {
subscription.Spec.AzureName = subscription.Name
}
}
// defaultImpl applies the code generated defaults to the NamespacesTopicsSubscription resource
func (subscription *NamespacesTopicsSubscription) defaultImpl() { subscription.defaultAzureName() }
var _ genruntime.ImportableResource = &NamespacesTopicsSubscription{}
// InitializeSpec initializes the spec for this resource from the given status
func (subscription *NamespacesTopicsSubscription) InitializeSpec(status genruntime.ConvertibleStatus) error {
if s, ok := status.(*Namespaces_Topics_Subscription_STATUS); ok {
return subscription.Spec.Initialize_From_Namespaces_Topics_Subscription_STATUS(s)
}
return fmt.Errorf("expected Status of type Namespaces_Topics_Subscription_STATUS but received %T instead", status)
}
var _ genruntime.KubernetesResource = &NamespacesTopicsSubscription{}
// AzureName returns the Azure name of the resource
func (subscription *NamespacesTopicsSubscription) AzureName() string {
return subscription.Spec.AzureName
}
// GetAPIVersion returns the ARM API version of the resource. This is always "2021-11-01"
func (subscription NamespacesTopicsSubscription) GetAPIVersion() string {
return string(APIVersion_Value)
}
// GetResourceScope returns the scope of the resource
func (subscription *NamespacesTopicsSubscription) GetResourceScope() genruntime.ResourceScope {
return genruntime.ResourceScopeResourceGroup
}
// GetSpec returns the specification of this resource
func (subscription *NamespacesTopicsSubscription) GetSpec() genruntime.ConvertibleSpec {
return &subscription.Spec
}
// GetStatus returns the status of this resource
func (subscription *NamespacesTopicsSubscription) GetStatus() genruntime.ConvertibleStatus {
return &subscription.Status
}
// GetSupportedOperations returns the operations supported by the resource
func (subscription *NamespacesTopicsSubscription) GetSupportedOperations() []genruntime.ResourceOperation {
return []genruntime.ResourceOperation{
genruntime.ResourceOperationDelete,
genruntime.ResourceOperationGet,
genruntime.ResourceOperationPut,
}
}
// GetType returns the ARM Type of the resource. This is always "Microsoft.ServiceBus/namespaces/topics/subscriptions"
func (subscription *NamespacesTopicsSubscription) GetType() string {
return "Microsoft.ServiceBus/namespaces/topics/subscriptions"
}
// NewEmptyStatus returns a new empty (blank) status
func (subscription *NamespacesTopicsSubscription) NewEmptyStatus() genruntime.ConvertibleStatus {
return &Namespaces_Topics_Subscription_STATUS{}
}
// Owner returns the ResourceReference of the owner
func (subscription *NamespacesTopicsSubscription) Owner() *genruntime.ResourceReference {
group, kind := genruntime.LookupOwnerGroupKind(subscription.Spec)
return subscription.Spec.Owner.AsResourceReference(group, kind)
}
// SetStatus sets the status of this resource
func (subscription *NamespacesTopicsSubscription) SetStatus(status genruntime.ConvertibleStatus) error {
// If we have exactly the right type of status, assign it
if st, ok := status.(*Namespaces_Topics_Subscription_STATUS); ok {
subscription.Status = *st
return nil
}
// Convert status to required version
var st Namespaces_Topics_Subscription_STATUS
err := status.ConvertStatusTo(&st)
if err != nil {
return errors.Wrap(err, "failed to convert status")
}
subscription.Status = st
return nil
}
// +kubebuilder:webhook:path=/validate-servicebus-azure-com-v1api20211101-namespacestopicssubscription,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=servicebus.azure.com,resources=namespacestopicssubscriptions,verbs=create;update,versions=v1api20211101,name=validate.v1api20211101.namespacestopicssubscriptions.servicebus.azure.com,admissionReviewVersions=v1
var _ admission.Validator = &NamespacesTopicsSubscription{}
// ValidateCreate validates the creation of the resource
func (subscription *NamespacesTopicsSubscription) ValidateCreate() (admission.Warnings, error) {
validations := subscription.createValidations()
var temp any = subscription
if runtimeValidator, ok := temp.(genruntime.Validator); ok {
validations = append(validations, runtimeValidator.CreateValidations()...)
}
return genruntime.ValidateCreate(validations)
}
// ValidateDelete validates the deletion of the resource
func (subscription *NamespacesTopicsSubscription) ValidateDelete() (admission.Warnings, error) {
validations := subscription.deleteValidations()
var temp any = subscription
if runtimeValidator, ok := temp.(genruntime.Validator); ok {
validations = append(validations, runtimeValidator.DeleteValidations()...)
}
return genruntime.ValidateDelete(validations)
}
// ValidateUpdate validates an update of the resource
func (subscription *NamespacesTopicsSubscription) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
validations := subscription.updateValidations()
var temp any = subscription
if runtimeValidator, ok := temp.(genruntime.Validator); ok {
validations = append(validations, runtimeValidator.UpdateValidations()...)
}
return genruntime.ValidateUpdate(old, validations)
}
// createValidations validates the creation of the resource
func (subscription *NamespacesTopicsSubscription) createValidations() []func() (admission.Warnings, error) {
return []func() (admission.Warnings, error){subscription.validateResourceReferences, subscription.validateOwnerReference}
}
// deleteValidations validates the deletion of the resource
func (subscription *NamespacesTopicsSubscription) deleteValidations() []func() (admission.Warnings, error) {
return nil
}
// updateValidations validates the update of the resource
func (subscription *NamespacesTopicsSubscription) updateValidations() []func(old runtime.Object) (admission.Warnings, error) {
return []func(old runtime.Object) (admission.Warnings, error){
func(old runtime.Object) (admission.Warnings, error) {
return subscription.validateResourceReferences()
},
subscription.validateWriteOnceProperties,
func(old runtime.Object) (admission.Warnings, error) {
return subscription.validateOwnerReference()
},
}
}
// validateOwnerReference validates the owner field
func (subscription *NamespacesTopicsSubscription) validateOwnerReference() (admission.Warnings, error) {
return genruntime.ValidateOwner(subscription)
}
// validateResourceReferences validates all resource references
func (subscription *NamespacesTopicsSubscription) validateResourceReferences() (admission.Warnings, error) {
refs, err := reflecthelpers.FindResourceReferences(&subscription.Spec)
if err != nil {
return nil, err
}
return genruntime.ValidateResourceReferences(refs)
}
// validateWriteOnceProperties validates all WriteOnce properties
func (subscription *NamespacesTopicsSubscription) validateWriteOnceProperties(old runtime.Object) (admission.Warnings, error) {
oldObj, ok := old.(*NamespacesTopicsSubscription)
if !ok {
return nil, nil
}
return genruntime.ValidateWriteOnceProperties(oldObj, subscription)
}
// AssignProperties_From_NamespacesTopicsSubscription populates our NamespacesTopicsSubscription from the provided source NamespacesTopicsSubscription
func (subscription *NamespacesTopicsSubscription) AssignProperties_From_NamespacesTopicsSubscription(source *v20211101s.NamespacesTopicsSubscription) error {
// ObjectMeta
subscription.ObjectMeta = *source.ObjectMeta.DeepCopy()
// Spec
var spec Namespaces_Topics_Subscription_Spec
err := spec.AssignProperties_From_Namespaces_Topics_Subscription_Spec(&source.Spec)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_Namespaces_Topics_Subscription_Spec() to populate field Spec")
}
subscription.Spec = spec
// Status
var status Namespaces_Topics_Subscription_STATUS
err = status.AssignProperties_From_Namespaces_Topics_Subscription_STATUS(&source.Status)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_Namespaces_Topics_Subscription_STATUS() to populate field Status")
}
subscription.Status = status
// No error
return nil
}
// AssignProperties_To_NamespacesTopicsSubscription populates the provided destination NamespacesTopicsSubscription from our NamespacesTopicsSubscription
func (subscription *NamespacesTopicsSubscription) AssignProperties_To_NamespacesTopicsSubscription(destination *v20211101s.NamespacesTopicsSubscription) error {
// ObjectMeta
destination.ObjectMeta = *subscription.ObjectMeta.DeepCopy()
// Spec
var spec v20211101s.Namespaces_Topics_Subscription_Spec
err := subscription.Spec.AssignProperties_To_Namespaces_Topics_Subscription_Spec(&spec)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_Namespaces_Topics_Subscription_Spec() to populate field Spec")
}
destination.Spec = spec
// Status
var status v20211101s.Namespaces_Topics_Subscription_STATUS
err = subscription.Status.AssignProperties_To_Namespaces_Topics_Subscription_STATUS(&status)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_Namespaces_Topics_Subscription_STATUS() to populate field Status")
}
destination.Status = status
// No error
return nil
}
// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (subscription *NamespacesTopicsSubscription) OriginalGVK() *schema.GroupVersionKind {
return &schema.GroupVersionKind{
Group: GroupVersion.Group,
Version: subscription.Spec.OriginalVersion(),
Kind: "NamespacesTopicsSubscription",
}
}
// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /servicebus/resource-manager/Microsoft.ServiceBus/stable/2021-11-01/subscriptions.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}
type NamespacesTopicsSubscriptionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NamespacesTopicsSubscription `json:"items"`
}
type Namespaces_Topics_Subscription_Spec struct {
// AutoDeleteOnIdle: ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration
// is 5 minutes.
AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"`
// +kubebuilder:validation:MaxLength=50
// +kubebuilder:validation:MinLength=1
// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
// doesn't have to be.
AzureName string `json:"azureName,omitempty"`
// ClientAffineProperties: Properties specific to client affine subscriptions.
ClientAffineProperties *SBClientAffineProperties `json:"clientAffineProperties,omitempty"`
// DeadLetteringOnFilterEvaluationExceptions: Value that indicates whether a subscription has dead letter support on filter
// evaluation exceptions.
DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"`
// DeadLetteringOnMessageExpiration: Value that indicates whether a subscription has dead letter support when a message
// expires.
DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"`
// DefaultMessageTimeToLive: ISO 8061 Default message timespan to live value. This is the duration after which the message
// expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not
// set on a message itself.
DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"`
// DuplicateDetectionHistoryTimeWindow: ISO 8601 timeSpan structure that defines the duration of the duplicate detection
// history. The default value is 10 minutes.
DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"`
// EnableBatchedOperations: Value that indicates whether server-side batched operations are enabled.
EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"`
// ForwardDeadLetteredMessagesTo: Queue/Topic name to forward the Dead Letter message
ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"`
// ForwardTo: Queue/Topic name to forward the messages
ForwardTo *string `json:"forwardTo,omitempty"`
// IsClientAffine: Value that indicates whether the subscription has an affinity to the client id.
IsClientAffine *bool `json:"isClientAffine,omitempty"`
// LockDuration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute.
LockDuration *string `json:"lockDuration,omitempty"`
// MaxDeliveryCount: Number of maximum deliveries.
MaxDeliveryCount *int `json:"maxDeliveryCount,omitempty"`
// +kubebuilder:validation:Required
// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
// reference to a servicebus.azure.com/NamespacesTopic resource
Owner *genruntime.KnownResourceReference `group:"servicebus.azure.com" json:"owner,omitempty" kind:"NamespacesTopic"`
// RequiresSession: Value indicating if a subscription supports the concept of sessions.
RequiresSession *bool `json:"requiresSession,omitempty"`
}
var _ genruntime.ARMTransformer = &Namespaces_Topics_Subscription_Spec{}
// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (subscription *Namespaces_Topics_Subscription_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
if subscription == nil {
return nil, nil
}
result := &Namespaces_Topics_Subscription_Spec_ARM{}
// Set property "Name":
result.Name = resolved.Name
// Set property "Properties":
if subscription.AutoDeleteOnIdle != nil ||
subscription.ClientAffineProperties != nil ||
subscription.DeadLetteringOnFilterEvaluationExceptions != nil ||
subscription.DeadLetteringOnMessageExpiration != nil ||
subscription.DefaultMessageTimeToLive != nil ||
subscription.DuplicateDetectionHistoryTimeWindow != nil ||
subscription.EnableBatchedOperations != nil ||
subscription.ForwardDeadLetteredMessagesTo != nil ||
subscription.ForwardTo != nil ||
subscription.IsClientAffine != nil ||
subscription.LockDuration != nil ||
subscription.MaxDeliveryCount != nil ||
subscription.RequiresSession != nil {
result.Properties = &SBSubscriptionProperties_ARM{}
}
if subscription.AutoDeleteOnIdle != nil {
autoDeleteOnIdle := *subscription.AutoDeleteOnIdle
result.Properties.AutoDeleteOnIdle = &autoDeleteOnIdle
}
if subscription.ClientAffineProperties != nil {
clientAffineProperties_ARM, err := (*subscription.ClientAffineProperties).ConvertToARM(resolved)
if err != nil {
return nil, err
}
clientAffineProperties := *clientAffineProperties_ARM.(*SBClientAffineProperties_ARM)
result.Properties.ClientAffineProperties = &clientAffineProperties
}
if subscription.DeadLetteringOnFilterEvaluationExceptions != nil {
deadLetteringOnFilterEvaluationExceptions := *subscription.DeadLetteringOnFilterEvaluationExceptions
result.Properties.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationExceptions
}
if subscription.DeadLetteringOnMessageExpiration != nil {
deadLetteringOnMessageExpiration := *subscription.DeadLetteringOnMessageExpiration
result.Properties.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
}
if subscription.DefaultMessageTimeToLive != nil {
defaultMessageTimeToLive := *subscription.DefaultMessageTimeToLive
result.Properties.DefaultMessageTimeToLive = &defaultMessageTimeToLive
}
if subscription.DuplicateDetectionHistoryTimeWindow != nil {
duplicateDetectionHistoryTimeWindow := *subscription.DuplicateDetectionHistoryTimeWindow
result.Properties.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow
}
if subscription.EnableBatchedOperations != nil {
enableBatchedOperations := *subscription.EnableBatchedOperations
result.Properties.EnableBatchedOperations = &enableBatchedOperations
}
if subscription.ForwardDeadLetteredMessagesTo != nil {
forwardDeadLetteredMessagesTo := *subscription.ForwardDeadLetteredMessagesTo
result.Properties.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo
}
if subscription.ForwardTo != nil {
forwardTo := *subscription.ForwardTo
result.Properties.ForwardTo = &forwardTo
}
if subscription.IsClientAffine != nil {
isClientAffine := *subscription.IsClientAffine
result.Properties.IsClientAffine = &isClientAffine
}
if subscription.LockDuration != nil {
lockDuration := *subscription.LockDuration
result.Properties.LockDuration = &lockDuration
}
if subscription.MaxDeliveryCount != nil {
maxDeliveryCount := *subscription.MaxDeliveryCount
result.Properties.MaxDeliveryCount = &maxDeliveryCount
}
if subscription.RequiresSession != nil {
requiresSession := *subscription.RequiresSession
result.Properties.RequiresSession = &requiresSession
}
return result, nil
}
// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (subscription *Namespaces_Topics_Subscription_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {
return &Namespaces_Topics_Subscription_Spec_ARM{}
}
// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (subscription *Namespaces_Topics_Subscription_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
typedInput, ok := armInput.(Namespaces_Topics_Subscription_Spec_ARM)
if !ok {
return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Namespaces_Topics_Subscription_Spec_ARM, got %T", armInput)
}
// Set property "AutoDeleteOnIdle":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.AutoDeleteOnIdle != nil {
autoDeleteOnIdle := *typedInput.Properties.AutoDeleteOnIdle
subscription.AutoDeleteOnIdle = &autoDeleteOnIdle
}
}
// Set property "AzureName":
subscription.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name))
// Set property "ClientAffineProperties":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.ClientAffineProperties != nil {
var clientAffineProperties1 SBClientAffineProperties
err := clientAffineProperties1.PopulateFromARM(owner, *typedInput.Properties.ClientAffineProperties)
if err != nil {
return err
}
clientAffineProperties := clientAffineProperties1
subscription.ClientAffineProperties = &clientAffineProperties
}
}
// Set property "DeadLetteringOnFilterEvaluationExceptions":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.DeadLetteringOnFilterEvaluationExceptions != nil {
deadLetteringOnFilterEvaluationExceptions := *typedInput.Properties.DeadLetteringOnFilterEvaluationExceptions
subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationExceptions
}
}
// Set property "DeadLetteringOnMessageExpiration":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.DeadLetteringOnMessageExpiration != nil {
deadLetteringOnMessageExpiration := *typedInput.Properties.DeadLetteringOnMessageExpiration
subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
}
}
// Set property "DefaultMessageTimeToLive":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.DefaultMessageTimeToLive != nil {
defaultMessageTimeToLive := *typedInput.Properties.DefaultMessageTimeToLive
subscription.DefaultMessageTimeToLive = &defaultMessageTimeToLive
}
}
// Set property "DuplicateDetectionHistoryTimeWindow":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.DuplicateDetectionHistoryTimeWindow != nil {
duplicateDetectionHistoryTimeWindow := *typedInput.Properties.DuplicateDetectionHistoryTimeWindow
subscription.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow
}
}
// Set property "EnableBatchedOperations":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.EnableBatchedOperations != nil {
enableBatchedOperations := *typedInput.Properties.EnableBatchedOperations
subscription.EnableBatchedOperations = &enableBatchedOperations
}
}
// Set property "ForwardDeadLetteredMessagesTo":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.ForwardDeadLetteredMessagesTo != nil {
forwardDeadLetteredMessagesTo := *typedInput.Properties.ForwardDeadLetteredMessagesTo
subscription.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo
}
}
// Set property "ForwardTo":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.ForwardTo != nil {
forwardTo := *typedInput.Properties.ForwardTo
subscription.ForwardTo = &forwardTo
}
}
// Set property "IsClientAffine":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.IsClientAffine != nil {
isClientAffine := *typedInput.Properties.IsClientAffine
subscription.IsClientAffine = &isClientAffine
}
}
// Set property "LockDuration":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.LockDuration != nil {
lockDuration := *typedInput.Properties.LockDuration
subscription.LockDuration = &lockDuration
}
}
// Set property "MaxDeliveryCount":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.MaxDeliveryCount != nil {
maxDeliveryCount := *typedInput.Properties.MaxDeliveryCount
subscription.MaxDeliveryCount = &maxDeliveryCount
}
}
// Set property "Owner":
subscription.Owner = &genruntime.KnownResourceReference{
Name: owner.Name,
ARMID: owner.ARMID,
}
// Set property "RequiresSession":
// copying flattened property:
if typedInput.Properties != nil {
if typedInput.Properties.RequiresSession != nil {
requiresSession := *typedInput.Properties.RequiresSession
subscription.RequiresSession = &requiresSession
}
}
// No error
return nil
}
var _ genruntime.ConvertibleSpec = &Namespaces_Topics_Subscription_Spec{}
// ConvertSpecFrom populates our Namespaces_Topics_Subscription_Spec from the provided source
func (subscription *Namespaces_Topics_Subscription_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
src, ok := source.(*v20211101s.Namespaces_Topics_Subscription_Spec)
if ok {
// Populate our instance from source
return subscription.AssignProperties_From_Namespaces_Topics_Subscription_Spec(src)
}
// Convert to an intermediate form
src = &v20211101s.Namespaces_Topics_Subscription_Spec{}
err := src.ConvertSpecFrom(source)
if err != nil {
return errors.Wrap(err, "initial step of conversion in ConvertSpecFrom()")
}
// Update our instance from src
err = subscription.AssignProperties_From_Namespaces_Topics_Subscription_Spec(src)
if err != nil {
return errors.Wrap(err, "final step of conversion in ConvertSpecFrom()")
}
return nil
}
// ConvertSpecTo populates the provided destination from our Namespaces_Topics_Subscription_Spec
func (subscription *Namespaces_Topics_Subscription_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
dst, ok := destination.(*v20211101s.Namespaces_Topics_Subscription_Spec)
if ok {
// Populate destination from our instance
return subscription.AssignProperties_To_Namespaces_Topics_Subscription_Spec(dst)
}
// Convert to an intermediate form
dst = &v20211101s.Namespaces_Topics_Subscription_Spec{}
err := subscription.AssignProperties_To_Namespaces_Topics_Subscription_Spec(dst)
if err != nil {
return errors.Wrap(err, "initial step of conversion in ConvertSpecTo()")
}
// Update dst from our instance
err = dst.ConvertSpecTo(destination)
if err != nil {
return errors.Wrap(err, "final step of conversion in ConvertSpecTo()")
}
return nil
}
// AssignProperties_From_Namespaces_Topics_Subscription_Spec populates our Namespaces_Topics_Subscription_Spec from the provided source Namespaces_Topics_Subscription_Spec
func (subscription *Namespaces_Topics_Subscription_Spec) AssignProperties_From_Namespaces_Topics_Subscription_Spec(source *v20211101s.Namespaces_Topics_Subscription_Spec) error {
// AutoDeleteOnIdle
subscription.AutoDeleteOnIdle = genruntime.ClonePointerToString(source.AutoDeleteOnIdle)
// AzureName
subscription.AzureName = source.AzureName
// ClientAffineProperties
if source.ClientAffineProperties != nil {
var clientAffineProperty SBClientAffineProperties
err := clientAffineProperty.AssignProperties_From_SBClientAffineProperties(source.ClientAffineProperties)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SBClientAffineProperties() to populate field ClientAffineProperties")
}
subscription.ClientAffineProperties = &clientAffineProperty
} else {
subscription.ClientAffineProperties = nil
}
// DeadLetteringOnFilterEvaluationExceptions
if source.DeadLetteringOnFilterEvaluationExceptions != nil {
deadLetteringOnFilterEvaluationException := *source.DeadLetteringOnFilterEvaluationExceptions
subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
} else {
subscription.DeadLetteringOnFilterEvaluationExceptions = nil
}
// DeadLetteringOnMessageExpiration
if source.DeadLetteringOnMessageExpiration != nil {
deadLetteringOnMessageExpiration := *source.DeadLetteringOnMessageExpiration
subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
} else {
subscription.DeadLetteringOnMessageExpiration = nil
}
// DefaultMessageTimeToLive
subscription.DefaultMessageTimeToLive = genruntime.ClonePointerToString(source.DefaultMessageTimeToLive)
// DuplicateDetectionHistoryTimeWindow
subscription.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(source.DuplicateDetectionHistoryTimeWindow)
// EnableBatchedOperations
if source.EnableBatchedOperations != nil {
enableBatchedOperation := *source.EnableBatchedOperations
subscription.EnableBatchedOperations = &enableBatchedOperation
} else {
subscription.EnableBatchedOperations = nil
}
// ForwardDeadLetteredMessagesTo
subscription.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(source.ForwardDeadLetteredMessagesTo)
// ForwardTo
subscription.ForwardTo = genruntime.ClonePointerToString(source.ForwardTo)
// IsClientAffine
if source.IsClientAffine != nil {
isClientAffine := *source.IsClientAffine
subscription.IsClientAffine = &isClientAffine
} else {
subscription.IsClientAffine = nil
}
// LockDuration
subscription.LockDuration = genruntime.ClonePointerToString(source.LockDuration)
// MaxDeliveryCount
subscription.MaxDeliveryCount = genruntime.ClonePointerToInt(source.MaxDeliveryCount)
// Owner
if source.Owner != nil {
owner := source.Owner.Copy()
subscription.Owner = &owner
} else {
subscription.Owner = nil
}
// RequiresSession
if source.RequiresSession != nil {
requiresSession := *source.RequiresSession
subscription.RequiresSession = &requiresSession
} else {
subscription.RequiresSession = nil
}
// No error
return nil
}
// AssignProperties_To_Namespaces_Topics_Subscription_Spec populates the provided destination Namespaces_Topics_Subscription_Spec from our Namespaces_Topics_Subscription_Spec
func (subscription *Namespaces_Topics_Subscription_Spec) AssignProperties_To_Namespaces_Topics_Subscription_Spec(destination *v20211101s.Namespaces_Topics_Subscription_Spec) error {
// Create a new property bag
propertyBag := genruntime.NewPropertyBag()
// AutoDeleteOnIdle
destination.AutoDeleteOnIdle = genruntime.ClonePointerToString(subscription.AutoDeleteOnIdle)
// AzureName
destination.AzureName = subscription.AzureName
// ClientAffineProperties
if subscription.ClientAffineProperties != nil {
var clientAffineProperty v20211101s.SBClientAffineProperties
err := subscription.ClientAffineProperties.AssignProperties_To_SBClientAffineProperties(&clientAffineProperty)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SBClientAffineProperties() to populate field ClientAffineProperties")
}
destination.ClientAffineProperties = &clientAffineProperty
} else {
destination.ClientAffineProperties = nil
}
// DeadLetteringOnFilterEvaluationExceptions
if subscription.DeadLetteringOnFilterEvaluationExceptions != nil {
deadLetteringOnFilterEvaluationException := *subscription.DeadLetteringOnFilterEvaluationExceptions
destination.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
} else {
destination.DeadLetteringOnFilterEvaluationExceptions = nil
}
// DeadLetteringOnMessageExpiration
if subscription.DeadLetteringOnMessageExpiration != nil {
deadLetteringOnMessageExpiration := *subscription.DeadLetteringOnMessageExpiration
destination.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
} else {
destination.DeadLetteringOnMessageExpiration = nil
}
// DefaultMessageTimeToLive
destination.DefaultMessageTimeToLive = genruntime.ClonePointerToString(subscription.DefaultMessageTimeToLive)
// DuplicateDetectionHistoryTimeWindow
destination.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(subscription.DuplicateDetectionHistoryTimeWindow)
// EnableBatchedOperations
if subscription.EnableBatchedOperations != nil {
enableBatchedOperation := *subscription.EnableBatchedOperations
destination.EnableBatchedOperations = &enableBatchedOperation
} else {
destination.EnableBatchedOperations = nil
}
// ForwardDeadLetteredMessagesTo
destination.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(subscription.ForwardDeadLetteredMessagesTo)
// ForwardTo
destination.ForwardTo = genruntime.ClonePointerToString(subscription.ForwardTo)
// IsClientAffine
if subscription.IsClientAffine != nil {
isClientAffine := *subscription.IsClientAffine
destination.IsClientAffine = &isClientAffine
} else {
destination.IsClientAffine = nil
}
// LockDuration
destination.LockDuration = genruntime.ClonePointerToString(subscription.LockDuration)
// MaxDeliveryCount
destination.MaxDeliveryCount = genruntime.ClonePointerToInt(subscription.MaxDeliveryCount)
// OriginalVersion
destination.OriginalVersion = subscription.OriginalVersion()
// Owner
if subscription.Owner != nil {
owner := subscription.Owner.Copy()
destination.Owner = &owner
} else {
destination.Owner = nil
}
// RequiresSession
if subscription.RequiresSession != nil {
requiresSession := *subscription.RequiresSession
destination.RequiresSession = &requiresSession
} else {
destination.RequiresSession = nil
}
// Update the property bag
if len(propertyBag) > 0 {
destination.PropertyBag = propertyBag
} else {
destination.PropertyBag = nil
}
// No error
return nil
}
// Initialize_From_Namespaces_Topics_Subscription_STATUS populates our Namespaces_Topics_Subscription_Spec from the provided source Namespaces_Topics_Subscription_STATUS
func (subscription *Namespaces_Topics_Subscription_Spec) Initialize_From_Namespaces_Topics_Subscription_STATUS(source *Namespaces_Topics_Subscription_STATUS) error {
// AutoDeleteOnIdle
subscription.AutoDeleteOnIdle = genruntime.ClonePointerToString(source.AutoDeleteOnIdle)
// ClientAffineProperties
if source.ClientAffineProperties != nil {
var clientAffineProperty SBClientAffineProperties
err := clientAffineProperty.Initialize_From_SBClientAffineProperties_STATUS(source.ClientAffineProperties)
if err != nil {
return errors.Wrap(err, "calling Initialize_From_SBClientAffineProperties_STATUS() to populate field ClientAffineProperties")
}
subscription.ClientAffineProperties = &clientAffineProperty
} else {
subscription.ClientAffineProperties = nil
}
// DeadLetteringOnFilterEvaluationExceptions
if source.DeadLetteringOnFilterEvaluationExceptions != nil {
deadLetteringOnFilterEvaluationException := *source.DeadLetteringOnFilterEvaluationExceptions
subscription.DeadLetteringOnFilterEvaluationExceptions = &deadLetteringOnFilterEvaluationException
} else {
subscription.DeadLetteringOnFilterEvaluationExceptions = nil
}
// DeadLetteringOnMessageExpiration
if source.DeadLetteringOnMessageExpiration != nil {
deadLetteringOnMessageExpiration := *source.DeadLetteringOnMessageExpiration
subscription.DeadLetteringOnMessageExpiration = &deadLetteringOnMessageExpiration
} else {
subscription.DeadLetteringOnMessageExpiration = nil
}
// DefaultMessageTimeToLive
subscription.DefaultMessageTimeToLive = genruntime.ClonePointerToString(source.DefaultMessageTimeToLive)
// DuplicateDetectionHistoryTimeWindow
subscription.DuplicateDetectionHistoryTimeWindow = genruntime.ClonePointerToString(source.DuplicateDetectionHistoryTimeWindow)
// EnableBatchedOperations
if source.EnableBatchedOperations != nil {
enableBatchedOperation := *source.EnableBatchedOperations
subscription.EnableBatchedOperations = &enableBatchedOperation
} else {
subscription.EnableBatchedOperations = nil
}
// ForwardDeadLetteredMessagesTo
subscription.ForwardDeadLetteredMessagesTo = genruntime.ClonePointerToString(source.ForwardDeadLetteredMessagesTo)
// ForwardTo
subscription.ForwardTo = genruntime.ClonePointerToString(source.ForwardTo)
// IsClientAffine
if source.IsClientAffine != nil {
isClientAffine := *source.IsClientAffine
subscription.IsClientAffine = &isClientAffine
} else {
subscription.IsClientAffine = nil
}
// LockDuration
subscription.LockDuration = genruntime.ClonePointerToString(source.LockDuration)
// MaxDeliveryCount
subscription.MaxDeliveryCount = genruntime.ClonePointerToInt(source.MaxDeliveryCount)
// RequiresSession
if source.RequiresSession != nil {
requiresSession := *source.RequiresSession
subscription.RequiresSession = &requiresSession
} else {
subscription.RequiresSession = nil
}
// No error
return nil
}
// OriginalVersion returns the original API version used to create the resource.
func (subscription *Namespaces_Topics_Subscription_Spec) OriginalVersion() string {
return GroupVersion.Version
}
// SetAzureName sets the Azure name of the resource
func (subscription *Namespaces_Topics_Subscription_Spec) SetAzureName(azureName string) {
subscription.AzureName = azureName
}
type Namespaces_Topics_Subscription_STATUS struct {
// AccessedAt: Last time there was a receive request to this subscription.
AccessedAt *string `json:"accessedAt,omitempty"`
// AutoDeleteOnIdle: ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration
// is 5 minutes.
AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"`
// ClientAffineProperties: Properties specific to client affine subscriptions.
ClientAffineProperties *SBClientAffineProperties_STATUS `json:"clientAffineProperties,omitempty"`
// Conditions: The observed state of the resource
Conditions []conditions.Condition `json:"conditions,omitempty"`
// CountDetails: Message count details
CountDetails *MessageCountDetails_STATUS `json:"countDetails,omitempty"`
// CreatedAt: Exact time the message was created.
CreatedAt *string `json:"createdAt,omitempty"`
// DeadLetteringOnFilterEvaluationExceptions: Value that indicates whether a subscription has dead letter support on filter
// evaluation exceptions.
DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"`
// DeadLetteringOnMessageExpiration: Value that indicates whether a subscription has dead letter support when a message
// expires.
DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"`
// DefaultMessageTimeToLive: ISO 8061 Default message timespan to live value. This is the duration after which the message
// expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not
// set on a message itself.
DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"`
// DuplicateDetectionHistoryTimeWindow: ISO 8601 timeSpan structure that defines the duration of the duplicate detection
// history. The default value is 10 minutes.
DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"`
// EnableBatchedOperations: Value that indicates whether server-side batched operations are enabled.
EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"`
// ForwardDeadLetteredMessagesTo: Queue/Topic name to forward the Dead Letter message
ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"`
// ForwardTo: Queue/Topic name to forward the messages
ForwardTo *string `json:"forwardTo,omitempty"`
// Id: Fully qualified resource ID for the resource. Ex -