Skip to content

Commit

Permalink
feat: add greengrass APIs for resource management (#7) (#218)
Browse files Browse the repository at this point in the history
Co-authored-by: abanthiy <[email protected]>
  • Loading branch information
bretambrose and abanthiy authored Aug 2, 2021
1 parent f3a0021 commit 6a6e634
Show file tree
Hide file tree
Showing 2 changed files with 436 additions and 71 deletions.
88 changes: 88 additions & 0 deletions awsiot/greengrasscoreipc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,40 @@ def close(self) -> concurrent.futures.Future:
return super().close()


class ResumeComponentOperation(model._ResumeComponentOperation):
"""
ResumeComponentOperation
Create with GreengrassCoreIPCClient.new_resume_component()
"""

def activate(self, request: model.ResumeComponentRequest) -> concurrent.futures.Future:
"""
Activate this operation by sending the initial ResumeComponentRequest message.
Returns a Future which completes with a result of None if the
request is successfully written to the wire, or an exception if
the request fails to send.
"""
return self._activate(request)

def get_response(self) -> concurrent.futures.Future:
"""
Returns a Future which completes with a result of ResumeComponentResponse,
when the initial response is received, or an exception.
"""
return self._get_response()

def close(self) -> concurrent.futures.Future:
"""
Close the operation, whether or not it has completed.
Returns a Future which completes with a result of None
when the operation has closed.
"""
return super().close()


class PublishToIoTCoreOperation(model._PublishToIoTCoreOperation):
"""
PublishToIoTCoreOperation
Expand Down Expand Up @@ -1003,6 +1037,40 @@ def close(self) -> concurrent.futures.Future:
return super().close()


class PauseComponentOperation(model._PauseComponentOperation):
"""
PauseComponentOperation
Create with GreengrassCoreIPCClient.new_pause_component()
"""

def activate(self, request: model.PauseComponentRequest) -> concurrent.futures.Future:
"""
Activate this operation by sending the initial PauseComponentRequest message.
Returns a Future which completes with a result of None if the
request is successfully written to the wire, or an exception if
the request fails to send.
"""
return self._activate(request)

def get_response(self) -> concurrent.futures.Future:
"""
Returns a Future which completes with a result of PauseComponentResponse,
when the initial response is received, or an exception.
"""
return self._get_response()

def close(self) -> concurrent.futures.Future:
"""
Close the operation, whether or not it has completed.
Returns a Future which completes with a result of None
when the operation has closed.
"""
return super().close()


class CreateLocalDeploymentOperation(model._CreateLocalDeploymentOperation):
"""
CreateLocalDeploymentOperation
Expand Down Expand Up @@ -1062,6 +1130,16 @@ def new_subscribe_to_iot_core(self, stream_handler: SubscribeToIoTCoreStreamHand
"""
return self._new_operation(SubscribeToIoTCoreOperation, stream_handler)

def new_resume_component(self) -> ResumeComponentOperation:
"""
Create a new ResumeComponentOperation.
This operation will not send or receive any data until activate()
is called. Call activate() when you're ready for callbacks and
events to fire.
"""
return self._new_operation(ResumeComponentOperation)

def new_publish_to_iot_core(self) -> PublishToIoTCoreOperation:
"""
Create a new PublishToIoTCoreOperation.
Expand Down Expand Up @@ -1318,6 +1396,16 @@ def new_stop_component(self) -> StopComponentOperation:
"""
return self._new_operation(StopComponentOperation)

def new_pause_component(self) -> PauseComponentOperation:
"""
Create a new PauseComponentOperation.
This operation will not send or receive any data until activate()
is called. Call activate() when you're ready for callbacks and
events to fire.
"""
return self._new_operation(PauseComponentOperation)

def new_create_local_deployment(self) -> CreateLocalDeploymentOperation:
"""
Create a new CreateLocalDeploymentOperation.
Expand Down
Loading

0 comments on commit 6a6e634

Please sign in to comment.