/
models.go
3216 lines (3019 loc) · 148 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 eventgrid
// 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 (
"encoding/json"
"github.com/Azure/go-autorest/autorest/date"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/eventgrid/2018-01-01/eventgrid"
// ACSChatEventBaseProperties schema of common properties of all chat events
type ACSChatEventBaseProperties struct {
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatMemberAddedToThreadWithUserEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatMemberAddedToThreadWithUser event.
type ACSChatMemberAddedToThreadWithUserEventData struct {
// Time - The time at which the user was added to the thread
Time *date.Time `json:"time,omitempty"`
// AddedBy - The MRI of the user who added the user
AddedBy *string `json:"addedBy,omitempty"`
// MemberAdded - The details of the user who was added
MemberAdded *ACSChatThreadMemberProperties `json:"memberAdded,omitempty"`
// CreateTime - The original creation time of the thread
CreateTime *date.Time `json:"createTime,omitempty"`
// Version - The version of the thread
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatMemberRemovedFromThreadWithUserEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatMemberRemovedFromThreadWithUser event.
type ACSChatMemberRemovedFromThreadWithUserEventData struct {
// Time - The time at which the user was removed to the thread
Time *date.Time `json:"time,omitempty"`
// RemovedBy - The MRI of the user who removed the user
RemovedBy *string `json:"removedBy,omitempty"`
// MemberRemoved - The details of the user who was removed
MemberRemoved *ACSChatThreadMemberProperties `json:"memberRemoved,omitempty"`
// CreateTime - The original creation time of the thread
CreateTime *date.Time `json:"createTime,omitempty"`
// Version - The version of the thread
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatMessageDeletedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatMessageDeleted event.
type ACSChatMessageDeletedEventData struct {
// DeleteTime - The time at which the message was deleted
DeleteTime *date.Time `json:"deleteTime,omitempty"`
// MessageID - The chat message id
MessageID *string `json:"messageId,omitempty"`
// SenderID - The MRI of the sender
SenderID *string `json:"senderId,omitempty"`
// SenderDisplayName - The display name of the sender
SenderDisplayName *string `json:"senderDisplayName,omitempty"`
// ComposeTime - The original compose time of the message
ComposeTime *date.Time `json:"composeTime,omitempty"`
// Type - The type of the message
Type *string `json:"type,omitempty"`
// Version - The version of the message
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatMessageEditedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatMessageEdited event.
type ACSChatMessageEditedEventData struct {
// MessageBody - The body of the chat message
MessageBody *string `json:"messageBody,omitempty"`
// EditTime - The time at which the message was edited
EditTime *date.Time `json:"editTime,omitempty"`
// MessageID - The chat message id
MessageID *string `json:"messageId,omitempty"`
// SenderID - The MRI of the sender
SenderID *string `json:"senderId,omitempty"`
// SenderDisplayName - The display name of the sender
SenderDisplayName *string `json:"senderDisplayName,omitempty"`
// ComposeTime - The original compose time of the message
ComposeTime *date.Time `json:"composeTime,omitempty"`
// Type - The type of the message
Type *string `json:"type,omitempty"`
// Version - The version of the message
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatMessageEventBaseProperties schema of common properties of all chat message events
type ACSChatMessageEventBaseProperties struct {
// MessageID - The chat message id
MessageID *string `json:"messageId,omitempty"`
// SenderID - The MRI of the sender
SenderID *string `json:"senderId,omitempty"`
// SenderDisplayName - The display name of the sender
SenderDisplayName *string `json:"senderDisplayName,omitempty"`
// ComposeTime - The original compose time of the message
ComposeTime *date.Time `json:"composeTime,omitempty"`
// Type - The type of the message
Type *string `json:"type,omitempty"`
// Version - The version of the message
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatMessageReceivedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatMessageReceived event.
type ACSChatMessageReceivedEventData struct {
// MessageBody - The body of the chat message
MessageBody *string `json:"messageBody,omitempty"`
// MessageID - The chat message id
MessageID *string `json:"messageId,omitempty"`
// SenderID - The MRI of the sender
SenderID *string `json:"senderId,omitempty"`
// SenderDisplayName - The display name of the sender
SenderDisplayName *string `json:"senderDisplayName,omitempty"`
// ComposeTime - The original compose time of the message
ComposeTime *date.Time `json:"composeTime,omitempty"`
// Type - The type of the message
Type *string `json:"type,omitempty"`
// Version - The version of the message
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatThreadCreatedWithUserEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatThreadCreatedWithUser event.
type ACSChatThreadCreatedWithUserEventData struct {
// CreatedBy - The MRI of the creator of the thread
CreatedBy *string `json:"createdBy,omitempty"`
// Properties - The thread properties
Properties map[string]interface{} `json:"properties"`
// Members - The list of properties of users who are part of the thread
Members *[]ACSChatThreadMemberProperties `json:"members,omitempty"`
// CreateTime - The original creation time of the thread
CreateTime *date.Time `json:"createTime,omitempty"`
// Version - The version of the thread
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// MarshalJSON is the custom marshaler for ACSChatThreadCreatedWithUserEventData.
func (actcwued ACSChatThreadCreatedWithUserEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if actcwued.CreatedBy != nil {
objectMap["createdBy"] = actcwued.CreatedBy
}
if actcwued.Properties != nil {
objectMap["properties"] = actcwued.Properties
}
if actcwued.Members != nil {
objectMap["members"] = actcwued.Members
}
if actcwued.CreateTime != nil {
objectMap["createTime"] = actcwued.CreateTime
}
if actcwued.Version != nil {
objectMap["version"] = actcwued.Version
}
if actcwued.RecipientID != nil {
objectMap["recipientId"] = actcwued.RecipientID
}
if actcwued.TransactionID != nil {
objectMap["transactionId"] = actcwued.TransactionID
}
if actcwued.ThreadID != nil {
objectMap["threadId"] = actcwued.ThreadID
}
return json.Marshal(objectMap)
}
// ACSChatThreadEventBaseProperties schema of common properties of all chat thread events
type ACSChatThreadEventBaseProperties struct {
// CreateTime - The original creation time of the thread
CreateTime *date.Time `json:"createTime,omitempty"`
// Version - The version of the thread
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// ACSChatThreadMemberProperties schema of the chat thread member
type ACSChatThreadMemberProperties struct {
// DisplayName - The name of the user
DisplayName *string `json:"displayName,omitempty"`
// MemberID - The MRI of the user
MemberID *string `json:"memberId,omitempty"`
}
// ACSChatThreadPropertiesUpdatedPerUserEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser event.
type ACSChatThreadPropertiesUpdatedPerUserEventData struct {
// EditedBy - The MRI of the user who updated the thread properties
EditedBy *string `json:"editedBy,omitempty"`
// EditTime - The time at which the properties of the thread were updated
EditTime *date.Time `json:"editTime,omitempty"`
// Properties - The updated thread properties
Properties map[string]interface{} `json:"properties"`
// CreateTime - The original creation time of the thread
CreateTime *date.Time `json:"createTime,omitempty"`
// Version - The version of the thread
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// MarshalJSON is the custom marshaler for ACSChatThreadPropertiesUpdatedPerUserEventData.
func (actpupued ACSChatThreadPropertiesUpdatedPerUserEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if actpupued.EditedBy != nil {
objectMap["editedBy"] = actpupued.EditedBy
}
if actpupued.EditTime != nil {
objectMap["editTime"] = actpupued.EditTime
}
if actpupued.Properties != nil {
objectMap["properties"] = actpupued.Properties
}
if actpupued.CreateTime != nil {
objectMap["createTime"] = actpupued.CreateTime
}
if actpupued.Version != nil {
objectMap["version"] = actpupued.Version
}
if actpupued.RecipientID != nil {
objectMap["recipientId"] = actpupued.RecipientID
}
if actpupued.TransactionID != nil {
objectMap["transactionId"] = actpupued.TransactionID
}
if actpupued.ThreadID != nil {
objectMap["threadId"] = actpupued.ThreadID
}
return json.Marshal(objectMap)
}
// ACSChatThreadWithUserDeletedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.ChatThreadWithUserDeleted event.
type ACSChatThreadWithUserDeletedEventData struct {
// DeletedBy - The MRI of the user who deleted the thread
DeletedBy *string `json:"deletedBy,omitempty"`
// DeleteTime - The deletion time of the thread
DeleteTime *date.Time `json:"deleteTime,omitempty"`
// CreateTime - The original creation time of the thread
CreateTime *date.Time `json:"createTime,omitempty"`
// Version - The version of the thread
Version *int64 `json:"version,omitempty"`
// RecipientID - The MRI of the target user
RecipientID *string `json:"recipientId,omitempty"`
// TransactionID - The transaction id will be used as co-relation vector
TransactionID *string `json:"transactionId,omitempty"`
// ThreadID - The chat thread id
ThreadID *string `json:"threadId,omitempty"`
}
// AcsSmsDeliveryAttemptProperties schema for details of a delivery attempt
type AcsSmsDeliveryAttemptProperties struct {
// Timestamp - TimeStamp when delivery was attempted
Timestamp *date.Time `json:"timestamp,omitempty"`
// SegmentsSucceeded - Number of segments that were successfully delivered
SegmentsSucceeded *int32 `json:"segmentsSucceeded,omitempty"`
// SegmentsFailed - Number of segments whose delivery failed
SegmentsFailed *int32 `json:"segmentsFailed,omitempty"`
}
// AcsSmsDeliveryReportReceivedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.SMSDeliveryReportReceived event.
type AcsSmsDeliveryReportReceivedEventData struct {
// DeliveryStatus - Status of Delivery
DeliveryStatus *string `json:"deliveryStatus,omitempty"`
// DeliveryStatusDetails - Details about Delivery Status
DeliveryStatusDetails *string `json:"deliveryStatusDetails,omitempty"`
// DeliveryAttempts - List of details of delivery attempts made
DeliveryAttempts *[]AcsSmsDeliveryAttemptProperties `json:"deliveryAttempts,omitempty"`
// ReceivedTimestamp - The time at which the SMS delivery report was received
ReceivedTimestamp *date.Time `json:"receivedTimestamp,omitempty"`
// MessageID - The identity of the SMS message
MessageID *string `json:"messageId,omitempty"`
// From - The identity of SMS message sender
From *string `json:"from,omitempty"`
// To - The identity of SMS message receiver
To *string `json:"to,omitempty"`
}
// AcsSmsEventBaseProperties schema of common properties of all SMS events
type AcsSmsEventBaseProperties struct {
// MessageID - The identity of the SMS message
MessageID *string `json:"messageId,omitempty"`
// From - The identity of SMS message sender
From *string `json:"from,omitempty"`
// To - The identity of SMS message receiver
To *string `json:"to,omitempty"`
}
// AcsSmsReceivedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.Communication.SMSReceived event.
type AcsSmsReceivedEventData struct {
// Message - The SMS content
Message *string `json:"message,omitempty"`
// ReceivedTimestamp - The time at which the SMS was received
ReceivedTimestamp *date.Time `json:"receivedTimestamp,omitempty"`
// MessageID - The identity of the SMS message
MessageID *string `json:"messageId,omitempty"`
// From - The identity of SMS message sender
From *string `json:"from,omitempty"`
// To - The identity of SMS message receiver
To *string `json:"to,omitempty"`
}
// AppConfigurationKeyValueDeletedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.AppConfiguration.KeyValueDeleted event.
type AppConfigurationKeyValueDeletedEventData struct {
// Key - The key used to identify the key-value that was deleted.
Key *string `json:"key,omitempty"`
// Label - The label, if any, used to identify the key-value that was deleted.
Label *string `json:"label,omitempty"`
// Etag - The etag representing the key-value that was deleted.
Etag *string `json:"etag,omitempty"`
}
// AppConfigurationKeyValueModifiedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.AppConfiguration.KeyValueModified event.
type AppConfigurationKeyValueModifiedEventData struct {
// Key - The key used to identify the key-value that was modified.
Key *string `json:"key,omitempty"`
// Label - The label, if any, used to identify the key-value that was modified.
Label *string `json:"label,omitempty"`
// Etag - The etag representing the new state of the key-value.
Etag *string `json:"etag,omitempty"`
}
// AppEventTypeDetail detail of action on the app.
type AppEventTypeDetail struct {
// Action - Type of action of the operation. Possible values include: 'Restarted', 'Stopped', 'ChangedAppSettings', 'Started', 'Completed', 'Failed'
Action AppAction `json:"action,omitempty"`
}
// AppServicePlanEventTypeDetail detail of action on the app service plan.
type AppServicePlanEventTypeDetail struct {
// StampKind - Kind of environment where app service plan is. Possible values include: 'Public', 'AseV1', 'AseV2'
StampKind StampKind `json:"stampKind,omitempty"`
// Action - Type of action on the app service plan. Possible values include: 'Updated'
Action AppServicePlanAction `json:"action,omitempty"`
// Status - Possible values include: 'AsyncStatusStarted', 'AsyncStatusCompleted', 'AsyncStatusFailed'
Status AsyncStatus `json:"status,omitempty"`
}
// CloudEventEvent properties of an event published to an Event Grid topic using the CloudEvent 1.0 Schema
type CloudEventEvent struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
// ID - An identifier for the event. The combination of id and source must be unique for each distinct event.
ID *string `json:"id,omitempty"`
// Source - Identifies the context in which an event happened. The combination of id and source must be unique for each distinct event.
Source *string `json:"source,omitempty"`
// Data - Event data specific to the event type.
Data interface{} `json:"data,omitempty"`
// DataBase64 - Event data specific to the event type, encoded as a base64 string.
DataBase64 *[]byte `json:"data_base64,omitempty"`
// Type - Type of event related to the originating occurrence.
Type *string `json:"type,omitempty"`
// Time - The time (in UTC) the event was generated, in RFC3339 format.
Time *date.Time `json:"time,omitempty"`
// Specversion - The version of the CloudEvents specification which the event uses.
Specversion *string `json:"specversion,omitempty"`
// Dataschema - Identifies the schema that data adheres to.
Dataschema *string `json:"dataschema,omitempty"`
// Datacontenttype - Content type of data value.
Datacontenttype *string `json:"datacontenttype,omitempty"`
// Subject - This describes the subject of the event in the context of the event producer (identified by source).
Subject *string `json:"subject,omitempty"`
}
// MarshalJSON is the custom marshaler for CloudEventEvent.
func (cee CloudEventEvent) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cee.ID != nil {
objectMap["id"] = cee.ID
}
if cee.Source != nil {
objectMap["source"] = cee.Source
}
if cee.Data != nil {
objectMap["data"] = cee.Data
}
if cee.DataBase64 != nil {
objectMap["data_base64"] = cee.DataBase64
}
if cee.Type != nil {
objectMap["type"] = cee.Type
}
if cee.Time != nil {
objectMap["time"] = cee.Time
}
if cee.Specversion != nil {
objectMap["specversion"] = cee.Specversion
}
if cee.Dataschema != nil {
objectMap["dataschema"] = cee.Dataschema
}
if cee.Datacontenttype != nil {
objectMap["datacontenttype"] = cee.Datacontenttype
}
if cee.Subject != nil {
objectMap["subject"] = cee.Subject
}
for k, v := range cee.AdditionalProperties {
objectMap[k] = v
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for CloudEventEvent struct.
func (cee *CloudEventEvent) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
default:
if v != nil {
var additionalProperties interface{}
err = json.Unmarshal(*v, &additionalProperties)
if err != nil {
return err
}
if cee.AdditionalProperties == nil {
cee.AdditionalProperties = make(map[string]interface{})
}
cee.AdditionalProperties[k] = additionalProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
cee.ID = &ID
}
case "source":
if v != nil {
var source string
err = json.Unmarshal(*v, &source)
if err != nil {
return err
}
cee.Source = &source
}
case "data":
if v != nil {
var data interface{}
err = json.Unmarshal(*v, &data)
if err != nil {
return err
}
cee.Data = data
}
case "data_base64":
if v != nil {
var dataBase64 []byte
err = json.Unmarshal(*v, &dataBase64)
if err != nil {
return err
}
cee.DataBase64 = &dataBase64
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
cee.Type = &typeVar
}
case "time":
if v != nil {
var timeVar date.Time
err = json.Unmarshal(*v, &timeVar)
if err != nil {
return err
}
cee.Time = &timeVar
}
case "specversion":
if v != nil {
var specversion string
err = json.Unmarshal(*v, &specversion)
if err != nil {
return err
}
cee.Specversion = &specversion
}
case "dataschema":
if v != nil {
var dataschema string
err = json.Unmarshal(*v, &dataschema)
if err != nil {
return err
}
cee.Dataschema = &dataschema
}
case "datacontenttype":
if v != nil {
var datacontenttype string
err = json.Unmarshal(*v, &datacontenttype)
if err != nil {
return err
}
cee.Datacontenttype = &datacontenttype
}
case "subject":
if v != nil {
var subject string
err = json.Unmarshal(*v, &subject)
if err != nil {
return err
}
cee.Subject = &subject
}
}
}
return nil
}
// ContainerRegistryArtifactEventData the content of the event request message.
type ContainerRegistryArtifactEventData struct {
// ID - The event ID.
ID *string `json:"id,omitempty"`
// Timestamp - The time at which the event occurred.
Timestamp *date.Time `json:"timestamp,omitempty"`
// Action - The action that encompasses the provided event.
Action *string `json:"action,omitempty"`
// Target - The target of the event.
Target *ContainerRegistryArtifactEventTarget `json:"target,omitempty"`
}
// ContainerRegistryArtifactEventTarget the target of the event.
type ContainerRegistryArtifactEventTarget struct {
// MediaType - The MIME type of the artifact.
MediaType *string `json:"mediaType,omitempty"`
// Size - The size in bytes of the artifact.
Size *int64 `json:"size,omitempty"`
// Digest - The digest of the artifact.
Digest *string `json:"digest,omitempty"`
// Repository - The repository name of the artifact.
Repository *string `json:"repository,omitempty"`
// Tag - The tag of the artifact.
Tag *string `json:"tag,omitempty"`
// Name - The name of the artifact.
Name *string `json:"name,omitempty"`
// Version - The version of the artifact.
Version *string `json:"version,omitempty"`
}
// ContainerRegistryChartDeletedEventData schema of the Data property of an EventGridEvent for a
// Microsoft.ContainerRegistry.ChartDeleted event.
type ContainerRegistryChartDeletedEventData struct {
// ID - The event ID.
ID *string `json:"id,omitempty"`
// Timestamp - The time at which the event occurred.
Timestamp *date.Time `json:"timestamp,omitempty"`
// Action - The action that encompasses the provided event.
Action *string `json:"action,omitempty"`
// Target - The target of the event.
Target *ContainerRegistryArtifactEventTarget `json:"target,omitempty"`
}
// ContainerRegistryChartPushedEventData schema of the Data property of an EventGridEvent for a
// Microsoft.ContainerRegistry.ChartPushed event.
type ContainerRegistryChartPushedEventData struct {
// ID - The event ID.
ID *string `json:"id,omitempty"`
// Timestamp - The time at which the event occurred.
Timestamp *date.Time `json:"timestamp,omitempty"`
// Action - The action that encompasses the provided event.
Action *string `json:"action,omitempty"`
// Target - The target of the event.
Target *ContainerRegistryArtifactEventTarget `json:"target,omitempty"`
}
// ContainerRegistryEventActor the agent that initiated the event. For most situations, this could be from
// the authorization context of the request.
type ContainerRegistryEventActor struct {
// Name - The subject or username associated with the request context that generated the event.
Name *string `json:"name,omitempty"`
}
// ContainerRegistryEventData the content of the event request message.
type ContainerRegistryEventData struct {
// ID - The event ID.
ID *string `json:"id,omitempty"`
// Timestamp - The time at which the event occurred.
Timestamp *date.Time `json:"timestamp,omitempty"`
// Action - The action that encompasses the provided event.
Action *string `json:"action,omitempty"`
// Target - The target of the event.
Target *ContainerRegistryEventTarget `json:"target,omitempty"`
// Request - The request that generated the event.
Request *ContainerRegistryEventRequest `json:"request,omitempty"`
// Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request.
Actor *ContainerRegistryEventActor `json:"actor,omitempty"`
// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it.
Source *ContainerRegistryEventSource `json:"source,omitempty"`
}
// ContainerRegistryEventRequest the request that generated the event.
type ContainerRegistryEventRequest struct {
// ID - The ID of the request that initiated the event.
ID *string `json:"id,omitempty"`
// Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request.
Addr *string `json:"addr,omitempty"`
// Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests.
Host *string `json:"host,omitempty"`
// Method - The request method that generated the event.
Method *string `json:"method,omitempty"`
// Useragent - The user agent header of the request.
Useragent *string `json:"useragent,omitempty"`
}
// ContainerRegistryEventSource the registry node that generated the event. Put differently, while the
// actor initiates the event, the source generates it.
type ContainerRegistryEventSource struct {
// Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port.
Addr *string `json:"addr,omitempty"`
// InstanceID - The running instance of an application. Changes after each restart.
InstanceID *string `json:"instanceID,omitempty"`
}
// ContainerRegistryEventTarget the target of the event.
type ContainerRegistryEventTarget struct {
// MediaType - The MIME type of the referenced object.
MediaType *string `json:"mediaType,omitempty"`
// Size - The number of bytes of the content. Same as Length field.
Size *int64 `json:"size,omitempty"`
// Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification.
Digest *string `json:"digest,omitempty"`
// Length - The number of bytes of the content. Same as Size field.
Length *int64 `json:"length,omitempty"`
// Repository - The repository name.
Repository *string `json:"repository,omitempty"`
// URL - The direct URL to the content.
URL *string `json:"url,omitempty"`
// Tag - The tag name.
Tag *string `json:"tag,omitempty"`
}
// ContainerRegistryImageDeletedEventData schema of the Data property of an EventGridEvent for a
// Microsoft.ContainerRegistry.ImageDeleted event.
type ContainerRegistryImageDeletedEventData struct {
// ID - The event ID.
ID *string `json:"id,omitempty"`
// Timestamp - The time at which the event occurred.
Timestamp *date.Time `json:"timestamp,omitempty"`
// Action - The action that encompasses the provided event.
Action *string `json:"action,omitempty"`
// Target - The target of the event.
Target *ContainerRegistryEventTarget `json:"target,omitempty"`
// Request - The request that generated the event.
Request *ContainerRegistryEventRequest `json:"request,omitempty"`
// Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request.
Actor *ContainerRegistryEventActor `json:"actor,omitempty"`
// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it.
Source *ContainerRegistryEventSource `json:"source,omitempty"`
}
// ContainerRegistryImagePushedEventData schema of the Data property of an EventGridEvent for a
// Microsoft.ContainerRegistry.ImagePushed event.
type ContainerRegistryImagePushedEventData struct {
// ID - The event ID.
ID *string `json:"id,omitempty"`
// Timestamp - The time at which the event occurred.
Timestamp *date.Time `json:"timestamp,omitempty"`
// Action - The action that encompasses the provided event.
Action *string `json:"action,omitempty"`
// Target - The target of the event.
Target *ContainerRegistryEventTarget `json:"target,omitempty"`
// Request - The request that generated the event.
Request *ContainerRegistryEventRequest `json:"request,omitempty"`
// Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request.
Actor *ContainerRegistryEventActor `json:"actor,omitempty"`
// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it.
Source *ContainerRegistryEventSource `json:"source,omitempty"`
}
// DeviceConnectionStateEventInfo information about the device connection state event.
type DeviceConnectionStateEventInfo struct {
// SequenceNumber - Sequence number is string representation of a hexadecimal number. string compare can be used to identify the larger number because both in ASCII and HEX numbers come after alphabets. If you are converting the string to hex, then the number is a 256 bit number.
SequenceNumber *string `json:"sequenceNumber,omitempty"`
}
// DeviceConnectionStateEventProperties schema of the Data property of an EventGridEvent for a device
// connection state event (DeviceConnected, DeviceDisconnected).
type DeviceConnectionStateEventProperties struct {
// DeviceID - The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
DeviceID *string `json:"deviceId,omitempty"`
// ModuleID - The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
ModuleID *string `json:"moduleId,omitempty"`
// HubName - Name of the IoT Hub where the device was created or deleted.
HubName *string `json:"hubName,omitempty"`
// DeviceConnectionStateEventInfo - Information about the device connection state event.
DeviceConnectionStateEventInfo *DeviceConnectionStateEventInfo `json:"deviceConnectionStateEventInfo,omitempty"`
}
// DeviceLifeCycleEventProperties schema of the Data property of an EventGridEvent for a device life cycle
// event (DeviceCreated, DeviceDeleted).
type DeviceLifeCycleEventProperties struct {
// DeviceID - The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
DeviceID *string `json:"deviceId,omitempty"`
// HubName - Name of the IoT Hub where the device was created or deleted.
HubName *string `json:"hubName,omitempty"`
// Twin - Information about the device twin, which is the cloud representation of application device metadata.
Twin *DeviceTwinInfo `json:"twin,omitempty"`
}
// DeviceTelemetryEventProperties schema of the Data property of an EventGridEvent for a device telemetry
// event (DeviceTelemetry).
type DeviceTelemetryEventProperties struct {
// Body - The content of the message from the device.
Body interface{} `json:"body,omitempty"`
// Properties - Application properties are user-defined strings that can be added to the message. These fields are optional.
Properties map[string]*string `json:"properties"`
// SystemProperties - System properties help identify contents and source of the messages.
SystemProperties map[string]*string `json:"systemProperties"`
}
// MarshalJSON is the custom marshaler for DeviceTelemetryEventProperties.
func (dtep DeviceTelemetryEventProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if dtep.Body != nil {
objectMap["body"] = dtep.Body
}
if dtep.Properties != nil {
objectMap["properties"] = dtep.Properties
}
if dtep.SystemProperties != nil {
objectMap["systemProperties"] = dtep.SystemProperties
}
return json.Marshal(objectMap)
}
// DeviceTwinInfo information about the device twin, which is the cloud representation of application
// device metadata.
type DeviceTwinInfo struct {
// AuthenticationType - Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority.
AuthenticationType *string `json:"authenticationType,omitempty"`
// CloudToDeviceMessageCount - Count of cloud to device messages sent to this device.
CloudToDeviceMessageCount *float64 `json:"cloudToDeviceMessageCount,omitempty"`
// ConnectionState - Whether the device is connected or disconnected.
ConnectionState *string `json:"connectionState,omitempty"`
// DeviceID - The unique identifier of the device twin.
DeviceID *string `json:"deviceId,omitempty"`
// Etag - A piece of information that describes the content of the device twin. Each etag is guaranteed to be unique per device twin.
Etag *string `json:"etag,omitempty"`
// LastActivityTime - The ISO8601 timestamp of the last activity.
LastActivityTime *string `json:"lastActivityTime,omitempty"`
// Properties - Properties JSON element.
Properties *DeviceTwinInfoProperties `json:"properties,omitempty"`
// Status - Whether the device twin is enabled or disabled.
Status *string `json:"status,omitempty"`
// StatusUpdateTime - The ISO8601 timestamp of the last device twin status update.
StatusUpdateTime *string `json:"statusUpdateTime,omitempty"`
// Version - An integer that is incremented by one each time the device twin is updated.
Version *float64 `json:"version,omitempty"`
// X509Thumbprint - The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in the certificate.
X509Thumbprint *DeviceTwinInfoX509Thumbprint `json:"x509Thumbprint,omitempty"`
}
// DeviceTwinInfoProperties properties JSON element.
type DeviceTwinInfoProperties struct {
// Desired - A portion of the properties that can be written only by the application back-end, and read by the device.
Desired *DeviceTwinProperties `json:"desired,omitempty"`
// Reported - A portion of the properties that can be written only by the device, and read by the application back-end.
Reported *DeviceTwinProperties `json:"reported,omitempty"`
}
// DeviceTwinInfoX509Thumbprint the thumbprint is a unique value for the x509 certificate, commonly used to
// find a particular certificate in a certificate store. The thumbprint is dynamically generated using the
// SHA1 algorithm, and does not physically exist in the certificate.
type DeviceTwinInfoX509Thumbprint struct {
// PrimaryThumbprint - Primary thumbprint for the x509 certificate.
PrimaryThumbprint *string `json:"primaryThumbprint,omitempty"`
// SecondaryThumbprint - Secondary thumbprint for the x509 certificate.
SecondaryThumbprint *string `json:"secondaryThumbprint,omitempty"`
}
// DeviceTwinMetadata metadata information for the properties JSON document.
type DeviceTwinMetadata struct {
// LastUpdated - The ISO8601 timestamp of the last time the properties were updated.
LastUpdated *string `json:"lastUpdated,omitempty"`
}
// DeviceTwinProperties a portion of the properties that can be written only by the application back-end,
// and read by the device.
type DeviceTwinProperties struct {
// Metadata - Metadata information for the properties JSON document.
Metadata *DeviceTwinMetadata `json:"metadata,omitempty"`
// Version - Version of device twin properties.
Version *float64 `json:"version,omitempty"`
}
// Event properties of an event published to an Event Grid topic using the EventGrid Schema.
type Event struct {
// ID - An unique identifier for the event.
ID *string `json:"id,omitempty"`
// Topic - The resource path of the event source.
Topic *string `json:"topic,omitempty"`
// Subject - A resource path relative to the topic path.
Subject *string `json:"subject,omitempty"`
// Data - Event data specific to the event type.
Data interface{} `json:"data,omitempty"`
// EventType - The type of the event that occurred.
EventType *string `json:"eventType,omitempty"`
// EventTime - The time (in UTC) the event was generated.
EventTime *date.Time `json:"eventTime,omitempty"`
// MetadataVersion - READ-ONLY; The schema version of the event metadata.
MetadataVersion *string `json:"metadataVersion,omitempty"`
// DataVersion - The schema version of the data object.
DataVersion *string `json:"dataVersion,omitempty"`
}
// MarshalJSON is the custom marshaler for Event.
func (e Event) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if e.ID != nil {
objectMap["id"] = e.ID
}
if e.Topic != nil {
objectMap["topic"] = e.Topic
}
if e.Subject != nil {
objectMap["subject"] = e.Subject
}
if e.Data != nil {
objectMap["data"] = e.Data
}
if e.EventType != nil {
objectMap["eventType"] = e.EventType
}
if e.EventTime != nil {
objectMap["eventTime"] = e.EventTime
}
if e.DataVersion != nil {
objectMap["dataVersion"] = e.DataVersion
}
return json.Marshal(objectMap)
}
// EventHubCaptureFileCreatedEventData schema of the Data property of an EventGridEvent for an
// Microsoft.EventHub.CaptureFileCreated event.
type EventHubCaptureFileCreatedEventData struct {
// Fileurl - The path to the capture file.
Fileurl *string `json:"fileurl,omitempty"`
// FileType - The file type of the capture file.
FileType *string `json:"fileType,omitempty"`
// PartitionID - The shard ID.
PartitionID *string `json:"partitionId,omitempty"`
// SizeInBytes - The file size.
SizeInBytes *int32 `json:"sizeInBytes,omitempty"`
// EventCount - The number of events in the file.
EventCount *int32 `json:"eventCount,omitempty"`
// FirstSequenceNumber - The smallest sequence number from the queue.
FirstSequenceNumber *int32 `json:"firstSequenceNumber,omitempty"`
// LastSequenceNumber - The last sequence number from the queue.
LastSequenceNumber *int32 `json:"lastSequenceNumber,omitempty"`
// FirstEnqueueTime - The first time from the queue.
FirstEnqueueTime *date.Time `json:"firstEnqueueTime,omitempty"`
// LastEnqueueTime - The last time from the queue.
LastEnqueueTime *date.Time `json:"lastEnqueueTime,omitempty"`
}
// IotHubDeviceConnectedEventData event data for Microsoft.Devices.DeviceConnected event.
type IotHubDeviceConnectedEventData struct {
// DeviceID - The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
DeviceID *string `json:"deviceId,omitempty"`
// ModuleID - The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
ModuleID *string `json:"moduleId,omitempty"`
// HubName - Name of the IoT Hub where the device was created or deleted.
HubName *string `json:"hubName,omitempty"`
// DeviceConnectionStateEventInfo - Information about the device connection state event.
DeviceConnectionStateEventInfo *DeviceConnectionStateEventInfo `json:"deviceConnectionStateEventInfo,omitempty"`
}
// IotHubDeviceCreatedEventData event data for Microsoft.Devices.DeviceCreated event.
type IotHubDeviceCreatedEventData struct {
// DeviceID - The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
DeviceID *string `json:"deviceId,omitempty"`
// HubName - Name of the IoT Hub where the device was created or deleted.
HubName *string `json:"hubName,omitempty"`
// Twin - Information about the device twin, which is the cloud representation of application device metadata.
Twin *DeviceTwinInfo `json:"twin,omitempty"`
}
// IotHubDeviceDeletedEventData event data for Microsoft.Devices.DeviceDeleted event.
type IotHubDeviceDeletedEventData struct {
// DeviceID - The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
DeviceID *string `json:"deviceId,omitempty"`
// HubName - Name of the IoT Hub where the device was created or deleted.
HubName *string `json:"hubName,omitempty"`
// Twin - Information about the device twin, which is the cloud representation of application device metadata.
Twin *DeviceTwinInfo `json:"twin,omitempty"`
}
// IotHubDeviceDisconnectedEventData event data for Microsoft.Devices.DeviceDisconnected event.
type IotHubDeviceDisconnectedEventData struct {
// DeviceID - The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
DeviceID *string `json:"deviceId,omitempty"`
// ModuleID - The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = @ ; $ '.
ModuleID *string `json:"moduleId,omitempty"`
// HubName - Name of the IoT Hub where the device was created or deleted.
HubName *string `json:"hubName,omitempty"`
// DeviceConnectionStateEventInfo - Information about the device connection state event.
DeviceConnectionStateEventInfo *DeviceConnectionStateEventInfo `json:"deviceConnectionStateEventInfo,omitempty"`
}
// IotHubDeviceTelemetryEventData event data for Microsoft.Devices.DeviceTelemetry event.
type IotHubDeviceTelemetryEventData struct {
// Body - The content of the message from the device.
Body interface{} `json:"body,omitempty"`
// Properties - Application properties are user-defined strings that can be added to the message. These fields are optional.
Properties map[string]*string `json:"properties"`
// SystemProperties - System properties help identify contents and source of the messages.
SystemProperties map[string]*string `json:"systemProperties"`
}
// MarshalJSON is the custom marshaler for IotHubDeviceTelemetryEventData.
func (ihdted IotHubDeviceTelemetryEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ihdted.Body != nil {
objectMap["body"] = ihdted.Body