/
model.py
7761 lines (6033 loc) · 235 KB
/
model.py
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
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
# This file is generated
import awsiot.eventstreamrpc as rpc
import base64
import datetime
import typing
class GreengrassCoreIPCError(rpc.ErrorShape):
"""
Base for all error messages sent by server.
"""
def _get_error_type_string(self) -> str:
# overridden in subclasses
raise NotImplementedError
def is_retryable(self) -> bool:
return self._get_error_type_string() == 'server'
def is_server_error(self) -> bool:
return self._get_error_type_string() == 'server'
def is_client_error(self) -> bool:
return self._get_error_type_string() == 'client'
class DetailedDeploymentStatus:
"""
DetailedDeploymentStatus enum
"""
SUCCESSFUL = 'SUCCESSFUL'
FAILED_NO_STATE_CHANGE = 'FAILED_NO_STATE_CHANGE'
FAILED_ROLLBACK_NOT_REQUESTED = 'FAILED_ROLLBACK_NOT_REQUESTED'
FAILED_ROLLBACK_COMPLETE = 'FAILED_ROLLBACK_COMPLETE'
REJECTED = 'REJECTED'
class UserProperty(rpc.Shape):
"""
UserProperty
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
key:
value:
Attributes:
key:
value:
"""
def __init__(self, *,
key: typing.Optional[str] = None,
value: typing.Optional[str] = None):
super().__init__()
self.key = key # type: typing.Optional[str]
self.value = value # type: typing.Optional[str]
def set_key(self, key: str):
self.key = key
return self
def set_value(self, value: str):
self.value = value
return self
def _to_payload(self):
payload = {}
if self.key is not None:
payload['key'] = self.key
if self.value is not None:
payload['value'] = self.value
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'key' in payload:
new.key = payload['key']
if 'value' in payload:
new.value = payload['value']
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#UserProperty'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class SystemResourceLimits(rpc.Shape):
"""
SystemResourceLimits
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
memory: (Optional) The maximum amount of RAM (in kilobytes) that this component's processes can use on the core device.
cpus: (Optional) The maximum amount of CPU time that this component's processes can use on the core device.
Attributes:
memory: (Optional) The maximum amount of RAM (in kilobytes) that this component's processes can use on the core device.
cpus: (Optional) The maximum amount of CPU time that this component's processes can use on the core device.
"""
def __init__(self, *,
memory: typing.Optional[int] = None,
cpus: typing.Optional[float] = None):
super().__init__()
self.memory = memory # type: typing.Optional[int]
self.cpus = cpus # type: typing.Optional[float]
def set_memory(self, memory: int):
self.memory = memory
return self
def set_cpus(self, cpus: float):
self.cpus = cpus
return self
def _to_payload(self):
payload = {}
if self.memory is not None:
payload['memory'] = self.memory
if self.cpus is not None:
payload['cpus'] = self.cpus
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'memory' in payload:
new.memory = int(payload['memory'])
if 'cpus' in payload:
new.cpus = float(payload['cpus'])
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#SystemResourceLimits'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class DeploymentStatusDetails(rpc.Shape):
"""
DeploymentStatusDetails
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
detailed_deployment_status: DetailedDeploymentStatus enum value. The detailed deployment status of the local deployment.
deployment_error_stack: (Optional) The list of local deployment errors
deployment_error_types: (Optional) The list of local deployment error types
deployment_failure_cause: (Optional) The cause of local deployment failure
Attributes:
detailed_deployment_status: DetailedDeploymentStatus enum value. The detailed deployment status of the local deployment.
deployment_error_stack: (Optional) The list of local deployment errors
deployment_error_types: (Optional) The list of local deployment error types
deployment_failure_cause: (Optional) The cause of local deployment failure
"""
def __init__(self, *,
detailed_deployment_status: typing.Optional[str] = None,
deployment_error_stack: typing.Optional[typing.List[str]] = None,
deployment_error_types: typing.Optional[typing.List[str]] = None,
deployment_failure_cause: typing.Optional[str] = None):
super().__init__()
self.detailed_deployment_status = detailed_deployment_status # type: typing.Optional[str]
self.deployment_error_stack = deployment_error_stack # type: typing.Optional[typing.List[str]]
self.deployment_error_types = deployment_error_types # type: typing.Optional[typing.List[str]]
self.deployment_failure_cause = deployment_failure_cause # type: typing.Optional[str]
def set_detailed_deployment_status(self, detailed_deployment_status: str):
self.detailed_deployment_status = detailed_deployment_status
return self
def set_deployment_error_stack(self, deployment_error_stack: typing.List[str]):
self.deployment_error_stack = deployment_error_stack
return self
def set_deployment_error_types(self, deployment_error_types: typing.List[str]):
self.deployment_error_types = deployment_error_types
return self
def set_deployment_failure_cause(self, deployment_failure_cause: str):
self.deployment_failure_cause = deployment_failure_cause
return self
def _to_payload(self):
payload = {}
if self.detailed_deployment_status is not None:
payload['detailedDeploymentStatus'] = self.detailed_deployment_status
if self.deployment_error_stack is not None:
payload['deploymentErrorStack'] = self.deployment_error_stack
if self.deployment_error_types is not None:
payload['deploymentErrorTypes'] = self.deployment_error_types
if self.deployment_failure_cause is not None:
payload['deploymentFailureCause'] = self.deployment_failure_cause
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'detailedDeploymentStatus' in payload:
new.detailed_deployment_status = payload['detailedDeploymentStatus']
if 'deploymentErrorStack' in payload:
new.deployment_error_stack = payload['deploymentErrorStack']
if 'deploymentErrorTypes' in payload:
new.deployment_error_types = payload['deploymentErrorTypes']
if 'deploymentFailureCause' in payload:
new.deployment_failure_cause = payload['deploymentFailureCause']
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#DeploymentStatusDetails'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class DeploymentStatus:
"""
DeploymentStatus enum
"""
QUEUED = 'QUEUED'
IN_PROGRESS = 'IN_PROGRESS'
SUCCEEDED = 'SUCCEEDED'
FAILED = 'FAILED'
CANCELED = 'CANCELED'
class LifecycleState:
"""
LifecycleState enum
"""
RUNNING = 'RUNNING'
ERRORED = 'ERRORED'
NEW = 'NEW'
FINISHED = 'FINISHED'
INSTALLED = 'INSTALLED'
BROKEN = 'BROKEN'
STARTING = 'STARTING'
STOPPING = 'STOPPING'
class MessageContext(rpc.Shape):
"""
MessageContext
Contextual information about the message.
NOTE The context is ignored if used in PublishMessage.
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
topic: The topic where the message was published.
Attributes:
topic: The topic where the message was published.
"""
def __init__(self, *,
topic: typing.Optional[str] = None):
super().__init__()
self.topic = topic # type: typing.Optional[str]
def set_topic(self, topic: str):
self.topic = topic
return self
def _to_payload(self):
payload = {}
if self.topic is not None:
payload['topic'] = self.topic
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'topic' in payload:
new.topic = payload['topic']
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#MessageContext'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class MetricUnitType:
"""
MetricUnitType enum
"""
BYTES = 'BYTES'
BYTES_PER_SECOND = 'BYTES_PER_SECOND'
COUNT = 'COUNT'
COUNT_PER_SECOND = 'COUNT_PER_SECOND'
MEGABYTES = 'MEGABYTES'
SECONDS = 'SECONDS'
class PayloadFormat:
"""
PayloadFormat enum
"""
BYTES = '0'
UTF8 = '1'
class RunWithInfo(rpc.Shape):
"""
RunWithInfo
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
posix_user: (Optional) The POSIX system user and, optionally, group to use to run this component on Linux core devices.
windows_user: (Optional) The Windows user to use to run this component on Windows core devices.
system_resource_limits: (Optional) The system resource limits to apply to this component's processes.
Attributes:
posix_user: (Optional) The POSIX system user and, optionally, group to use to run this component on Linux core devices.
windows_user: (Optional) The Windows user to use to run this component on Windows core devices.
system_resource_limits: (Optional) The system resource limits to apply to this component's processes.
"""
def __init__(self, *,
posix_user: typing.Optional[str] = None,
windows_user: typing.Optional[str] = None,
system_resource_limits: typing.Optional[SystemResourceLimits] = None):
super().__init__()
self.posix_user = posix_user # type: typing.Optional[str]
self.windows_user = windows_user # type: typing.Optional[str]
self.system_resource_limits = system_resource_limits # type: typing.Optional[SystemResourceLimits]
def set_posix_user(self, posix_user: str):
self.posix_user = posix_user
return self
def set_windows_user(self, windows_user: str):
self.windows_user = windows_user
return self
def set_system_resource_limits(self, system_resource_limits: SystemResourceLimits):
self.system_resource_limits = system_resource_limits
return self
def _to_payload(self):
payload = {}
if self.posix_user is not None:
payload['posixUser'] = self.posix_user
if self.windows_user is not None:
payload['windowsUser'] = self.windows_user
if self.system_resource_limits is not None:
payload['systemResourceLimits'] = self.system_resource_limits._to_payload()
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'posixUser' in payload:
new.posix_user = payload['posixUser']
if 'windowsUser' in payload:
new.windows_user = payload['windowsUser']
if 'systemResourceLimits' in payload:
new.system_resource_limits = SystemResourceLimits._from_payload(payload['systemResourceLimits'])
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#RunWithInfo'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class LocalDeployment(rpc.Shape):
"""
LocalDeployment
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
deployment_id: The ID of the local deployment.
status: DeploymentStatus enum value. The status of the local deployment.
created_on: (Optional) The timestamp at which the local deployment was created in MM/dd/yyyy hh:mm:ss format
deployment_status_details: (Optional) The status details of the local deployment.
Attributes:
deployment_id: The ID of the local deployment.
status: DeploymentStatus enum value. The status of the local deployment.
created_on: (Optional) The timestamp at which the local deployment was created in MM/dd/yyyy hh:mm:ss format
deployment_status_details: (Optional) The status details of the local deployment.
"""
def __init__(self, *,
deployment_id: typing.Optional[str] = None,
status: typing.Optional[str] = None,
created_on: typing.Optional[str] = None,
deployment_status_details: typing.Optional[DeploymentStatusDetails] = None):
super().__init__()
self.deployment_id = deployment_id # type: typing.Optional[str]
self.status = status # type: typing.Optional[str]
self.created_on = created_on # type: typing.Optional[str]
self.deployment_status_details = deployment_status_details # type: typing.Optional[DeploymentStatusDetails]
def set_deployment_id(self, deployment_id: str):
self.deployment_id = deployment_id
return self
def set_status(self, status: str):
self.status = status
return self
def set_created_on(self, created_on: str):
self.created_on = created_on
return self
def set_deployment_status_details(self, deployment_status_details: DeploymentStatusDetails):
self.deployment_status_details = deployment_status_details
return self
def _to_payload(self):
payload = {}
if self.deployment_id is not None:
payload['deploymentId'] = self.deployment_id
if self.status is not None:
payload['status'] = self.status
if self.created_on is not None:
payload['createdOn'] = self.created_on
if self.deployment_status_details is not None:
payload['deploymentStatusDetails'] = self.deployment_status_details._to_payload()
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'deploymentId' in payload:
new.deployment_id = payload['deploymentId']
if 'status' in payload:
new.status = payload['status']
if 'createdOn' in payload:
new.created_on = payload['createdOn']
if 'deploymentStatusDetails' in payload:
new.deployment_status_details = DeploymentStatusDetails._from_payload(payload['deploymentStatusDetails'])
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#LocalDeployment'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class PostComponentUpdateEvent(rpc.Shape):
"""
PostComponentUpdateEvent
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
deployment_id: The ID of the AWS IoT Greengrass deployment that updated the component.
Attributes:
deployment_id: The ID of the AWS IoT Greengrass deployment that updated the component.
"""
def __init__(self, *,
deployment_id: typing.Optional[str] = None):
super().__init__()
self.deployment_id = deployment_id # type: typing.Optional[str]
def set_deployment_id(self, deployment_id: str):
self.deployment_id = deployment_id
return self
def _to_payload(self):
payload = {}
if self.deployment_id is not None:
payload['deploymentId'] = self.deployment_id
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'deploymentId' in payload:
new.deployment_id = payload['deploymentId']
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#PostComponentUpdateEvent'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class PreComponentUpdateEvent(rpc.Shape):
"""
PreComponentUpdateEvent
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
deployment_id: The ID of the AWS IoT Greengrass deployment that updates the component.
is_ggc_restarting: Whether or not Greengrass needs to restart to apply the update.
Attributes:
deployment_id: The ID of the AWS IoT Greengrass deployment that updates the component.
is_ggc_restarting: Whether or not Greengrass needs to restart to apply the update.
"""
def __init__(self, *,
deployment_id: typing.Optional[str] = None,
is_ggc_restarting: typing.Optional[bool] = None):
super().__init__()
self.deployment_id = deployment_id # type: typing.Optional[str]
self.is_ggc_restarting = is_ggc_restarting # type: typing.Optional[bool]
def set_deployment_id(self, deployment_id: str):
self.deployment_id = deployment_id
return self
def set_is_ggc_restarting(self, is_ggc_restarting: bool):
self.is_ggc_restarting = is_ggc_restarting
return self
def _to_payload(self):
payload = {}
if self.deployment_id is not None:
payload['deploymentId'] = self.deployment_id
if self.is_ggc_restarting is not None:
payload['isGgcRestarting'] = self.is_ggc_restarting
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'deploymentId' in payload:
new.deployment_id = payload['deploymentId']
if 'isGgcRestarting' in payload:
new.is_ggc_restarting = payload['isGgcRestarting']
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#PreComponentUpdateEvent'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class ConfigurationValidityStatus:
"""
ConfigurationValidityStatus enum
"""
ACCEPTED = 'ACCEPTED'
REJECTED = 'REJECTED'
class ComponentDetails(rpc.Shape):
"""
ComponentDetails
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
component_name: The name of the component.
version: The version of the component.
state: LifecycleState enum value. The state of the component.
configuration: The component's configuration as a JSON object.
Attributes:
component_name: The name of the component.
version: The version of the component.
state: LifecycleState enum value. The state of the component.
configuration: The component's configuration as a JSON object.
"""
def __init__(self, *,
component_name: typing.Optional[str] = None,
version: typing.Optional[str] = None,
state: typing.Optional[str] = None,
configuration: typing.Optional[typing.Dict[str, typing.Any]] = None):
super().__init__()
self.component_name = component_name # type: typing.Optional[str]
self.version = version # type: typing.Optional[str]
self.state = state # type: typing.Optional[str]
self.configuration = configuration # type: typing.Optional[typing.Dict[str, typing.Any]]
def set_component_name(self, component_name: str):
self.component_name = component_name
return self
def set_version(self, version: str):
self.version = version
return self
def set_state(self, state: str):
self.state = state
return self
def set_configuration(self, configuration: typing.Dict[str, typing.Any]):
self.configuration = configuration
return self
def _to_payload(self):
payload = {}
if self.component_name is not None:
payload['componentName'] = self.component_name
if self.version is not None:
payload['version'] = self.version
if self.state is not None:
payload['state'] = self.state
if self.configuration is not None:
payload['configuration'] = self.configuration
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'componentName' in payload:
new.component_name = payload['componentName']
if 'version' in payload:
new.version = payload['version']
if 'state' in payload:
new.state = payload['state']
if 'configuration' in payload:
new.configuration = payload['configuration']
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#ComponentDetails'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class CertificateUpdate(rpc.Shape):
"""
CertificateUpdate
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
private_key: The private key in pem format.
public_key: The public key in pem format.
certificate: The certificate in pem format.
ca_certificates: List of CA certificates in pem format.
Attributes:
private_key: The private key in pem format.
public_key: The public key in pem format.
certificate: The certificate in pem format.
ca_certificates: List of CA certificates in pem format.
"""
def __init__(self, *,
private_key: typing.Optional[str] = None,
public_key: typing.Optional[str] = None,
certificate: typing.Optional[str] = None,
ca_certificates: typing.Optional[typing.List[str]] = None):
super().__init__()
self.private_key = private_key # type: typing.Optional[str]
self.public_key = public_key # type: typing.Optional[str]
self.certificate = certificate # type: typing.Optional[str]
self.ca_certificates = ca_certificates # type: typing.Optional[typing.List[str]]
def set_private_key(self, private_key: str):
self.private_key = private_key
return self
def set_public_key(self, public_key: str):
self.public_key = public_key
return self
def set_certificate(self, certificate: str):
self.certificate = certificate
return self
def set_ca_certificates(self, ca_certificates: typing.List[str]):
self.ca_certificates = ca_certificates
return self
def _to_payload(self):
payload = {}
if self.private_key is not None:
payload['privateKey'] = self.private_key
if self.public_key is not None:
payload['publicKey'] = self.public_key
if self.certificate is not None:
payload['certificate'] = self.certificate
if self.ca_certificates is not None:
payload['caCertificates'] = self.ca_certificates
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'privateKey' in payload:
new.private_key = payload['privateKey']
if 'publicKey' in payload:
new.public_key = payload['publicKey']
if 'certificate' in payload:
new.certificate = payload['certificate']
if 'caCertificates' in payload:
new.ca_certificates = payload['caCertificates']
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#CertificateUpdate'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class CertificateType:
"""
CertificateType enum
"""
SERVER = 'SERVER'
class BinaryMessage(rpc.Shape):
"""
BinaryMessage
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
message: The binary message as a blob.
context: The context of the message, such as the topic where the message was published.
Attributes:
message: The binary message as a blob.
context: The context of the message, such as the topic where the message was published.
"""
def __init__(self, *,
message: typing.Optional[typing.Union[bytes, str]] = None,
context: typing.Optional[MessageContext] = None):
super().__init__()
if message is not None and isinstance(message, str):
message = message.encode('utf-8')
self.message = message # type: typing.Optional[bytes]
self.context = context # type: typing.Optional[MessageContext]
def set_message(self, message: typing.Union[bytes, str]):
if message is not None and isinstance(message, str):
message = message.encode('utf-8')
self.message = message
return self
def set_context(self, context: MessageContext):
self.context = context
return self
def _to_payload(self):
payload = {}
if self.message is not None:
payload['message'] = base64.b64encode(self.message).decode()
if self.context is not None:
payload['context'] = self.context._to_payload()
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'message' in payload:
new.message = base64.b64decode(payload['message'])
if 'context' in payload:
new.context = MessageContext._from_payload(payload['context'])
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#BinaryMessage'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class JsonMessage(rpc.Shape):
"""
JsonMessage
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
message: The JSON message as an object.
context: The context of the message, such as the topic where the message was published.
Attributes:
message: The JSON message as an object.
context: The context of the message, such as the topic where the message was published.
"""
def __init__(self, *,
message: typing.Optional[typing.Dict[str, typing.Any]] = None,
context: typing.Optional[MessageContext] = None):
super().__init__()
self.message = message # type: typing.Optional[typing.Dict[str, typing.Any]]
self.context = context # type: typing.Optional[MessageContext]
def set_message(self, message: typing.Dict[str, typing.Any]):
self.message = message
return self
def set_context(self, context: MessageContext):
self.context = context
return self
def _to_payload(self):
payload = {}
if self.message is not None:
payload['message'] = self.message
if self.context is not None:
payload['context'] = self.context._to_payload()
return payload
@classmethod
def _from_payload(cls, payload):
new = cls()
if 'message' in payload:
new.message = payload['message']
if 'context' in payload:
new.context = MessageContext._from_payload(payload['context'])
return new
@classmethod
def _model_name(cls):
return 'aws.greengrass#JsonMessage'
def __repr__(self):
attrs = []
for attr, val in self.__dict__.items():
if val is not None:
attrs.append('%s=%r' % (attr, val))
return '%s(%s)' % (self.__class__.__name__, ', '.join(attrs))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
class MQTTCredential(rpc.Shape):
"""
MQTTCredential
All attributes are None by default, and may be set by keyword in the constructor.
Keyword Args:
client_id: The client ID to used to connect.
certificate_pem: The client certificate in pem format.
username: The username. (unused).
password: The password. (unused).
Attributes:
client_id: The client ID to used to connect.
certificate_pem: The client certificate in pem format.
username: The username. (unused).
password: The password. (unused).
"""
def __init__(self, *,
client_id: typing.Optional[str] = None,