diff --git a/awsiot/greengrasscoreipc/client.py b/awsiot/greengrasscoreipc/client.py index c14c3470..06fa9807 100644 --- a/awsiot/greengrasscoreipc/client.py +++ b/awsiot/greengrasscoreipc/client.py @@ -8,6 +8,40 @@ import concurrent.futures +class AuthorizeClientDeviceActionOperation(model._AuthorizeClientDeviceActionOperation): + """ + AuthorizeClientDeviceActionOperation + + Create with GreengrassCoreIPCClient.new_authorize_client_device_action() + """ + + def activate(self, request: model.AuthorizeClientDeviceActionRequest): # type: (...) -> concurrent.futures.Future[None] + """ + Activate this operation by sending the initial AuthorizeClientDeviceActionRequest 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.AuthorizeClientDeviceActionResponse] + """ + Returns a Future which completes with a result of AuthorizeClientDeviceActionResponse, + 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 @@ -144,6 +178,40 @@ def close(self): # type: (...) -> concurrent.futures.Future[None] return super().close() +class GetClientDeviceAuthTokenOperation(model._GetClientDeviceAuthTokenOperation): + """ + GetClientDeviceAuthTokenOperation + + Create with GreengrassCoreIPCClient.new_get_client_device_auth_token() + """ + + def activate(self, request: model.GetClientDeviceAuthTokenRequest): # type: (...) -> concurrent.futures.Future[None] + """ + Activate this operation by sending the initial GetClientDeviceAuthTokenRequest 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.GetClientDeviceAuthTokenResponse] + """ + Returns a Future which completes with a result of GetClientDeviceAuthTokenResponse, + 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 GetComponentDetailsOperation(model._GetComponentDetailsOperation): """ GetComponentDetailsOperation @@ -654,6 +722,69 @@ def close(self): # type: (...) -> concurrent.futures.Future[None] return super().close() +class SubscribeToCertificateUpdatesStreamHandler(rpc.StreamResponseHandler): + """ + Event handler for SubscribeToCertificateUpdatesOperation + + Inherit from this class and override methods to handle + stream events during a SubscribeToCertificateUpdatesOperation. + """ + + def on_stream_event(self, event: model.CertificateUpdateEvent) -> None: + """ + Invoked when a CertificateUpdateEvent is received. + """ + pass + + def on_stream_error(self, error: Exception) -> bool: + """ + Invoked when an error occurs on the operation stream. + + Return True if operation should close as a result of this error, + """ + return True + + def on_stream_closed(self) -> None: + """ + Invoked when the stream for this operation is closed. + """ + pass + + +class SubscribeToCertificateUpdatesOperation(model._SubscribeToCertificateUpdatesOperation): + """ + SubscribeToCertificateUpdatesOperation + + Create with GreengrassCoreIPCClient.new_subscribe_to_certificate_updates() + """ + + def activate(self, request: model.SubscribeToCertificateUpdatesRequest): # type: (...) -> concurrent.futures.Future[None] + """ + Activate this operation by sending the initial SubscribeToCertificateUpdatesRequest 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.SubscribeToCertificateUpdatesResponse] + """ + Returns a Future which completes with a result of SubscribeToCertificateUpdatesResponse, + 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 SubscribeToComponentUpdatesStreamHandler(rpc.StreamResponseHandler): """ Event handler for SubscribeToComponentUpdatesOperation @@ -1105,10 +1236,44 @@ def close(self): # type: (...) -> concurrent.futures.Future[None] return super().close() +class VerifyClientDeviceIdentityOperation(model._VerifyClientDeviceIdentityOperation): + """ + VerifyClientDeviceIdentityOperation + + Create with GreengrassCoreIPCClient.new_verify_client_device_identity() + """ + + def activate(self, request: model.VerifyClientDeviceIdentityRequest): # type: (...) -> concurrent.futures.Future[None] + """ + Activate this operation by sending the initial VerifyClientDeviceIdentityRequest 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.VerifyClientDeviceIdentityResponse] + """ + Returns a Future which completes with a result of VerifyClientDeviceIdentityResponse, + 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 GreengrassCoreIPCClient(rpc.Client): """ Client for the GreengrassCoreIPC service. - There is a new V2 client available for testing in developer preview. + There is a new V2 client which should be preferred. See the GreengrassCoreIPCClientV2 class in the clientv2 subpackage. Args: @@ -1118,6 +1283,16 @@ class GreengrassCoreIPCClient(rpc.Client): def __init__(self, connection: rpc.Connection): super().__init__(connection, model.SHAPE_INDEX) + def new_authorize_client_device_action(self) -> AuthorizeClientDeviceActionOperation: + """ + Create a new AuthorizeClientDeviceActionOperation. + + 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(AuthorizeClientDeviceActionOperation) + def new_create_debug_password(self) -> CreateDebugPasswordOperation: """ Create a new CreateDebugPasswordOperation. @@ -1158,6 +1333,16 @@ def new_delete_thing_shadow(self) -> DeleteThingShadowOperation: """ return self._new_operation(DeleteThingShadowOperation) + def new_get_client_device_auth_token(self) -> GetClientDeviceAuthTokenOperation: + """ + Create a new GetClientDeviceAuthTokenOperation. + + 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(GetClientDeviceAuthTokenOperation) + def new_get_component_details(self) -> GetComponentDetailsOperation: """ Create a new GetComponentDetailsOperation. @@ -1308,6 +1493,20 @@ def new_stop_component(self) -> StopComponentOperation: """ return self._new_operation(StopComponentOperation) + def new_subscribe_to_certificate_updates(self, stream_handler: SubscribeToCertificateUpdatesStreamHandler) -> SubscribeToCertificateUpdatesOperation: + """ + Create a new SubscribeToCertificateUpdatesOperation. + + 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. + + Args: + stream_handler: Methods on this object will be called as + stream events happen on this operation. + """ + return self._new_operation(SubscribeToCertificateUpdatesOperation, stream_handler) + def new_subscribe_to_component_updates(self, stream_handler: SubscribeToComponentUpdatesStreamHandler) -> SubscribeToComponentUpdatesOperation: """ Create a new SubscribeToComponentUpdatesOperation. @@ -1417,3 +1616,13 @@ def new_validate_authorization_token(self) -> ValidateAuthorizationTokenOperatio events to fire. """ return self._new_operation(ValidateAuthorizationTokenOperation) + + def new_verify_client_device_identity(self) -> VerifyClientDeviceIdentityOperation: + """ + Create a new VerifyClientDeviceIdentityOperation. + + 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(VerifyClientDeviceIdentityOperation) diff --git a/awsiot/greengrasscoreipc/clientv2.py b/awsiot/greengrasscoreipc/clientv2.py index ecb142ff..cab91036 100644 --- a/awsiot/greengrasscoreipc/clientv2.py +++ b/awsiot/greengrasscoreipc/clientv2.py @@ -113,6 +113,37 @@ def __handle_stream_handler(real_self, operation, stream_handler, on_stream_even return real_self.__create_stream_handler(operation, on_stream_event, on_stream_error, on_stream_closed) return stream_handler + def authorize_client_device_action(self, *, + client_device_auth_token: typing.Optional[str] = None, + operation: typing.Optional[str] = None, + resource: typing.Optional[str] = None) -> model.AuthorizeClientDeviceActionResponse: + """ + Perform the AuthorizeClientDeviceAction operation synchronously. + + Args: + client_device_auth_token: + operation: + resource: + """ + return self.authorize_client_device_action_async(client_device_auth_token=client_device_auth_token, operation=operation, resource=resource).result() + + def authorize_client_device_action_async(self, *, + client_device_auth_token: typing.Optional[str] = None, + operation: typing.Optional[str] = None, + resource: typing.Optional[str] = None): # type: (...) -> concurrent.futures.Future[model.AuthorizeClientDeviceActionResponse] + """ + Perform the AuthorizeClientDeviceAction operation asynchronously. + + Args: + client_device_auth_token: + operation: + resource: + """ + request = model.AuthorizeClientDeviceActionRequest(client_device_auth_token=client_device_auth_token, operation=operation, resource=resource) + operation = self.client.new_authorize_client_device_action() + 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. @@ -235,6 +266,29 @@ def delete_thing_shadow_async(self, *, write_future = operation.activate(request) return self.__combine_futures(write_future, operation.get_response()) + def get_client_device_auth_token(self, *, + credential: typing.Optional[model.CredentialDocument] = None) -> model.GetClientDeviceAuthTokenResponse: + """ + Perform the GetClientDeviceAuthToken operation synchronously. + + Args: + credential: + """ + return self.get_client_device_auth_token_async(credential=credential).result() + + def get_client_device_auth_token_async(self, *, + credential: typing.Optional[model.CredentialDocument] = None): # type: (...) -> concurrent.futures.Future[model.GetClientDeviceAuthTokenResponse] + """ + Perform the GetClientDeviceAuthToken operation asynchronously. + + Args: + credential: + """ + request = model.GetClientDeviceAuthTokenRequest(credential=credential) + operation = self.client.new_get_client_device_auth_token() + write_future = operation.activate(request) + return self.__combine_futures(write_future, operation.get_response()) + def get_component_details(self, *, component_name: typing.Optional[str] = None) -> model.GetComponentDetailsResponse: """ @@ -604,6 +658,66 @@ def stop_component_async(self, *, write_future = operation.activate(request) return self.__combine_futures(write_future, operation.get_response()) + def subscribe_to_certificate_updates(self, *, + certificate_options: typing.Optional[model.CertificateOptions] = None, + stream_handler: typing.Optional[client.SubscribeToCertificateUpdatesStreamHandler] = None, + on_stream_event: typing.Optional[typing.Callable[[model.CertificateUpdateEvent], None]] = None, + on_stream_error: typing.Optional[typing.Callable[[Exception], bool]] = None, + on_stream_closed: typing.Optional[typing.Callable[[], None]] = None +) -> typing.Tuple[model.SubscribeToCertificateUpdatesResponse, client.SubscribeToCertificateUpdatesOperation]: + """ + Perform the SubscribeToCertificateUpdates operation synchronously. + The initial response or error will be returned synchronously, further events will arrive via the streaming + callbacks + + Args: + certificate_options: + stream_handler: Methods on this object will be called as stream events happen on this operation. If an + executor is provided, the on_stream_event and on_stream_closed methods will run in the executor. + on_stream_event: Callback for stream events. Mutually exclusive with stream_handler. If an executor is + provided, this method will run in the executor. + on_stream_error: Callback for stream errors. Return true to close the stream, return false to keep the + stream open. Mutually exclusive with stream_handler. Even if an executor is provided, this method + will not run in the executor. + on_stream_closed: Callback for when the stream closes. Mutually exclusive with stream_handler. If an + executor is provided, this method will run in the executor. + """ + (fut, op) = self.subscribe_to_certificate_updates_async(certificate_options=certificate_options, + stream_handler=stream_handler, on_stream_event=on_stream_event, on_stream_error=on_stream_error, + on_stream_closed=on_stream_closed) + return fut.result(), op + + def subscribe_to_certificate_updates_async(self, *, + certificate_options: typing.Optional[model.CertificateOptions] = None, + stream_handler: client.SubscribeToCertificateUpdatesStreamHandler = None, + on_stream_event: typing.Optional[typing.Callable[[model.CertificateUpdateEvent], None]] = None, + on_stream_error: typing.Optional[typing.Callable[[Exception], bool]] = None, + on_stream_closed: typing.Optional[typing.Callable[[], None]] = None + ): # type: (...) -> typing.Tuple[concurrent.futures.Future[model.SubscribeToCertificateUpdatesResponse], client.SubscribeToCertificateUpdatesOperation] + """ + Perform the SubscribeToCertificateUpdates operation asynchronously. + The initial response or error will be returned as the result of the asynchronous future, further events will + arrive via the streaming callbacks + + Args: + certificate_options: + stream_handler: Methods on this object will be called as stream events happen on this operation. If an + executor is provided, the on_stream_event and on_stream_closed methods will run in the executor. + on_stream_event: Callback for stream events. Mutually exclusive with stream_handler. If an executor is + provided, this method will run in the executor. + on_stream_error: Callback for stream errors. Return true to close the stream, return false to keep the + stream open. Mutually exclusive with stream_handler. Even if an executor is provided, this method + will not run in the executor. + on_stream_closed: Callback for when the stream closes. Mutually exclusive with stream_handler. If an + executor is provided, this method will run in the executor. + """ + stream_handler = self.__handle_stream_handler("SubscribeToCertificateUpdates", stream_handler, + on_stream_event, on_stream_error, on_stream_closed) + request = model.SubscribeToCertificateUpdatesRequest(certificate_options=certificate_options) + operation = self.client.new_subscribe_to_certificate_updates(stream_handler) + write_future = operation.activate(request) + return self.__combine_futures(write_future, operation.get_response()), operation + def subscribe_to_component_updates(self, *, stream_handler: typing.Optional[client.SubscribeToComponentUpdatesStreamHandler] = None, on_stream_event: typing.Optional[typing.Callable[[model.ComponentUpdatePolicyEvents], None]] = None, @@ -790,6 +904,7 @@ def subscribe_to_iot_core_async(self, *, def subscribe_to_topic(self, *, topic: typing.Optional[str] = None, + receive_mode: typing.Optional[str] = None, stream_handler: typing.Optional[client.SubscribeToTopicStreamHandler] = None, on_stream_event: typing.Optional[typing.Callable[[model.SubscriptionResponseMessage], None]] = None, on_stream_error: typing.Optional[typing.Callable[[Exception], bool]] = None, @@ -802,6 +917,7 @@ def subscribe_to_topic(self, *, Args: topic: + receive_mode: ReceiveMode enum value stream_handler: Methods on this object will be called as stream events happen on this operation. If an executor is provided, the on_stream_event and on_stream_closed methods will run in the executor. on_stream_event: Callback for stream events. Mutually exclusive with stream_handler. If an executor is @@ -812,13 +928,14 @@ def subscribe_to_topic(self, *, on_stream_closed: Callback for when the stream closes. Mutually exclusive with stream_handler. If an executor is provided, this method will run in the executor. """ - (fut, op) = self.subscribe_to_topic_async(topic=topic, + (fut, op) = self.subscribe_to_topic_async(topic=topic, receive_mode=receive_mode, stream_handler=stream_handler, on_stream_event=on_stream_event, on_stream_error=on_stream_error, on_stream_closed=on_stream_closed) return fut.result(), op def subscribe_to_topic_async(self, *, topic: typing.Optional[str] = None, + receive_mode: typing.Optional[str] = None, stream_handler: client.SubscribeToTopicStreamHandler = None, on_stream_event: typing.Optional[typing.Callable[[model.SubscriptionResponseMessage], None]] = None, on_stream_error: typing.Optional[typing.Callable[[Exception], bool]] = None, @@ -831,6 +948,7 @@ def subscribe_to_topic_async(self, *, Args: topic: + receive_mode: ReceiveMode enum value stream_handler: Methods on this object will be called as stream events happen on this operation. If an executor is provided, the on_stream_event and on_stream_closed methods will run in the executor. on_stream_event: Callback for stream events. Mutually exclusive with stream_handler. If an executor is @@ -843,7 +961,7 @@ def subscribe_to_topic_async(self, *, """ stream_handler = self.__handle_stream_handler("SubscribeToTopic", stream_handler, on_stream_event, on_stream_error, on_stream_closed) - request = model.SubscribeToTopicRequest(topic=topic) + request = model.SubscribeToTopicRequest(topic=topic, receive_mode=receive_mode) operation = self.client.new_subscribe_to_topic(stream_handler) write_future = operation.activate(request) return self.__combine_futures(write_future, operation.get_response()), operation @@ -1011,3 +1129,26 @@ def validate_authorization_token_async(self, *, operation = self.client.new_validate_authorization_token() write_future = operation.activate(request) return self.__combine_futures(write_future, operation.get_response()) + + def verify_client_device_identity(self, *, + credential: typing.Optional[model.ClientDeviceCredential] = None) -> model.VerifyClientDeviceIdentityResponse: + """ + Perform the VerifyClientDeviceIdentity operation synchronously. + + Args: + credential: + """ + return self.verify_client_device_identity_async(credential=credential).result() + + def verify_client_device_identity_async(self, *, + credential: typing.Optional[model.ClientDeviceCredential] = None): # type: (...) -> concurrent.futures.Future[model.VerifyClientDeviceIdentityResponse] + """ + Perform the VerifyClientDeviceIdentity operation asynchronously. + + Args: + credential: + """ + request = model.VerifyClientDeviceIdentityRequest(credential=credential) + operation = self.client.new_verify_client_device_identity() + write_future = operation.activate(request) + return self.__combine_futures(write_future, operation.get_response()) diff --git a/awsiot/greengrasscoreipc/model.py b/awsiot/greengrasscoreipc/model.py index ea262ffa..ca654e72 100644 --- a/awsiot/greengrasscoreipc/model.py +++ b/awsiot/greengrasscoreipc/model.py @@ -93,6 +93,59 @@ def __eq__(self, other): return False +class MessageContext(rpc.Shape): + """ + MessageContext + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + topic: + + Attributes: + topic: + """ + + 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 ValidateConfigurationUpdateEvent(rpc.Shape): """ ValidateConfigurationUpdateEvent @@ -422,6 +475,95 @@ def __eq__(self, other): 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: + certificate_pem: + username: + password: + + Attributes: + client_id: + certificate_pem: + username: + password: + """ + + def __init__(self, *, + client_id: typing.Optional[str] = None, + certificate_pem: typing.Optional[str] = None, + username: typing.Optional[str] = None, + password: typing.Optional[str] = None): + super().__init__() + self.client_id = client_id # type: typing.Optional[str] + self.certificate_pem = certificate_pem # type: typing.Optional[str] + self.username = username # type: typing.Optional[str] + self.password = password # type: typing.Optional[str] + + def set_client_id(self, client_id: str): + self.client_id = client_id + return self + + def set_certificate_pem(self, certificate_pem: str): + self.certificate_pem = certificate_pem + return self + + def set_username(self, username: str): + self.username = username + return self + + def set_password(self, password: str): + self.password = password + return self + + + def _to_payload(self): + payload = {} + if self.client_id is not None: + payload['clientId'] = self.client_id + if self.certificate_pem is not None: + payload['certificatePem'] = self.certificate_pem + if self.username is not None: + payload['username'] = self.username + if self.password is not None: + payload['password'] = self.password + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'clientId' in payload: + new.client_id = payload['clientId'] + if 'certificatePem' in payload: + new.certificate_pem = payload['certificatePem'] + if 'username' in payload: + new.username = payload['username'] + if 'password' in payload: + new.password = payload['password'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#MQTTCredential' + + 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 LifecycleState: """ LifecycleState enum @@ -445,25 +587,35 @@ class JsonMessage(rpc.Shape): Keyword Args: message: + context: The context is ignored if used in PublishMessage. Attributes: message: + context: The context is ignored if used in PublishMessage. """ def __init__(self, *, - message: typing.Optional[typing.Dict[str, typing.Any]] = None): + 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 @@ -471,6 +623,8 @@ 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 @@ -575,6 +729,103 @@ def __eq__(self, other): 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: + public_key: + certificate: + ca_certificates: + + Attributes: + private_key: + public_key: + certificate: + ca_certificates: + """ + + 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 @@ -583,17 +834,21 @@ class BinaryMessage(rpc.Shape): Keyword Args: message: + context: The context is ignored if used in PublishMessage. Attributes: message: + context: The context is ignored if used in PublishMessage. """ def __init__(self, *, - message: typing.Optional[typing.Union[bytes, str]] = None): + 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): @@ -601,11 +856,17 @@ def set_message(self, message: typing.Union[bytes, str]): 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 @@ -613,6 +874,8 @@ 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 @@ -843,6 +1106,15 @@ class ReportedLifecycleState: ERRORED = 'ERRORED' +class ReceiveMode: + """ + ReceiveMode enum + """ + + RECEIVE_ALL_MESSAGES = 'RECEIVE_ALL_MESSAGES' + RECEIVE_MESSAGES_FROM_OTHERS = 'RECEIVE_MESSAGES_FROM_OTHERS' + + class QOS: """ QOS enum @@ -1039,6 +1311,61 @@ def __eq__(self, other): return False +class CredentialDocument(rpc.Shape): + """ + CredentialDocument is a "tagged union" class. + + When sending, only one of the attributes may be set. + When receiving, only one of the attributes will be set. + All other attributes will be None. + + Keyword Args: + mqtt_credential: + + Attributes: + mqtt_credential: + """ + + def __init__(self, *, + mqtt_credential: typing.Optional[MQTTCredential] = None): + super().__init__() + self.mqtt_credential = mqtt_credential # type: typing.Optional[MQTTCredential] + + def set_mqtt_credential(self, mqtt_credential: MQTTCredential): + self.mqtt_credential = mqtt_credential + return self + + + def _to_payload(self): + payload = {} + if self.mqtt_credential is not None: + payload['mqttCredential'] = self.mqtt_credential._to_payload() + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'mqttCredential' in payload: + new.mqtt_credential = MQTTCredential._from_payload(payload['mqttCredential']) + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#CredentialDocument' + + 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 ConfigurationValidityReport(rpc.Shape): """ ConfigurationValidityReport @@ -1327,48 +1654,47 @@ def __eq__(self, other): return False -class InvalidArtifactsDirectoryPathError(GreengrassCoreIPCError): +class ClientDeviceCredential(rpc.Shape): """ - InvalidArtifactsDirectoryPathError + ClientDeviceCredential is a "tagged union" class. - All attributes are None by default, and may be set by keyword in the constructor. + When sending, only one of the attributes may be set. + When receiving, only one of the attributes will be set. + All other attributes will be None. Keyword Args: - message: + client_device_certificate: Attributes: - message: + client_device_certificate: """ def __init__(self, *, - message: typing.Optional[str] = None): + client_device_certificate: typing.Optional[str] = None): super().__init__() - self.message = message # type: typing.Optional[str] + self.client_device_certificate = client_device_certificate # type: typing.Optional[str] - def set_message(self, message: str): - self.message = message + def set_client_device_certificate(self, client_device_certificate: str): + self.client_device_certificate = client_device_certificate return self - 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.client_device_certificate is not None: + payload['clientDeviceCertificate'] = self.client_device_certificate return payload @classmethod def _from_payload(cls, payload): new = cls() - if 'message' in payload: - new.message = payload['message'] + if 'clientDeviceCertificate' in payload: + new.client_device_certificate = payload['clientDeviceCertificate'] return new @classmethod def _model_name(cls): - return 'aws.greengrass#InvalidArtifactsDirectoryPathError' + return 'aws.greengrass#ClientDeviceCredential' def __repr__(self): attrs = [] @@ -1383,43 +1709,207 @@ def __eq__(self, other): return False -class InvalidRecipeDirectoryPathError(GreengrassCoreIPCError): +class CertificateUpdateEvent(rpc.Shape): """ - InvalidRecipeDirectoryPathError + CertificateUpdateEvent is a "tagged union" class. - All attributes are None by default, and may be set by keyword in the constructor. + When sending, only one of the attributes may be set. + When receiving, only one of the attributes will be set. + All other attributes will be None. Keyword Args: - message: + certificate_update: Attributes: - message: + certificate_update: """ def __init__(self, *, - message: typing.Optional[str] = None): + certificate_update: typing.Optional[CertificateUpdate] = None): super().__init__() - self.message = message # type: typing.Optional[str] + self.certificate_update = certificate_update # type: typing.Optional[CertificateUpdate] - def set_message(self, message: str): - self.message = message + def set_certificate_update(self, certificate_update: CertificateUpdate): + self.certificate_update = certificate_update return self - 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.certificate_update is not None: + payload['certificateUpdate'] = self.certificate_update._to_payload() return payload @classmethod def _from_payload(cls, payload): new = cls() - if 'message' in payload: - new.message = payload['message'] + if 'certificateUpdate' in payload: + new.certificate_update = CertificateUpdate._from_payload(payload['certificateUpdate']) + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#CertificateUpdateEvent' + + 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 CertificateOptions(rpc.Shape): + """ + CertificateOptions + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + certificate_type: CertificateType enum value + + Attributes: + certificate_type: CertificateType enum value + """ + + def __init__(self, *, + certificate_type: typing.Optional[str] = None): + super().__init__() + self.certificate_type = certificate_type # type: typing.Optional[str] + + def set_certificate_type(self, certificate_type: str): + self.certificate_type = certificate_type + return self + + + def _to_payload(self): + payload = {} + if self.certificate_type is not None: + payload['certificateType'] = self.certificate_type + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'certificateType' in payload: + new.certificate_type = payload['certificateType'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#CertificateOptions' + + 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 InvalidArtifactsDirectoryPathError(GreengrassCoreIPCError): + """ + InvalidArtifactsDirectoryPathError + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + message: + + Attributes: + message: + """ + + def __init__(self, *, + message: typing.Optional[str] = None): + super().__init__() + self.message = message # type: typing.Optional[str] + + def set_message(self, message: str): + self.message = message + return self + + + def _get_error_type_string(self): + return 'client' + + def _to_payload(self): + payload = {} + if self.message is not None: + payload['message'] = self.message + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'message' in payload: + new.message = payload['message'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#InvalidArtifactsDirectoryPathError' + + 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 InvalidRecipeDirectoryPathError(GreengrassCoreIPCError): + """ + InvalidRecipeDirectoryPathError + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + message: + + Attributes: + message: + """ + + def __init__(self, *, + message: typing.Optional[str] = None): + super().__init__() + self.message = message # type: typing.Optional[str] + + def set_message(self, message: str): + self.message = message + return self + + + def _get_error_type_string(self): + return 'client' + + def _to_payload(self): + payload = {} + if self.message is not None: + payload['message'] = self.message + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'message' in payload: + new.message = payload['message'] return new @classmethod @@ -3371,24 +3861,575 @@ def set_shadow_name(self, shadow_name: str): def _to_payload(self): payload = {} - if self.thing_name is not None: - payload['thingName'] = self.thing_name - if self.shadow_name is not None: - payload['shadowName'] = self.shadow_name + if self.thing_name is not None: + payload['thingName'] = self.thing_name + if self.shadow_name is not None: + payload['shadowName'] = self.shadow_name + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'thingName' in payload: + new.thing_name = payload['thingName'] + if 'shadowName' in payload: + new.shadow_name = payload['shadowName'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#GetThingShadowRequest' + + 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 CreateDebugPasswordResponse(rpc.Shape): + """ + CreateDebugPasswordResponse + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + password: + username: + password_expiration: + certificate_sha256_hash: + certificate_sha1_hash: + + Attributes: + password: + username: + password_expiration: + certificate_sha256_hash: + certificate_sha1_hash: + """ + + def __init__(self, *, + password: typing.Optional[str] = None, + username: typing.Optional[str] = None, + password_expiration: typing.Optional[datetime.datetime] = None, + certificate_sha256_hash: typing.Optional[str] = None, + certificate_sha1_hash: typing.Optional[str] = None): + super().__init__() + self.password = password # type: typing.Optional[str] + self.username = username # type: typing.Optional[str] + self.password_expiration = password_expiration # type: typing.Optional[datetime.datetime] + self.certificate_sha256_hash = certificate_sha256_hash # type: typing.Optional[str] + self.certificate_sha1_hash = certificate_sha1_hash # type: typing.Optional[str] + + def set_password(self, password: str): + self.password = password + return self + + def set_username(self, username: str): + self.username = username + return self + + def set_password_expiration(self, password_expiration: datetime.datetime): + self.password_expiration = password_expiration + return self + + def set_certificate_sha256_hash(self, certificate_sha256_hash: str): + self.certificate_sha256_hash = certificate_sha256_hash + return self + + def set_certificate_sha1_hash(self, certificate_sha1_hash: str): + self.certificate_sha1_hash = certificate_sha1_hash + return self + + + def _to_payload(self): + payload = {} + if self.password is not None: + payload['password'] = self.password + if self.username is not None: + payload['username'] = self.username + if self.password_expiration is not None: + payload['passwordExpiration'] = self.password_expiration.timestamp() + if self.certificate_sha256_hash is not None: + payload['certificateSHA256Hash'] = self.certificate_sha256_hash + if self.certificate_sha1_hash is not None: + payload['certificateSHA1Hash'] = self.certificate_sha1_hash + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'password' in payload: + new.password = payload['password'] + if 'username' in payload: + new.username = payload['username'] + if 'passwordExpiration' in payload: + new.password_expiration = datetime.datetime.fromtimestamp(payload['passwordExpiration'], datetime.timezone.utc) + if 'certificateSHA256Hash' in payload: + new.certificate_sha256_hash = payload['certificateSHA256Hash'] + if 'certificateSHA1Hash' in payload: + new.certificate_sha1_hash = payload['certificateSHA1Hash'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#CreateDebugPasswordResponse' + + 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 CreateDebugPasswordRequest(rpc.Shape): + """ + CreateDebugPasswordRequest + """ + + 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#CreateDebugPasswordRequest' + + 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 ListComponentsResponse(rpc.Shape): + """ + ListComponentsResponse + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + components: + + Attributes: + components: + """ + + def __init__(self, *, + components: typing.Optional[typing.List[ComponentDetails]] = None): + super().__init__() + self.components = components # type: typing.Optional[typing.List[ComponentDetails]] + + def set_components(self, components: typing.List[ComponentDetails]): + self.components = components + return self + + + def _to_payload(self): + payload = {} + if self.components is not None: + payload['components'] = [i._to_payload() for i in self.components] + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'components' in payload: + new.components = [ComponentDetails._from_payload(i) for i in payload['components']] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#ListComponentsResponse' + + 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 ListComponentsRequest(rpc.Shape): + """ + ListComponentsRequest + """ + + 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#ListComponentsRequest' + + 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 InvalidClientDeviceAuthTokenError(GreengrassCoreIPCError): + """ + InvalidClientDeviceAuthTokenError + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + message: + + Attributes: + message: + """ + + def __init__(self, *, + message: typing.Optional[str] = None): + super().__init__() + self.message = message # type: typing.Optional[str] + + def set_message(self, message: str): + self.message = message + return self + + + def _get_error_type_string(self): + return 'client' + + def _to_payload(self): + payload = {} + if self.message is not None: + payload['message'] = self.message + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'message' in payload: + new.message = payload['message'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#InvalidClientDeviceAuthTokenError' + + 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 AuthorizeClientDeviceActionResponse(rpc.Shape): + """ + AuthorizeClientDeviceActionResponse + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + is_authorized: + + Attributes: + is_authorized: + """ + + def __init__(self, *, + is_authorized: typing.Optional[bool] = None): + super().__init__() + self.is_authorized = is_authorized # type: typing.Optional[bool] + + def set_is_authorized(self, is_authorized: bool): + self.is_authorized = is_authorized + return self + + + def _to_payload(self): + payload = {} + if self.is_authorized is not None: + payload['isAuthorized'] = self.is_authorized + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'isAuthorized' in payload: + new.is_authorized = payload['isAuthorized'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#AuthorizeClientDeviceActionResponse' + + 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 AuthorizeClientDeviceActionRequest(rpc.Shape): + """ + AuthorizeClientDeviceActionRequest + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + client_device_auth_token: + operation: + resource: + + Attributes: + client_device_auth_token: + operation: + resource: + """ + + def __init__(self, *, + client_device_auth_token: typing.Optional[str] = None, + operation: typing.Optional[str] = None, + resource: typing.Optional[str] = None): + super().__init__() + self.client_device_auth_token = client_device_auth_token # type: typing.Optional[str] + self.operation = operation # type: typing.Optional[str] + self.resource = resource # type: typing.Optional[str] + + def set_client_device_auth_token(self, client_device_auth_token: str): + self.client_device_auth_token = client_device_auth_token + return self + + def set_operation(self, operation: str): + self.operation = operation + return self + + def set_resource(self, resource: str): + self.resource = resource + return self + + + def _to_payload(self): + payload = {} + if self.client_device_auth_token is not None: + payload['clientDeviceAuthToken'] = self.client_device_auth_token + if self.operation is not None: + payload['operation'] = self.operation + if self.resource is not None: + payload['resource'] = self.resource + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'clientDeviceAuthToken' in payload: + new.client_device_auth_token = payload['clientDeviceAuthToken'] + if 'operation' in payload: + new.operation = payload['operation'] + if 'resource' in payload: + new.resource = payload['resource'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#AuthorizeClientDeviceActionRequest' + + 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 VerifyClientDeviceIdentityResponse(rpc.Shape): + """ + VerifyClientDeviceIdentityResponse + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + is_valid_client_device: + + Attributes: + is_valid_client_device: + """ + + def __init__(self, *, + is_valid_client_device: typing.Optional[bool] = None): + super().__init__() + self.is_valid_client_device = is_valid_client_device # type: typing.Optional[bool] + + def set_is_valid_client_device(self, is_valid_client_device: bool): + self.is_valid_client_device = is_valid_client_device + return self + + + def _to_payload(self): + payload = {} + if self.is_valid_client_device is not None: + payload['isValidClientDevice'] = self.is_valid_client_device + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'isValidClientDevice' in payload: + new.is_valid_client_device = payload['isValidClientDevice'] + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#VerifyClientDeviceIdentityResponse' + + 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 VerifyClientDeviceIdentityRequest(rpc.Shape): + """ + VerifyClientDeviceIdentityRequest + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + credential: + + Attributes: + credential: + """ + + def __init__(self, *, + credential: typing.Optional[ClientDeviceCredential] = None): + super().__init__() + self.credential = credential # type: typing.Optional[ClientDeviceCredential] + + def set_credential(self, credential: ClientDeviceCredential): + self.credential = credential + return self + + + def _to_payload(self): + payload = {} + if self.credential is not None: + payload['credential'] = self.credential._to_payload() + return payload + + @classmethod + def _from_payload(cls, payload): + new = cls() + if 'credential' in payload: + new.credential = ClientDeviceCredential._from_payload(payload['credential']) + return new + + @classmethod + def _model_name(cls): + return 'aws.greengrass#VerifyClientDeviceIdentityRequest' + + 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 SubscribeToCertificateUpdatesResponse(rpc.Shape): + """ + SubscribeToCertificateUpdatesResponse + """ + + def __init__(self): + super().__init__() + + + def _to_payload(self): + payload = {} return payload @classmethod def _from_payload(cls, payload): new = cls() - if 'thingName' in payload: - new.thing_name = payload['thingName'] - if 'shadowName' in payload: - new.shadow_name = payload['shadowName'] return new @classmethod def _model_name(cls): - return 'aws.greengrass#GetThingShadowRequest' + return 'aws.greengrass#SubscribeToCertificateUpdatesResponse' def __repr__(self): attrs = [] @@ -3403,93 +4444,45 @@ def __eq__(self, other): return False -class CreateDebugPasswordResponse(rpc.Shape): +class SubscribeToCertificateUpdatesRequest(rpc.Shape): """ - CreateDebugPasswordResponse + SubscribeToCertificateUpdatesRequest All attributes are None by default, and may be set by keyword in the constructor. Keyword Args: - password: - username: - password_expiration: - certificate_sha256_hash: - certificate_sha1_hash: + certificate_options: Attributes: - password: - username: - password_expiration: - certificate_sha256_hash: - certificate_sha1_hash: + certificate_options: """ def __init__(self, *, - password: typing.Optional[str] = None, - username: typing.Optional[str] = None, - password_expiration: typing.Optional[datetime.datetime] = None, - certificate_sha256_hash: typing.Optional[str] = None, - certificate_sha1_hash: typing.Optional[str] = None): + certificate_options: typing.Optional[CertificateOptions] = None): super().__init__() - self.password = password # type: typing.Optional[str] - self.username = username # type: typing.Optional[str] - self.password_expiration = password_expiration # type: typing.Optional[datetime.datetime] - self.certificate_sha256_hash = certificate_sha256_hash # type: typing.Optional[str] - self.certificate_sha1_hash = certificate_sha1_hash # type: typing.Optional[str] + self.certificate_options = certificate_options # type: typing.Optional[CertificateOptions] - def set_password(self, password: str): - self.password = password - return self - - def set_username(self, username: str): - self.username = username - return self - - def set_password_expiration(self, password_expiration: datetime.datetime): - self.password_expiration = password_expiration - return self - - def set_certificate_sha256_hash(self, certificate_sha256_hash: str): - self.certificate_sha256_hash = certificate_sha256_hash - return self - - def set_certificate_sha1_hash(self, certificate_sha1_hash: str): - self.certificate_sha1_hash = certificate_sha1_hash + def set_certificate_options(self, certificate_options: CertificateOptions): + self.certificate_options = certificate_options return self def _to_payload(self): payload = {} - if self.password is not None: - payload['password'] = self.password - if self.username is not None: - payload['username'] = self.username - if self.password_expiration is not None: - payload['passwordExpiration'] = self.password_expiration.timestamp() - if self.certificate_sha256_hash is not None: - payload['certificateSHA256Hash'] = self.certificate_sha256_hash - if self.certificate_sha1_hash is not None: - payload['certificateSHA1Hash'] = self.certificate_sha1_hash + if self.certificate_options is not None: + payload['certificateOptions'] = self.certificate_options._to_payload() return payload @classmethod def _from_payload(cls, payload): new = cls() - if 'password' in payload: - new.password = payload['password'] - if 'username' in payload: - new.username = payload['username'] - if 'passwordExpiration' in payload: - new.password_expiration = datetime.datetime.fromtimestamp(payload['passwordExpiration'], datetime.timezone.utc) - if 'certificateSHA256Hash' in payload: - new.certificate_sha256_hash = payload['certificateSHA256Hash'] - if 'certificateSHA1Hash' in payload: - new.certificate_sha1_hash = payload['certificateSHA1Hash'] + if 'certificateOptions' in payload: + new.certificate_options = CertificateOptions._from_payload(payload['certificateOptions']) return new @classmethod def _model_name(cls): - return 'aws.greengrass#CreateDebugPasswordResponse' + return 'aws.greengrass#SubscribeToCertificateUpdatesRequest' def __repr__(self): attrs = [] @@ -3504,9 +4497,9 @@ def __eq__(self, other): return False -class CreateDebugPasswordRequest(rpc.Shape): +class PublishToTopicResponse(rpc.Shape): """ - CreateDebugPasswordRequest + PublishToTopicResponse """ def __init__(self): @@ -3524,7 +4517,7 @@ def _from_payload(cls, payload): @classmethod def _model_name(cls): - return 'aws.greengrass#CreateDebugPasswordRequest' + return 'aws.greengrass#PublishToTopicResponse' def __repr__(self): attrs = [] @@ -3539,45 +4532,57 @@ def __eq__(self, other): return False -class ListComponentsResponse(rpc.Shape): +class PublishToTopicRequest(rpc.Shape): """ - ListComponentsResponse + PublishToTopicRequest All attributes are None by default, and may be set by keyword in the constructor. Keyword Args: - components: + topic: + publish_message: Attributes: - components: + topic: + publish_message: """ def __init__(self, *, - components: typing.Optional[typing.List[ComponentDetails]] = None): + topic: typing.Optional[str] = None, + publish_message: typing.Optional[PublishMessage] = None): super().__init__() - self.components = components # type: typing.Optional[typing.List[ComponentDetails]] + self.topic = topic # type: typing.Optional[str] + self.publish_message = publish_message # type: typing.Optional[PublishMessage] - def set_components(self, components: typing.List[ComponentDetails]): - self.components = components + def set_topic(self, topic: str): + self.topic = topic + return self + + def set_publish_message(self, publish_message: PublishMessage): + self.publish_message = publish_message return self def _to_payload(self): payload = {} - if self.components is not None: - payload['components'] = [i._to_payload() for i in self.components] + if self.topic is not None: + payload['topic'] = self.topic + if self.publish_message is not None: + payload['publishMessage'] = self.publish_message._to_payload() return payload @classmethod def _from_payload(cls, payload): new = cls() - if 'components' in payload: - new.components = [ComponentDetails._from_payload(i) for i in payload['components']] + if 'topic' in payload: + new.topic = payload['topic'] + if 'publishMessage' in payload: + new.publish_message = PublishMessage._from_payload(payload['publishMessage']) return new @classmethod def _model_name(cls): - return 'aws.greengrass#ListComponentsResponse' + return 'aws.greengrass#PublishToTopicRequest' def __repr__(self): attrs = [] @@ -3592,27 +4597,48 @@ def __eq__(self, other): return False -class ListComponentsRequest(rpc.Shape): +class InvalidCredentialError(GreengrassCoreIPCError): """ - ListComponentsRequest + InvalidCredentialError + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + message: + + Attributes: + message: """ - def __init__(self): + def __init__(self, *, + message: typing.Optional[str] = None): super().__init__() + self.message = message # type: typing.Optional[str] + + def set_message(self, message: str): + self.message = message + return self + + def _get_error_type_string(self): + return 'client' def _to_payload(self): payload = {} + if self.message is not None: + payload['message'] = self.message return payload @classmethod def _from_payload(cls, payload): new = cls() + if 'message' in payload: + new.message = payload['message'] return new @classmethod def _model_name(cls): - return 'aws.greengrass#ListComponentsRequest' + return 'aws.greengrass#InvalidCredentialError' def __repr__(self): attrs = [] @@ -3627,27 +4653,45 @@ def __eq__(self, other): return False -class PublishToTopicResponse(rpc.Shape): +class GetClientDeviceAuthTokenResponse(rpc.Shape): """ - PublishToTopicResponse + GetClientDeviceAuthTokenResponse + + All attributes are None by default, and may be set by keyword in the constructor. + + Keyword Args: + client_device_auth_token: + + Attributes: + client_device_auth_token: """ - def __init__(self): + def __init__(self, *, + client_device_auth_token: typing.Optional[str] = None): super().__init__() + self.client_device_auth_token = client_device_auth_token # type: typing.Optional[str] + + def set_client_device_auth_token(self, client_device_auth_token: str): + self.client_device_auth_token = client_device_auth_token + return self def _to_payload(self): payload = {} + if self.client_device_auth_token is not None: + payload['clientDeviceAuthToken'] = self.client_device_auth_token return payload @classmethod def _from_payload(cls, payload): new = cls() + if 'clientDeviceAuthToken' in payload: + new.client_device_auth_token = payload['clientDeviceAuthToken'] return new @classmethod def _model_name(cls): - return 'aws.greengrass#PublishToTopicResponse' + return 'aws.greengrass#GetClientDeviceAuthTokenResponse' def __repr__(self): attrs = [] @@ -3662,57 +4706,45 @@ def __eq__(self, other): return False -class PublishToTopicRequest(rpc.Shape): +class GetClientDeviceAuthTokenRequest(rpc.Shape): """ - PublishToTopicRequest + GetClientDeviceAuthTokenRequest All attributes are None by default, and may be set by keyword in the constructor. Keyword Args: - topic: - publish_message: + credential: Attributes: - topic: - publish_message: + credential: """ def __init__(self, *, - topic: typing.Optional[str] = None, - publish_message: typing.Optional[PublishMessage] = None): + credential: typing.Optional[CredentialDocument] = None): super().__init__() - self.topic = topic # type: typing.Optional[str] - self.publish_message = publish_message # type: typing.Optional[PublishMessage] - - def set_topic(self, topic: str): - self.topic = topic - return self + self.credential = credential # type: typing.Optional[CredentialDocument] - def set_publish_message(self, publish_message: PublishMessage): - self.publish_message = publish_message + def set_credential(self, credential: CredentialDocument): + self.credential = credential return self def _to_payload(self): payload = {} - if self.topic is not None: - payload['topic'] = self.topic - if self.publish_message is not None: - payload['publishMessage'] = self.publish_message._to_payload() + if self.credential is not None: + payload['credential'] = self.credential._to_payload() return payload @classmethod def _from_payload(cls, payload): new = cls() - if 'topic' in payload: - new.topic = payload['topic'] - if 'publishMessage' in payload: - new.publish_message = PublishMessage._from_payload(payload['publishMessage']) + if 'credential' in payload: + new.credential = CredentialDocument._from_payload(payload['credential']) return new @classmethod def _model_name(cls): - return 'aws.greengrass#PublishToTopicRequest' + return 'aws.greengrass#GetClientDeviceAuthTokenRequest' def __repr__(self): attrs = [] @@ -3840,10 +4872,10 @@ class SubscribeToTopicResponse(rpc.Shape): All attributes are None by default, and may be set by keyword in the constructor. Keyword Args: - topic_name: + topic_name: Deprecated No longer used Attributes: - topic_name: + topic_name: Deprecated No longer used """ def __init__(self, *, @@ -3894,25 +4926,35 @@ class SubscribeToTopicRequest(rpc.Shape): Keyword Args: topic: + receive_mode: ReceiveMode enum value Attributes: topic: + receive_mode: ReceiveMode enum value """ def __init__(self, *, - topic: typing.Optional[str] = None): + topic: typing.Optional[str] = None, + receive_mode: typing.Optional[str] = None): super().__init__() self.topic = topic # type: typing.Optional[str] + self.receive_mode = receive_mode # type: typing.Optional[str] def set_topic(self, topic: str): self.topic = topic return self + def set_receive_mode(self, receive_mode: str): + self.receive_mode = receive_mode + return self + def _to_payload(self): payload = {} if self.topic is not None: payload['topic'] = self.topic + if self.receive_mode is not None: + payload['receiveMode'] = self.receive_mode return payload @classmethod @@ -3920,6 +4962,8 @@ def _from_payload(cls, payload): new = cls() if 'topic' in payload: new.topic = payload['topic'] + if 'receiveMode' in payload: + new.receive_mode = payload['receiveMode'] return new @classmethod @@ -5027,17 +6071,21 @@ def __eq__(self, other): SHAPE_INDEX = rpc.ShapeIndex([ SystemResourceLimits, + MessageContext, ValidateConfigurationUpdateEvent, RunWithInfo, PreComponentUpdateEvent, PostComponentUpdateEvent, MQTTMessage, + MQTTCredential, JsonMessage, ConfigurationUpdateEvent, + CertificateUpdate, BinaryMessage, LocalDeployment, ConfigurationValidityReport, ComponentDetails, + CertificateOptions, InvalidArtifactsDirectoryPathError, InvalidRecipeDirectoryPathError, CreateLocalDeploymentResponse, @@ -5078,8 +6126,18 @@ def __eq__(self, other): CreateDebugPasswordRequest, ListComponentsResponse, ListComponentsRequest, + InvalidClientDeviceAuthTokenError, + AuthorizeClientDeviceActionResponse, + AuthorizeClientDeviceActionRequest, + VerifyClientDeviceIdentityResponse, + VerifyClientDeviceIdentityRequest, + SubscribeToCertificateUpdatesResponse, + SubscribeToCertificateUpdatesRequest, PublishToTopicResponse, PublishToTopicRequest, + InvalidCredentialError, + GetClientDeviceAuthTokenResponse, + GetClientDeviceAuthTokenRequest, GetComponentDetailsResponse, GetComponentDetailsRequest, SubscribeToTopicResponse, @@ -5107,6 +6165,28 @@ def __eq__(self, other): ]) +class _AuthorizeClientDeviceActionOperation(rpc.ClientOperation): + @classmethod + def _model_name(cls): + return 'aws.greengrass#AuthorizeClientDeviceAction' + + @classmethod + def _request_type(cls): + return AuthorizeClientDeviceActionRequest + + @classmethod + def _request_stream_type(cls): + return None + + @classmethod + def _response_type(cls): + return AuthorizeClientDeviceActionResponse + + @classmethod + def _response_stream_type(cls): + return None + + class _CreateDebugPasswordOperation(rpc.ClientOperation): @classmethod def _model_name(cls): @@ -5195,6 +6275,28 @@ def _response_stream_type(cls): return None +class _GetClientDeviceAuthTokenOperation(rpc.ClientOperation): + @classmethod + def _model_name(cls): + return 'aws.greengrass#GetClientDeviceAuthToken' + + @classmethod + def _request_type(cls): + return GetClientDeviceAuthTokenRequest + + @classmethod + def _request_stream_type(cls): + return None + + @classmethod + def _response_type(cls): + return GetClientDeviceAuthTokenResponse + + @classmethod + def _response_stream_type(cls): + return None + + class _GetComponentDetailsOperation(rpc.ClientOperation): @classmethod def _model_name(cls): @@ -5525,6 +6627,28 @@ def _response_stream_type(cls): return None +class _SubscribeToCertificateUpdatesOperation(rpc.ClientOperation): + @classmethod + def _model_name(cls): + return 'aws.greengrass#SubscribeToCertificateUpdates' + + @classmethod + def _request_type(cls): + return SubscribeToCertificateUpdatesRequest + + @classmethod + def _request_stream_type(cls): + return None + + @classmethod + def _response_type(cls): + return SubscribeToCertificateUpdatesResponse + + @classmethod + def _response_stream_type(cls): + return CertificateUpdateEvent + + class _SubscribeToComponentUpdatesOperation(rpc.ClientOperation): @classmethod def _model_name(cls): @@ -5721,3 +6845,25 @@ def _response_type(cls): @classmethod def _response_stream_type(cls): return None + + +class _VerifyClientDeviceIdentityOperation(rpc.ClientOperation): + @classmethod + def _model_name(cls): + return 'aws.greengrass#VerifyClientDeviceIdentity' + + @classmethod + def _request_type(cls): + return VerifyClientDeviceIdentityRequest + + @classmethod + def _request_stream_type(cls): + return None + + @classmethod + def _response_type(cls): + return VerifyClientDeviceIdentityResponse + + @classmethod + def _response_stream_type(cls): + return None diff --git a/test/echotestrpc/client.py b/test/echotestrpc/client.py index 612e6a41..1756e7ea 100644 --- a/test/echotestrpc/client.py +++ b/test/echotestrpc/client.py @@ -15,7 +15,7 @@ class CauseServiceErrorOperation(model._CauseServiceErrorOperation): Create with EchoTestRPCClient.new_cause_service_error() """ - def activate(self, request: model.CauseServiceErrorRequest) -> concurrent.futures.Future: + def activate(self, request: model.CauseServiceErrorRequest): # type: (...) -> concurrent.futures.Future[None] """ Activate this operation by sending the initial CauseServiceErrorRequest message. @@ -25,14 +25,14 @@ def activate(self, request: model.CauseServiceErrorRequest) -> concurrent.future """ return self._activate(request) - def get_response(self) -> concurrent.futures.Future: + def get_response(self): # type: (...) -> concurrent.futures.Future[model.CauseServiceErrorResponse] """ Returns a Future which completes with a result of CauseServiceErrorResponse, when the initial response is received, or an exception. """ return self._get_response() - def close(self) -> concurrent.futures.Future: + def close(self): # type: (...) -> concurrent.futures.Future[None] """ Close the operation, whether or not it has completed. @@ -78,7 +78,7 @@ class CauseStreamServiceToErrorOperation(model._CauseStreamServiceToErrorOperati Create with EchoTestRPCClient.new_cause_stream_service_to_error() """ - def activate(self, request: model.EchoStreamingRequest) -> concurrent.futures.Future: + def activate(self, request: model.EchoStreamingRequest): # type: (...) -> concurrent.futures.Future[None] """ Activate this operation by sending the initial EchoStreamingRequest message. @@ -100,14 +100,14 @@ def send_stream_event(self, event: model.EchoStreamingMessage) -> concurrent.fut """ return self._send_stream_event(event) - def get_response(self) -> concurrent.futures.Future: + def get_response(self): # type: (...) -> concurrent.futures.Future[model.EchoStreamingResponse] """ Returns a Future which completes with a result of EchoStreamingResponse, when the initial response is received, or an exception. """ return self._get_response() - def close(self) -> concurrent.futures.Future: + def close(self): # type: (...) -> concurrent.futures.Future[None] """ Close the operation, whether or not it has completed. @@ -124,7 +124,7 @@ class EchoMessageOperation(model._EchoMessageOperation): Create with EchoTestRPCClient.new_echo_message() """ - def activate(self, request: model.EchoMessageRequest) -> concurrent.futures.Future: + def activate(self, request: model.EchoMessageRequest): # type: (...) -> concurrent.futures.Future[None] """ Activate this operation by sending the initial EchoMessageRequest message. @@ -134,14 +134,14 @@ def activate(self, request: model.EchoMessageRequest) -> concurrent.futures.Futu """ return self._activate(request) - def get_response(self) -> concurrent.futures.Future: + def get_response(self): # type: (...) -> concurrent.futures.Future[model.EchoMessageResponse] """ Returns a Future which completes with a result of EchoMessageResponse, when the initial response is received, or an exception. """ return self._get_response() - def close(self) -> concurrent.futures.Future: + def close(self): # type: (...) -> concurrent.futures.Future[None] """ Close the operation, whether or not it has completed. @@ -187,7 +187,7 @@ class EchoStreamMessagesOperation(model._EchoStreamMessagesOperation): Create with EchoTestRPCClient.new_echo_stream_messages() """ - def activate(self, request: model.EchoStreamingRequest) -> concurrent.futures.Future: + def activate(self, request: model.EchoStreamingRequest): # type: (...) -> concurrent.futures.Future[None] """ Activate this operation by sending the initial EchoStreamingRequest message. @@ -209,14 +209,14 @@ def send_stream_event(self, event: model.EchoStreamingMessage) -> concurrent.fut """ return self._send_stream_event(event) - def get_response(self) -> concurrent.futures.Future: + def get_response(self): # type: (...) -> concurrent.futures.Future[model.EchoStreamingResponse] """ Returns a Future which completes with a result of EchoStreamingResponse, when the initial response is received, or an exception. """ return self._get_response() - def close(self) -> concurrent.futures.Future: + def close(self): # type: (...) -> concurrent.futures.Future[None] """ Close the operation, whether or not it has completed. @@ -233,7 +233,7 @@ class GetAllCustomersOperation(model._GetAllCustomersOperation): Create with EchoTestRPCClient.new_get_all_customers() """ - def activate(self, request: model.GetAllCustomersRequest) -> concurrent.futures.Future: + def activate(self, request: model.GetAllCustomersRequest): # type: (...) -> concurrent.futures.Future[None] """ Activate this operation by sending the initial GetAllCustomersRequest message. @@ -243,14 +243,14 @@ def activate(self, request: model.GetAllCustomersRequest) -> concurrent.futures. """ return self._activate(request) - def get_response(self) -> concurrent.futures.Future: + def get_response(self): # type: (...) -> concurrent.futures.Future[model.GetAllCustomersResponse] """ Returns a Future which completes with a result of GetAllCustomersResponse, when the initial response is received, or an exception. """ return self._get_response() - def close(self) -> concurrent.futures.Future: + def close(self): # type: (...) -> concurrent.futures.Future[None] """ Close the operation, whether or not it has completed. @@ -267,7 +267,7 @@ class GetAllProductsOperation(model._GetAllProductsOperation): Create with EchoTestRPCClient.new_get_all_products() """ - def activate(self, request: model.GetAllProductsRequest) -> concurrent.futures.Future: + def activate(self, request: model.GetAllProductsRequest): # type: (...) -> concurrent.futures.Future[None] """ Activate this operation by sending the initial GetAllProductsRequest message. @@ -277,14 +277,14 @@ def activate(self, request: model.GetAllProductsRequest) -> concurrent.futures.F """ return self._activate(request) - def get_response(self) -> concurrent.futures.Future: + def get_response(self): # type: (...) -> concurrent.futures.Future[model.GetAllProductsResponse] """ Returns a Future which completes with a result of GetAllProductsResponse, when the initial response is received, or an exception. """ return self._get_response() - def close(self) -> concurrent.futures.Future: + def close(self): # type: (...) -> concurrent.futures.Future[None] """ Close the operation, whether or not it has completed. @@ -297,7 +297,6 @@ def close(self) -> concurrent.futures.Future: class EchoTestRPCClient(rpc.Client): """ Client for the EchoTestRPC service. - Args: connection: Connection that this client will use. """ diff --git a/test/echotestrpc/model.py b/test/echotestrpc/model.py index 35ea37d9..9d4efbf6 100644 --- a/test/echotestrpc/model.py +++ b/test/echotestrpc/model.py @@ -50,6 +50,15 @@ def __init__(self, *, self.name = name # type: typing.Optional[str] self.price = price # type: typing.Optional[float] + def set_name(self, name: str): + self.name = name + return self + + def set_price(self, price: float): + self.price = price + return self + + def _to_payload(self): payload = {} if self.name is not None: @@ -106,6 +115,15 @@ def __init__(self, *, 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: @@ -177,6 +195,19 @@ def __init__(self, *, self.first_name = first_name # type: typing.Optional[str] self.last_name = last_name # type: typing.Optional[str] + def set_id(self, id: int): + self.id = id + return self + + def set_first_name(self, first_name: str): + self.first_name = first_name + return self + + def set_last_name(self, last_name: str): + self.last_name = last_name + return self + + def _to_payload(self): payload = {} if self.id is not None: @@ -250,7 +281,7 @@ def __init__(self, *, time_message: typing.Optional[datetime.datetime] = None, document_message: typing.Optional[typing.Dict[str, typing.Any]] = None, enum_message: typing.Optional[str] = None, - blob_message: typing.Optional[bytes] = None, + blob_message: typing.Optional[typing.Union[bytes, str]] = None, string_list_message: typing.Optional[typing.List[str]] = None, key_value_pair_list: typing.Optional[typing.List[Pair]] = None, string_to_value: typing.Optional[typing.Dict[str, Product]] = None): @@ -260,11 +291,52 @@ def __init__(self, *, self.time_message = time_message # type: typing.Optional[datetime.datetime] self.document_message = document_message # type: typing.Optional[typing.Dict[str, typing.Any]] self.enum_message = enum_message # type: typing.Optional[str] + if blob_message is not None and isinstance(blob_message, str): + blob_message = blob_message.encode('utf-8') self.blob_message = blob_message # type: typing.Optional[bytes] self.string_list_message = string_list_message # type: typing.Optional[typing.List[str]] self.key_value_pair_list = key_value_pair_list # type: typing.Optional[typing.List[Pair]] self.string_to_value = string_to_value # type: typing.Optional[typing.Dict[str, Product]] + def set_string_message(self, string_message: str): + self.string_message = string_message + return self + + def set_boolean_message(self, boolean_message: bool): + self.boolean_message = boolean_message + return self + + def set_time_message(self, time_message: datetime.datetime): + self.time_message = time_message + return self + + def set_document_message(self, document_message: typing.Dict[str, typing.Any]): + self.document_message = document_message + return self + + def set_enum_message(self, enum_message: str): + self.enum_message = enum_message + return self + + def set_blob_message(self, blob_message: typing.Union[bytes, str]): + if blob_message is not None and isinstance(blob_message, str): + blob_message = blob_message.encode('utf-8') + self.blob_message = blob_message + return self + + def set_string_list_message(self, string_list_message: typing.List[str]): + self.string_list_message = string_list_message + return self + + def set_key_value_pair_list(self, key_value_pair_list: typing.List[Pair]): + self.key_value_pair_list = key_value_pair_list + return self + + def set_string_to_value(self, string_to_value: typing.Dict[str, Product]): + self.string_to_value = string_to_value + return self + + def _to_payload(self): payload = {} if self.string_message is not None: @@ -329,7 +401,7 @@ def __eq__(self, other): class EchoStreamingMessage(rpc.Shape): """ - MessageData is a "tagged union" class. + EchoStreamingMessage is a "tagged union" class. When sending, only one of the attributes may be set. When receiving, only one of the attributes will be set. @@ -351,6 +423,15 @@ def __init__(self, *, self.stream_message = stream_message # type: typing.Optional[MessageData] self.key_value_pair = key_value_pair # type: typing.Optional[Pair] + def set_stream_message(self, stream_message: MessageData): + self.stream_message = stream_message + return self + + def set_key_value_pair(self, key_value_pair: Pair): + self.key_value_pair = key_value_pair + return self + + def _to_payload(self): payload = {} if self.stream_message is not None: @@ -403,6 +484,11 @@ def __init__(self, *, super().__init__() self.customers = customers # type: typing.Optional[typing.List[Customer]] + def set_customers(self, customers: typing.List[Customer]): + self.customers = customers + return self + + def _to_payload(self): payload = {} if self.customers is not None: @@ -441,6 +527,7 @@ class GetAllCustomersRequest(rpc.Shape): def __init__(self): super().__init__() + def _to_payload(self): payload = {} return payload @@ -485,6 +572,11 @@ def __init__(self, *, super().__init__() self.message = message # type: typing.Optional[MessageData] + def set_message(self, message: MessageData): + self.message = message + return self + + def _to_payload(self): payload = {} if self.message is not None: @@ -533,6 +625,11 @@ def __init__(self, *, super().__init__() self.message = message # type: typing.Optional[MessageData] + def set_message(self, message: MessageData): + self.message = message + return self + + def _to_payload(self): payload = {} if self.message is not None: @@ -571,6 +668,7 @@ class EchoStreamingResponse(rpc.Shape): def __init__(self): super().__init__() + def _to_payload(self): payload = {} return payload @@ -605,6 +703,7 @@ class EchoStreamingRequest(rpc.Shape): def __init__(self): super().__init__() + def _to_payload(self): payload = {} return payload @@ -639,6 +738,7 @@ class CauseServiceErrorResponse(rpc.Shape): def __init__(self): super().__init__() + def _to_payload(self): payload = {} return payload @@ -673,6 +773,7 @@ class CauseServiceErrorRequest(rpc.Shape): def __init__(self): super().__init__() + def _to_payload(self): payload = {} return payload @@ -721,6 +822,15 @@ def __init__(self, *, self.message = message # type: typing.Optional[str] self.value = value # type: typing.Optional[str] + def set_message(self, message: str): + self.message = message + return self + + def set_value(self, value: str): + self.value = value + return self + + def _get_error_type_string(self): return 'server' @@ -776,6 +886,11 @@ def __init__(self, *, super().__init__() self.products = products # type: typing.Optional[typing.Dict[str, Product]] + def set_products(self, products: typing.Dict[str, Product]): + self.products = products + return self + + def _to_payload(self): payload = {} if self.products is not None: @@ -814,6 +929,7 @@ class GetAllProductsRequest(rpc.Shape): def __init__(self): super().__init__() + def _to_payload(self): payload = {} return payload