Skip to content

add local cancellation api for gg release 2.11 #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions awsiot/greengrasscoreipc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,40 @@ def close(self): # type: (...) -> concurrent.futures.Future[None]
return super().close()


class CancelLocalDeploymentOperation(model._CancelLocalDeploymentOperation):
"""
CancelLocalDeploymentOperation

Create with GreengrassCoreIPCClient.new_cancel_local_deployment()
"""

def activate(self, request: model.CancelLocalDeploymentRequest): # type: (...) -> concurrent.futures.Future[None]
"""
Activate this operation by sending the initial CancelLocalDeploymentRequest 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): # type: (...) -> concurrent.futures.Future[model.CancelLocalDeploymentResponse]
"""
Returns a Future which completes with a result of CancelLocalDeploymentResponse,
when the initial response is received, or an exception.
"""
return self._get_response()

def close(self): # type: (...) -> concurrent.futures.Future[None]
"""
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 CreateDebugPasswordOperation(model._CreateDebugPasswordOperation):
"""
CreateDebugPasswordOperation
Expand Down Expand Up @@ -1327,6 +1361,16 @@ def new_authorize_client_device_action(self) -> AuthorizeClientDeviceActionOpera
"""
return self._new_operation(AuthorizeClientDeviceActionOperation)

def new_cancel_local_deployment(self) -> CancelLocalDeploymentOperation:
"""
Create a new CancelLocalDeploymentOperation.

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(CancelLocalDeploymentOperation)

def new_create_debug_password(self) -> CreateDebugPasswordOperation:
"""
Create a new CreateDebugPasswordOperation.
Expand Down
35 changes: 31 additions & 4 deletions awsiot/greengrasscoreipc/clientv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,29 @@ def authorize_client_device_action_async(self, *,
write_future = operation.activate(request)
return self.__combine_futures(write_future, operation.get_response())

def cancel_local_deployment(self, *,
deployment_id: typing.Optional[str] = None) -> model.CancelLocalDeploymentResponse:
"""
Perform the CancelLocalDeployment operation synchronously.

Args:
deployment_id:
"""
return self.cancel_local_deployment_async(deployment_id=deployment_id).result()

def cancel_local_deployment_async(self, *,
deployment_id: typing.Optional[str] = None): # type: (...) -> concurrent.futures.Future[model.CancelLocalDeploymentResponse]
"""
Perform the CancelLocalDeployment operation asynchronously.

Args:
deployment_id:
"""
request = model.CancelLocalDeploymentRequest(deployment_id=deployment_id)
operation = self.client.new_cancel_local_deployment()
write_future = operation.activate(request)
return self.__combine_futures(write_future, operation.get_response())

def create_debug_password(self) -> model.CreateDebugPasswordResponse:
"""
Perform the CreateDebugPassword operation synchronously.
Expand All @@ -168,7 +191,8 @@ def create_local_deployment(self, *,
component_to_configuration: typing.Optional[typing.Dict[str, typing.Dict[str, typing.Any]]] = None,
component_to_run_with_info: typing.Optional[typing.Dict[str, model.RunWithInfo]] = None,
recipe_directory_path: typing.Optional[str] = None,
artifacts_directory_path: typing.Optional[str] = None) -> model.CreateLocalDeploymentResponse:
artifacts_directory_path: typing.Optional[str] = None,
failure_handling_policy: typing.Optional[str] = None) -> model.CreateLocalDeploymentResponse:
"""
Perform the CreateLocalDeployment operation synchronously.

Expand All @@ -180,8 +204,9 @@ def create_local_deployment(self, *,
component_to_run_with_info:
recipe_directory_path:
artifacts_directory_path:
failure_handling_policy: FailureHandlingPolicy enum value
"""
return self.create_local_deployment_async(group_name=group_name, root_component_versions_to_add=root_component_versions_to_add, root_components_to_remove=root_components_to_remove, component_to_configuration=component_to_configuration, component_to_run_with_info=component_to_run_with_info, recipe_directory_path=recipe_directory_path, artifacts_directory_path=artifacts_directory_path).result()
return self.create_local_deployment_async(group_name=group_name, root_component_versions_to_add=root_component_versions_to_add, root_components_to_remove=root_components_to_remove, component_to_configuration=component_to_configuration, component_to_run_with_info=component_to_run_with_info, recipe_directory_path=recipe_directory_path, artifacts_directory_path=artifacts_directory_path, failure_handling_policy=failure_handling_policy).result()

def create_local_deployment_async(self, *,
group_name: typing.Optional[str] = None,
Expand All @@ -190,7 +215,8 @@ def create_local_deployment_async(self, *,
component_to_configuration: typing.Optional[typing.Dict[str, typing.Dict[str, typing.Any]]] = None,
component_to_run_with_info: typing.Optional[typing.Dict[str, model.RunWithInfo]] = None,
recipe_directory_path: typing.Optional[str] = None,
artifacts_directory_path: typing.Optional[str] = None): # type: (...) -> concurrent.futures.Future[model.CreateLocalDeploymentResponse]
artifacts_directory_path: typing.Optional[str] = None,
failure_handling_policy: typing.Optional[str] = None): # type: (...) -> concurrent.futures.Future[model.CreateLocalDeploymentResponse]
"""
Perform the CreateLocalDeployment operation asynchronously.

Expand All @@ -202,8 +228,9 @@ def create_local_deployment_async(self, *,
component_to_run_with_info:
recipe_directory_path:
artifacts_directory_path:
failure_handling_policy: FailureHandlingPolicy enum value
"""
request = model.CreateLocalDeploymentRequest(group_name=group_name, root_component_versions_to_add=root_component_versions_to_add, root_components_to_remove=root_components_to_remove, component_to_configuration=component_to_configuration, component_to_run_with_info=component_to_run_with_info, recipe_directory_path=recipe_directory_path, artifacts_directory_path=artifacts_directory_path)
request = model.CreateLocalDeploymentRequest(group_name=group_name, root_component_versions_to_add=root_component_versions_to_add, root_components_to_remove=root_components_to_remove, component_to_configuration=component_to_configuration, component_to_run_with_info=component_to_run_with_info, recipe_directory_path=recipe_directory_path, artifacts_directory_path=artifacts_directory_path, failure_handling_policy=failure_handling_policy)
operation = self.client.new_create_local_deployment()
write_future = operation.activate(request)
return self.__combine_futures(write_future, operation.get_response())
Expand Down
Loading