diff --git a/awsiot/greengrasscoreipc/client.py b/awsiot/greengrasscoreipc/client.py index f49d3d77..57f936f4 100644 --- a/awsiot/greengrasscoreipc/client.py +++ b/awsiot/greengrasscoreipc/client.py @@ -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 @@ -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 @@ -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. @@ -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. diff --git a/awsiot/greengrasscoreipc/model.py b/awsiot/greengrasscoreipc/model.py index 181fa9ae..b5f5db65 100644 --- a/awsiot/greengrasscoreipc/model.py +++ b/awsiot/greengrasscoreipc/model.py @@ -28,6 +28,62 @@ def is_client_error(self) -> bool: return self._get_error_type_string() == 'client' +class SystemResourceLimits(rpc.Shape): + """ + SystemResourceLimits + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + memory: + cpus: + + Attributes: + memory: + cpus: + """ + + 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 _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 RunWithInfo(rpc.Shape): """ RunWithInfo @@ -36,20 +92,26 @@ class RunWithInfo(rpc.Shape): Keyword Args: posix_user: + system_resource_limits: Attributes: posix_user: + system_resource_limits: """ def __init__(self, *, - posix_user: typing.Optional[str] = None): + posix_user: typing.Optional[str] = None, + system_resource_limits: typing.Optional[SystemResourceLimits] = None): super().__init__() self.posix_user = posix_user # type: typing.Optional[str] + self.system_resource_limits = system_resource_limits # type: typing.Optional[SystemResourceLimits] def _to_payload(self): payload = {} if self.posix_user is not None: payload['posixUser'] = self.posix_user + if self.system_resource_limits is not None: + payload['systemResourceLimits'] = self.system_resource_limits._to_payload() return payload @classmethod @@ -57,6 +119,8 @@ def _from_payload(cls, payload): new = cls() if 'posixUser' in payload: new.posix_user = payload['posixUser'] + if 'systemResourceLimits' in payload: + new.system_resource_limits = SystemResourceLimits._from_payload(payload['systemResourceLimits']) return new @classmethod @@ -1277,11 +1341,11 @@ def _to_payload(self): if self.group_name is not None: payload['groupName'] = self.group_name if self.root_component_versions_to_add is not None: - payload['rootComponentVersionsToAdd'] = self.root_component_versions_to_add + payload['rootComponentVersionsToAdd'] = {k: v for k, v in self.root_component_versions_to_add.items()} if self.root_components_to_remove is not None: payload['rootComponentsToRemove'] = self.root_components_to_remove if self.component_to_configuration is not None: - payload['componentToConfiguration'] = self.component_to_configuration + payload['componentToConfiguration'] = {k: v for k, v in self.component_to_configuration.items()} if self.component_to_run_with_info is not None: payload['componentToRunWithInfo'] = {k: v._to_payload() for k, v in self.component_to_run_with_info.items()} if self.recipe_directory_path is not None: @@ -1326,6 +1390,88 @@ def __eq__(self, other): return False +class PauseComponentResponse(rpc.Shape): + """ + PauseComponentResponse + """ + + def __init__(self): + super().__init__() + + def _to_payload(self): + payload = {} + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#PauseComponentResponse' + + 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 PauseComponentRequest(rpc.Shape): + """ + PauseComponentRequest + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + component_name: + + Attributes: + component_name: + """ + + def __init__(self, *, + component_name: typing.Optional[str] = None): + super().__init__() + self.component_name = component_name # type: typing.Optional[str] + + def _to_payload(self): + payload = {} + if self.component_name is not None: + payload['componentName'] = self.component_name + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'componentName' in payload: + new.component_name = payload['componentName'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#PauseComponentRequest' + + 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 StopComponentResponse(rpc.Shape): """ StopComponentResponse @@ -3733,73 +3879,6 @@ def __eq__(self, other): return False -class ResourceNotFoundError(GreengrassCoreIPCError): - """ - ResourceNotFoundError - - All attributes are None by default, and may be set by keyword in the constructor. - - Keyword Args: - message: - resource_type: - resource_name: - - Attributes: - message: - resource_type: - resource_name: - """ - - def __init__(self, *, - message: typing.Optional[str] = None, - resource_type: typing.Optional[str] = None, - resource_name: typing.Optional[str] = None): - super().__init__() - self.message = message # type: typing.Optional[str] - self.resource_type = resource_type # type: typing.Optional[str] - self.resource_name = resource_name # type: typing.Optional[str] - - def _get_error_type_string(self): - return 'client' - - def _to_payload(self): - payload = {} - if self.message is not None: - payload['message'] = self.message - if self.resource_type is not None: - payload['resourceType'] = self.resource_type - if self.resource_name is not None: - payload['resourceName'] = self.resource_name - return payload - - @classmethod - def _from_payload(cls, payload): - new = cls() - if 'message' in payload: - new.message = payload['message'] - if 'resourceType' in payload: - new.resource_type = payload['resourceType'] - if 'resourceName' in payload: - new.resource_name = payload['resourceName'] - return new - - @classmethod - def _model_name(cls): - return 'aws.greengrass#ResourceNotFoundError' - - 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 SubscribeToConfigurationUpdateResponse(rpc.Shape): """ SubscribeToConfigurationUpdateResponse @@ -3988,6 +4067,155 @@ def __eq__(self, other): return False +class ResourceNotFoundError(GreengrassCoreIPCError): + """ + ResourceNotFoundError + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + message: + resource_type: + resource_name: + + Attributes: + message: + resource_type: + resource_name: + """ + + def __init__(self, *, + message: typing.Optional[str] = None, + resource_type: typing.Optional[str] = None, + resource_name: typing.Optional[str] = None): + super().__init__() + self.message = message # type: typing.Optional[str] + self.resource_type = resource_type # type: typing.Optional[str] + self.resource_name = resource_name # type: typing.Optional[str] + + def _get_error_type_string(self): + return 'client' + + def _to_payload(self): + payload = {} + if self.message is not None: + payload['message'] = self.message + if self.resource_type is not None: + payload['resourceType'] = self.resource_type + if self.resource_name is not None: + payload['resourceName'] = self.resource_name + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'message' in payload: + new.message = payload['message'] + if 'resourceType' in payload: + new.resource_type = payload['resourceType'] + if 'resourceName' in payload: + new.resource_name = payload['resourceName'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#ResourceNotFoundError' + + 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 ResumeComponentResponse(rpc.Shape): + """ + ResumeComponentResponse + """ + + def __init__(self): + super().__init__() + + def _to_payload(self): + payload = {} + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#ResumeComponentResponse' + + 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 ResumeComponentRequest(rpc.Shape): + """ + ResumeComponentRequest + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + component_name: + + Attributes: + component_name: + """ + + def __init__(self, *, + component_name: typing.Optional[str] = None): + super().__init__() + self.component_name = component_name # type: typing.Optional[str] + + def _to_payload(self): + payload = {} + if self.component_name is not None: + payload['componentName'] = self.component_name + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'componentName' in payload: + new.component_name = payload['componentName'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#ResumeComponentRequest' + + 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 UnauthorizedError(GreengrassCoreIPCError): """ UnauthorizedError @@ -4181,6 +4409,7 @@ def __eq__(self, other): SHAPE_INDEX = rpc.ShapeIndex([ + SystemResourceLimits, RunWithInfo, PostComponentUpdateEvent, PreComponentUpdateEvent, @@ -4196,6 +4425,8 @@ def __eq__(self, other): InvalidRecipeDirectoryPathError, CreateLocalDeploymentResponse, CreateLocalDeploymentRequest, + PauseComponentResponse, + PauseComponentRequest, StopComponentResponse, StopComponentRequest, ListLocalDeploymentsResponse, @@ -4245,11 +4476,13 @@ def __eq__(self, other): InvalidArgumentsError, DeleteThingShadowResponse, DeleteThingShadowRequest, - ResourceNotFoundError, SubscribeToConfigurationUpdateResponse, SubscribeToConfigurationUpdateRequest, PublishToIoTCoreResponse, PublishToIoTCoreRequest, + ResourceNotFoundError, + ResumeComponentResponse, + ResumeComponentRequest, UnauthorizedError, ServiceError, SubscribeToIoTCoreResponse, @@ -4279,6 +4512,28 @@ def _response_stream_type(cls): return IoTCoreMessage +class _ResumeComponentOperation(rpc.ClientOperation): + @classmethod + def _model_name(cls): + return 'aws.greengrass#ResumeComponent' + + @classmethod + def _request_type(cls): + return ResumeComponentRequest + + @classmethod + def _request_stream_type(cls): + return None + + @classmethod + def _response_type(cls): + return ResumeComponentResponse + + @classmethod + def _response_stream_type(cls): + return None + + class _PublishToIoTCoreOperation(rpc.ClientOperation): @classmethod def _model_name(cls): @@ -4807,6 +5062,28 @@ def _response_stream_type(cls): return None +class _PauseComponentOperation(rpc.ClientOperation): + @classmethod + def _model_name(cls): + return 'aws.greengrass#PauseComponent' + + @classmethod + def _request_type(cls): + return PauseComponentRequest + + @classmethod + def _request_stream_type(cls): + return None + + @classmethod + def _response_type(cls): + return PauseComponentResponse + + @classmethod + def _response_stream_type(cls): + return None + + class _CreateLocalDeploymentOperation(rpc.ClientOperation): @classmethod def _model_name(cls):