Skip to content

Commit 6a6e634

Browse files
feat: add greengrass APIs for resource management (#7) (#218)
Co-authored-by: abanthiy <[email protected]>
1 parent f3a0021 commit 6a6e634

File tree

2 files changed

+436
-71
lines changed

2 files changed

+436
-71
lines changed

awsiot/greengrasscoreipc/client.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,40 @@ def close(self) -> concurrent.futures.Future:
7171
return super().close()
7272

7373

74+
class ResumeComponentOperation(model._ResumeComponentOperation):
75+
"""
76+
ResumeComponentOperation
77+
78+
Create with GreengrassCoreIPCClient.new_resume_component()
79+
"""
80+
81+
def activate(self, request: model.ResumeComponentRequest) -> concurrent.futures.Future:
82+
"""
83+
Activate this operation by sending the initial ResumeComponentRequest message.
84+
85+
Returns a Future which completes with a result of None if the
86+
request is successfully written to the wire, or an exception if
87+
the request fails to send.
88+
"""
89+
return self._activate(request)
90+
91+
def get_response(self) -> concurrent.futures.Future:
92+
"""
93+
Returns a Future which completes with a result of ResumeComponentResponse,
94+
when the initial response is received, or an exception.
95+
"""
96+
return self._get_response()
97+
98+
def close(self) -> concurrent.futures.Future:
99+
"""
100+
Close the operation, whether or not it has completed.
101+
102+
Returns a Future which completes with a result of None
103+
when the operation has closed.
104+
"""
105+
return super().close()
106+
107+
74108
class PublishToIoTCoreOperation(model._PublishToIoTCoreOperation):
75109
"""
76110
PublishToIoTCoreOperation
@@ -1003,6 +1037,40 @@ def close(self) -> concurrent.futures.Future:
10031037
return super().close()
10041038

10051039

1040+
class PauseComponentOperation(model._PauseComponentOperation):
1041+
"""
1042+
PauseComponentOperation
1043+
1044+
Create with GreengrassCoreIPCClient.new_pause_component()
1045+
"""
1046+
1047+
def activate(self, request: model.PauseComponentRequest) -> concurrent.futures.Future:
1048+
"""
1049+
Activate this operation by sending the initial PauseComponentRequest message.
1050+
1051+
Returns a Future which completes with a result of None if the
1052+
request is successfully written to the wire, or an exception if
1053+
the request fails to send.
1054+
"""
1055+
return self._activate(request)
1056+
1057+
def get_response(self) -> concurrent.futures.Future:
1058+
"""
1059+
Returns a Future which completes with a result of PauseComponentResponse,
1060+
when the initial response is received, or an exception.
1061+
"""
1062+
return self._get_response()
1063+
1064+
def close(self) -> concurrent.futures.Future:
1065+
"""
1066+
Close the operation, whether or not it has completed.
1067+
1068+
Returns a Future which completes with a result of None
1069+
when the operation has closed.
1070+
"""
1071+
return super().close()
1072+
1073+
10061074
class CreateLocalDeploymentOperation(model._CreateLocalDeploymentOperation):
10071075
"""
10081076
CreateLocalDeploymentOperation
@@ -1062,6 +1130,16 @@ def new_subscribe_to_iot_core(self, stream_handler: SubscribeToIoTCoreStreamHand
10621130
"""
10631131
return self._new_operation(SubscribeToIoTCoreOperation, stream_handler)
10641132

1133+
def new_resume_component(self) -> ResumeComponentOperation:
1134+
"""
1135+
Create a new ResumeComponentOperation.
1136+
1137+
This operation will not send or receive any data until activate()
1138+
is called. Call activate() when you're ready for callbacks and
1139+
events to fire.
1140+
"""
1141+
return self._new_operation(ResumeComponentOperation)
1142+
10651143
def new_publish_to_iot_core(self) -> PublishToIoTCoreOperation:
10661144
"""
10671145
Create a new PublishToIoTCoreOperation.
@@ -1318,6 +1396,16 @@ def new_stop_component(self) -> StopComponentOperation:
13181396
"""
13191397
return self._new_operation(StopComponentOperation)
13201398

1399+
def new_pause_component(self) -> PauseComponentOperation:
1400+
"""
1401+
Create a new PauseComponentOperation.
1402+
1403+
This operation will not send or receive any data until activate()
1404+
is called. Call activate() when you're ready for callbacks and
1405+
events to fire.
1406+
"""
1407+
return self._new_operation(PauseComponentOperation)
1408+
13211409
def new_create_local_deployment(self) -> CreateLocalDeploymentOperation:
13221410
"""
13231411
Create a new CreateLocalDeploymentOperation.

0 commit comments

Comments
 (0)