How to use as_dict method in avocado

Best Python code snippet using avocado_python

__init__.py

Source:__init__.py Github

copy

Full Screen

...8 PROTOCOL_VERSION = "1.1.0"9 @staticmethod10 def from_dict(d):11 return VersionInfo(d)12 def as_dict(self):13 return self.value14 def __repr__(self):15 return "<Enum VersionInfo. {}: {}>".format(16 limitedRepr(self.name), limitedRepr(self.value)17 )18class ConnectRequest:19 """20 (Internal Only) Request object to connect to the service.21 """22 __slots__ = [23 "__request_id",24 "__protocol_version",25 "__other_supported_protocol_versions",26 "__sdk_version",27 "__auth_token",28 ]29 _types_map = {30 "request_id": {"type": str, "subtype": None},31 "protocol_version": {"type": str, "subtype": None},32 "other_supported_protocol_versions": {"type": list, "subtype": str},33 "sdk_version": {"type": str, "subtype": None},34 "auth_token": {"type": str, "subtype": None},35 }36 _formats_map = {}37 _validations_map = {38 "request_id": {39 "required": True,40 "minLength": 1,41 "pattern": "^[\w ,.\-_]*$",42 },43 "protocol_version": {44 "required": True,45 },46 "other_supported_protocol_versions": {47 "required": False,48 },49 "sdk_version": {50 "required": False,51 },52 "auth_token": {53 "required": False,54 },55 }56 def __init__(57 self,58 request_id: str = None,59 protocol_version: str = None,60 other_supported_protocol_versions: List[str] = None,61 sdk_version: str = None,62 auth_token: str = None,63 ):64 pass65 self.__request_id = request_id66 self.__protocol_version = protocol_version67 self.__other_supported_protocol_versions = other_supported_protocol_versions68 self.__sdk_version = sdk_version69 self.__auth_token = auth_token70 def _get_request_id(self):71 return self.__request_id72 def _set_request_id(self, value):73 if not isinstance(value, str):74 raise TypeError("request_id must be str")75 self.__request_id = value76 request_id = property(_get_request_id, _set_request_id)77 def _get_protocol_version(self):78 return self.__protocol_version79 def _set_protocol_version(self, value):80 if not isinstance(value, str):81 raise TypeError("protocol_version must be str")82 self.__protocol_version = value83 protocol_version = property(_get_protocol_version, _set_protocol_version)84 def _get_other_supported_protocol_versions(self):85 return self.__other_supported_protocol_versions86 def _set_other_supported_protocol_versions(self, value):87 if value is not None and not isinstance(value, list):88 raise TypeError("other_supported_protocol_versions must be list")89 if value is not None and not all(isinstance(i, str) for i in value):90 raise TypeError("other_supported_protocol_versions list values must be str")91 self.__other_supported_protocol_versions = value92 other_supported_protocol_versions = property(93 _get_other_supported_protocol_versions, _set_other_supported_protocol_versions94 )95 def _get_sdk_version(self):96 return self.__sdk_version97 def _set_sdk_version(self, value):98 if value is not None and not isinstance(value, str):99 raise TypeError("sdk_version must be str")100 self.__sdk_version = value101 sdk_version = property(_get_sdk_version, _set_sdk_version)102 def _get_auth_token(self):103 return self.__auth_token104 def _set_auth_token(self, value):105 if value is not None and not isinstance(value, str):106 raise TypeError("auth_token must be str")107 self.__auth_token = value108 auth_token = property(_get_auth_token, _set_auth_token)109 @staticmethod110 def from_dict(d):111 v = {}112 if "requestId" in d:113 v["request_id"] = (114 str.from_dict(d["requestId"])115 if hasattr(str, "from_dict")116 else d["requestId"]117 )118 if "protocolVersion" in d:119 v["protocol_version"] = (120 str.from_dict(d["protocolVersion"])121 if hasattr(str, "from_dict")122 else d["protocolVersion"]123 )124 if "otherSupportedProtocolVersions" in d:125 v["other_supported_protocol_versions"] = [126 str.from_dict(p) if hasattr(str, "from_dict") else p127 for p in d["otherSupportedProtocolVersions"]128 ]129 if "sdkVersion" in d:130 v["sdk_version"] = (131 str.from_dict(d["sdkVersion"])132 if hasattr(str, "from_dict")133 else d["sdkVersion"]134 )135 if "authToken" in d:136 v["auth_token"] = (137 str.from_dict(d["authToken"])138 if hasattr(str, "from_dict")139 else d["authToken"]140 )141 return ConnectRequest(**v)142 def as_dict(self):143 d = {}144 if self.__request_id is not None:145 d["requestId"] = (146 self.__request_id.as_dict()147 if hasattr(self.__request_id, "as_dict")148 else self.__request_id149 )150 if self.__protocol_version is not None:151 d["protocolVersion"] = (152 self.__protocol_version.as_dict()153 if hasattr(self.__protocol_version, "as_dict")154 else self.__protocol_version155 )156 if self.__other_supported_protocol_versions is not None:157 d["otherSupportedProtocolVersions"] = [158 p.as_dict() if hasattr(p, "as_dict") else p159 for p in self.__other_supported_protocol_versions160 ]161 if self.__sdk_version is not None:162 d["sdkVersion"] = (163 self.__sdk_version.as_dict()164 if hasattr(self.__sdk_version, "as_dict")165 else self.__sdk_version166 )167 if self.__auth_token is not None:168 d["authToken"] = (169 self.__auth_token.as_dict()170 if hasattr(self.__auth_token, "as_dict")171 else self.__auth_token172 )173 return d174 def __repr__(self):175 return "<Class ConnectRequest. request_id: {}, protocol_version: {}, other_supported_protocol_versions: {}, sdk_version: {}, auth_token: {}>".format(176 limitedRepr(177 self.__request_id[:20]178 if isinstance(self.__request_id, bytes)179 else self.__request_id180 ),181 limitedRepr(182 self.__protocol_version[:20]183 if isinstance(self.__protocol_version, bytes)184 else self.__protocol_version185 ),186 limitedRepr(187 self.__other_supported_protocol_versions[:20]188 if isinstance(self.__other_supported_protocol_versions, bytes)189 else self.__other_supported_protocol_versions190 ),191 limitedRepr(192 self.__sdk_version[:20]193 if isinstance(self.__sdk_version, bytes)194 else self.__sdk_version195 ),196 limitedRepr(197 self.__auth_token[:20]198 if isinstance(self.__auth_token, bytes)199 else self.__auth_token200 ),201 )202class ResponseStatusCode(enum.Enum):203 """204 (Internal Only) Enum defining possible response status codes from StreamManager server.205 Success: Request succeeded.206 UnknownFailure: Encountered unknown StreamManager server failure.207 Unauthorized: Client is not authorized to perform this request.208 InvalidRequest: Client request is invalid.209 RequestPayloadTooLarge: Request payload is too large.210 ResourceNotFound: The requested resource does not exist.211 ServerTimeout: Server took too long and timed out.212 ResponsePayloadTooLarge: Server response exceeded the max allowed response payload size by the protocol.213 UnsupportedConnectVersion: Server does not support the Connect version presented by the Client.214 UnexpectedOperation: Operation presented was not expected by the Server.215 UnsupportedProtocolVersion: Protocol version presented by the Client is not compatible with the Server.216 InvalidProtocolVersion: Protocol version presented by the Client is not valid.217 FailedToConnect: Client failed to connect to the Server.218 NotEnoughMessages: There is not enough messages to return.219 MessageStoreReadError: Read messages encountered an error.220 OutOfMemoryError: Server ran out of memory.221 UpdateFailed: Update operation failed.222 UpdateNotAllowed: One or more fields are not allowed to be updated.223 UnknownOperation: Client request is not recognized by the server.224 """225 Success = 0226 UnknownFailure = 1227 Unauthorized = 2228 InvalidRequest = 3229 RequestPayloadTooLarge = 4230 ResourceNotFound = 5231 ServerTimeout = 6232 ResponsePayloadTooLarge = 7233 UnsupportedConnectVersion = 8234 UnexpectedOperation = 9235 UnsupportedProtocolVersion = 10236 InvalidProtocolVersion = 11237 FailedToConnect = 12238 NotEnoughMessages = 13239 MessageStoreReadError = 14240 OutOfMemoryError = 15241 UpdateFailed = 16242 UpdateNotAllowed = 17243 UnknownOperation = 18244 @staticmethod245 def from_dict(d):246 return ResponseStatusCode(d)247 def as_dict(self):248 return self.value249 def __repr__(self):250 return "<Enum ResponseStatusCode. {}: {}>".format(251 limitedRepr(self.name), limitedRepr(self.value)252 )253class ConnectResponse:254 """255 Internal Only.256 """257 __slots__ = [258 "__request_id",259 "__status",260 "__error_message",261 "__protocol_version",262 "__supported_protocol_versions",263 "__server_version",264 "__client_identifier",265 ]266 _types_map = {267 "request_id": {"type": str, "subtype": None},268 "status": {"type": ResponseStatusCode, "subtype": None},269 "error_message": {"type": str, "subtype": None},270 "protocol_version": {"type": str, "subtype": None},271 "supported_protocol_versions": {"type": list, "subtype": str},272 "server_version": {"type": str, "subtype": None},273 "client_identifier": {"type": str, "subtype": None},274 }275 _formats_map = {}276 _validations_map = {277 "request_id": {278 "required": False,279 "minLength": 1,280 "pattern": "^[\w ,.\-_]*$",281 },282 "status": {283 "required": True,284 },285 "error_message": {286 "required": False,287 },288 "protocol_version": {289 "required": False,290 },291 "supported_protocol_versions": {292 "required": False,293 },294 "server_version": {295 "required": False,296 },297 "client_identifier": {298 "required": False,299 },300 }301 def __init__(302 self,303 request_id: str = None,304 status: ResponseStatusCode = None,305 error_message: str = None,306 protocol_version: str = None,307 supported_protocol_versions: List[str] = None,308 server_version: str = None,309 client_identifier: str = None,310 ):311 pass312 self.__request_id = request_id313 self.__status = status314 self.__error_message = error_message315 self.__protocol_version = protocol_version316 self.__supported_protocol_versions = supported_protocol_versions317 self.__server_version = server_version318 self.__client_identifier = client_identifier319 def _get_request_id(self):320 return self.__request_id321 def _set_request_id(self, value):322 if value is not None and not isinstance(value, str):323 raise TypeError("request_id must be str")324 self.__request_id = value325 request_id = property(_get_request_id, _set_request_id)326 def _get_status(self):327 return self.__status328 def _set_status(self, value):329 if not isinstance(value, ResponseStatusCode):330 raise TypeError("status must be ResponseStatusCode")331 self.__status = value332 status = property(_get_status, _set_status)333 def _get_error_message(self):334 return self.__error_message335 def _set_error_message(self, value):336 if value is not None and not isinstance(value, str):337 raise TypeError("error_message must be str")338 self.__error_message = value339 error_message = property(_get_error_message, _set_error_message)340 def _get_protocol_version(self):341 return self.__protocol_version342 def _set_protocol_version(self, value):343 if value is not None and not isinstance(value, str):344 raise TypeError("protocol_version must be str")345 self.__protocol_version = value346 protocol_version = property(_get_protocol_version, _set_protocol_version)347 def _get_supported_protocol_versions(self):348 return self.__supported_protocol_versions349 def _set_supported_protocol_versions(self, value):350 if value is not None and not isinstance(value, list):351 raise TypeError("supported_protocol_versions must be list")352 if value is not None and not all(isinstance(i, str) for i in value):353 raise TypeError("supported_protocol_versions list values must be str")354 self.__supported_protocol_versions = value355 supported_protocol_versions = property(356 _get_supported_protocol_versions, _set_supported_protocol_versions357 )358 def _get_server_version(self):359 return self.__server_version360 def _set_server_version(self, value):361 if value is not None and not isinstance(value, str):362 raise TypeError("server_version must be str")363 self.__server_version = value364 server_version = property(_get_server_version, _set_server_version)365 def _get_client_identifier(self):366 return self.__client_identifier367 def _set_client_identifier(self, value):368 if value is not None and not isinstance(value, str):369 raise TypeError("client_identifier must be str")370 self.__client_identifier = value371 client_identifier = property(_get_client_identifier, _set_client_identifier)372 @staticmethod373 def from_dict(d):374 v = {}375 if "requestId" in d:376 v["request_id"] = (377 str.from_dict(d["requestId"])378 if hasattr(str, "from_dict")379 else d["requestId"]380 )381 if "status" in d:382 v["status"] = (383 ResponseStatusCode.from_dict(d["status"])384 if hasattr(ResponseStatusCode, "from_dict")385 else d["status"]386 )387 if "errorMessage" in d:388 v["error_message"] = (389 str.from_dict(d["errorMessage"])390 if hasattr(str, "from_dict")391 else d["errorMessage"]392 )393 if "protocolVersion" in d:394 v["protocol_version"] = (395 str.from_dict(d["protocolVersion"])396 if hasattr(str, "from_dict")397 else d["protocolVersion"]398 )399 if "supportedProtocolVersions" in d:400 v["supported_protocol_versions"] = [401 str.from_dict(p) if hasattr(str, "from_dict") else p402 for p in d["supportedProtocolVersions"]403 ]404 if "serverVersion" in d:405 v["server_version"] = (406 str.from_dict(d["serverVersion"])407 if hasattr(str, "from_dict")408 else d["serverVersion"]409 )410 if "clientIdentifier" in d:411 v["client_identifier"] = (412 str.from_dict(d["clientIdentifier"])413 if hasattr(str, "from_dict")414 else d["clientIdentifier"]415 )416 return ConnectResponse(**v)417 def as_dict(self):418 d = {}419 if self.__request_id is not None:420 d["requestId"] = (421 self.__request_id.as_dict()422 if hasattr(self.__request_id, "as_dict")423 else self.__request_id424 )425 if self.__status is not None:426 d["status"] = (427 self.__status.as_dict()428 if hasattr(self.__status, "as_dict")429 else self.__status430 )431 if self.__error_message is not None:432 d["errorMessage"] = (433 self.__error_message.as_dict()434 if hasattr(self.__error_message, "as_dict")435 else self.__error_message436 )437 if self.__protocol_version is not None:438 d["protocolVersion"] = (439 self.__protocol_version.as_dict()440 if hasattr(self.__protocol_version, "as_dict")441 else self.__protocol_version442 )443 if self.__supported_protocol_versions is not None:444 d["supportedProtocolVersions"] = [445 p.as_dict() if hasattr(p, "as_dict") else p446 for p in self.__supported_protocol_versions447 ]448 if self.__server_version is not None:449 d["serverVersion"] = (450 self.__server_version.as_dict()451 if hasattr(self.__server_version, "as_dict")452 else self.__server_version453 )454 if self.__client_identifier is not None:455 d["clientIdentifier"] = (456 self.__client_identifier.as_dict()457 if hasattr(self.__client_identifier, "as_dict")458 else self.__client_identifier459 )460 return d461 def __repr__(self):462 return "<Class ConnectResponse. request_id: {}, status: {}, error_message: {}, protocol_version: {}, supported_protocol_versions: {}, server_version: {}, client_identifier: {}>".format(463 limitedRepr(464 self.__request_id[:20]465 if isinstance(self.__request_id, bytes)466 else self.__request_id467 ),468 limitedRepr(469 self.__status[:20]470 if isinstance(self.__status, bytes)471 else self.__status472 ),473 limitedRepr(474 self.__error_message[:20]475 if isinstance(self.__error_message, bytes)476 else self.__error_message477 ),478 limitedRepr(479 self.__protocol_version[:20]480 if isinstance(self.__protocol_version, bytes)481 else self.__protocol_version482 ),483 limitedRepr(484 self.__supported_protocol_versions[:20]485 if isinstance(self.__supported_protocol_versions, bytes)486 else self.__supported_protocol_versions487 ),488 limitedRepr(489 self.__server_version[:20]490 if isinstance(self.__server_version, bytes)491 else self.__server_version492 ),493 limitedRepr(494 self.__client_identifier[:20]495 if isinstance(self.__client_identifier, bytes)496 else self.__client_identifier497 ),498 )499class Operation(enum.Enum):500 """501 Internal Only.502 """503 Unknown = 0504 Connect = 1505 CreateMessageStream = 2506 DeleteMessageStream = 3507 AppendMessage = 4508 ReadMessages = 5509 ConnectResponse = 6510 CreateMessageStreamResponse = 7511 DeleteMessageStreamResponse = 8512 AppendMessageResponse = 9513 ReadMessagesResponse = 10514 ListStreams = 11515 ListStreamsResponse = 12516 DescribeMessageStream = 13517 DescribeMessageStreamResponse = 14518 UpdateMessageStream = 15519 UpdateMessageStreamResponse = 16520 UnknownOperationError = 17521 @staticmethod522 def from_dict(d):523 return Operation(d)524 def as_dict(self):525 return self.value526 def __repr__(self):527 return "<Enum Operation. {}: {}>".format(528 limitedRepr(self.name), limitedRepr(self.value)529 )530class MessageFrame:531 """532 Internal Only.533 """534 __slots__ = [535 "__operation",536 "__payload",537 ]538 _types_map = {539 "operation": {"type": Operation, "subtype": None},540 "payload": {"type": bytes, "subtype": None},541 }542 _formats_map = {}543 _validations_map = {544 "operation": {545 "required": True,546 },547 "payload": {548 "required": True,549 },550 }551 def __init__(self, operation: Operation = None, payload: bytes = None):552 pass553 self.__operation = operation554 self.__payload = payload555 def _get_operation(self):556 return self.__operation557 def _set_operation(self, value):558 if not isinstance(value, Operation):559 raise TypeError("operation must be Operation")560 self.__operation = value561 operation = property(_get_operation, _set_operation)562 def _get_payload(self):563 return self.__payload564 def _set_payload(self, value):565 if not isinstance(value, bytes):566 raise TypeError("payload must be bytes")567 self.__payload = value568 payload = property(_get_payload, _set_payload)569 @staticmethod570 def from_dict(d):571 v = {}572 if "operation" in d:573 v["operation"] = (574 Operation.from_dict(d["operation"])575 if hasattr(Operation, "from_dict")576 else d["operation"]577 )578 if "payload" in d:579 v["payload"] = (580 bytes.from_dict(d["payload"])581 if hasattr(bytes, "from_dict")582 else d["payload"]583 )584 return MessageFrame(**v)585 def as_dict(self):586 d = {}587 if self.__operation is not None:588 d["operation"] = (589 self.__operation.as_dict()590 if hasattr(self.__operation, "as_dict")591 else self.__operation592 )593 if self.__payload is not None:594 d["payload"] = (595 self.__payload.as_dict()596 if hasattr(self.__payload, "as_dict")597 else self.__payload598 )599 return d600 def __repr__(self):601 return "<Class MessageFrame. operation: {}, payload: {}>".format(602 limitedRepr(603 self.__operation[:20]604 if isinstance(self.__operation, bytes)605 else self.__operation606 ),607 limitedRepr(608 self.__payload[:20]609 if isinstance(self.__payload, bytes)610 else self.__payload611 ),612 )613class Status(enum.Enum):614 """615 The status of the event.616 """617 Success = 0618 Failure = 1619 InProgress = 2620 Warning = 3621 Canceled = 4622 @staticmethod623 def from_dict(d):624 return Status(d)625 def as_dict(self):626 return self.value627 def __repr__(self):628 return "<Enum Status. {}: {}>".format(629 limitedRepr(self.name), limitedRepr(self.value)630 )631class StatusLevel(enum.Enum):632 """633 Defines the verbosity of status messages in a status-stream.634 """635 ERROR = 0636 WARN = 1637 INFO = 2638 DEBUG = 3639 TRACE = 4640 @staticmethod641 def from_dict(d):642 return StatusLevel(d)643 def as_dict(self):644 return self.value645 def __repr__(self):646 return "<Enum StatusLevel. {}: {}>".format(647 limitedRepr(self.name), limitedRepr(self.value)648 )649class S3ExportTaskDefinition:650 """651 S3 Task definition containing all the information necessary to export the data to S3. This will contain the S3 bucket and key as well as the file's URL where the data is stored.652 """653 __slots__ = [654 "__input_url",655 "__bucket",656 "__key",657 "__user_metadata",658 ]659 _types_map = {660 "input_url": {"type": str, "subtype": None},661 "bucket": {"type": str, "subtype": None},662 "key": {"type": str, "subtype": None},663 "user_metadata": {"type": dict, "subtype": None},664 }665 _formats_map = {}666 _validations_map = {667 "input_url": {668 "required": True,669 },670 "bucket": {671 "required": True,672 "minLength": 3,673 "maxLength": 63,674 "pattern": "(?=^.{3,63}$)(?!^(\d+\.)+\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$)",675 },676 "key": {677 "required": True,678 "minLength": 1,679 "maxLength": 1024,680 "pattern": "^([^\\\{ \}%\`\[\]\"'\>\<\~\#\^\?\|]|!\{[a-zA-Z]+:[a-zA-Z\/]+\})*$",681 },682 "user_metadata": {683 "required": False,684 },685 }686 def __init__(687 self,688 input_url: str = None,689 bucket: str = None,690 key: str = None,691 user_metadata: dict = None,692 ):693 """694 :param input_url: The URL of the file that contains the data to upload. The file should be local on the disk.695 :param bucket: The name of the S3 bucket that this file should be uploaded to.696 :param key: The key for the S3 object that this file should be uploaded to.697 The string can have placeholder expressions which are resolved at upload time. Valid expressions are strings that are valid Java DateTimeFormatter strings. See https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html698 Example: myKeyNamePrefix/!{timestamp:yyyy/MM/dd}/myKeyNameSuffix.699 :param user_metadata: User metadata. For key of a user metadata, callers should not include the internal "x-amz-meta-" prefix. Keys are case insensitive and will appear as lowercase strings on S3, even if they were originally specified with uppercase strings. Reserved key names start with "$aws-gg-" prefix.700 """701 pass702 self.__input_url = input_url703 self.__bucket = bucket704 self.__key = key705 self.__user_metadata = user_metadata706 def _get_input_url(self):707 return self.__input_url708 def _set_input_url(self, value):709 if not isinstance(value, str):710 raise TypeError("input_url must be str")711 self.__input_url = value712 input_url = property(_get_input_url, _set_input_url)713 """714 The URL of the file that contains the data to upload. The file should be local on the disk.715 """716 def _get_bucket(self):717 return self.__bucket718 def _set_bucket(self, value):719 if not isinstance(value, str):720 raise TypeError("bucket must be str")721 self.__bucket = value722 bucket = property(_get_bucket, _set_bucket)723 """724 The name of the S3 bucket that this file should be uploaded to.725 """726 def _get_key(self):727 return self.__key728 def _set_key(self, value):729 if not isinstance(value, str):730 raise TypeError("key must be str")731 self.__key = value732 key = property(_get_key, _set_key)733 """734 The key for the S3 object that this file should be uploaded to.735 The string can have placeholder expressions which are resolved at upload time. Valid expressions are strings that are valid Java DateTimeFormatter strings. See https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html736 Example: myKeyNamePrefix/!{timestamp:yyyy/MM/dd}/myKeyNameSuffix.737 """738 def _get_user_metadata(self):739 return self.__user_metadata740 def _set_user_metadata(self, value):741 if value is not None and not isinstance(value, dict):742 raise TypeError("user_metadata must be dict")743 self.__user_metadata = value744 user_metadata = property(_get_user_metadata, _set_user_metadata)745 """746 User metadata. For key of a user metadata, callers should not include the internal "x-amz-meta-" prefix. Keys are case insensitive and will appear as lowercase strings on S3, even if they were originally specified with uppercase strings. Reserved key names start with "$aws-gg-" prefix.747 """748 @staticmethod749 def from_dict(d):750 v = {}751 if "inputUrl" in d:752 v["input_url"] = (753 str.from_dict(d["inputUrl"])754 if hasattr(str, "from_dict")755 else d["inputUrl"]756 )757 if "bucket" in d:758 v["bucket"] = (759 str.from_dict(d["bucket"]) if hasattr(str, "from_dict") else d["bucket"]760 )761 if "key" in d:762 v["key"] = (763 str.from_dict(d["key"]) if hasattr(str, "from_dict") else d["key"]764 )765 if "userMetadata" in d:766 v["user_metadata"] = (767 dict.from_dict(d["userMetadata"])768 if hasattr(dict, "from_dict")769 else d["userMetadata"]770 )771 return S3ExportTaskDefinition(**v)772 def as_dict(self):773 d = {}774 if self.__input_url is not None:775 d["inputUrl"] = (776 self.__input_url.as_dict()777 if hasattr(self.__input_url, "as_dict")778 else self.__input_url779 )780 if self.__bucket is not None:781 d["bucket"] = (782 self.__bucket.as_dict()783 if hasattr(self.__bucket, "as_dict")784 else self.__bucket785 )786 if self.__key is not None:787 d["key"] = (788 self.__key.as_dict() if hasattr(self.__key, "as_dict") else self.__key789 )790 if self.__user_metadata is not None:791 d["userMetadata"] = (792 self.__user_metadata.as_dict()793 if hasattr(self.__user_metadata, "as_dict")794 else self.__user_metadata795 )796 return d797 def __repr__(self):798 return "<Class S3ExportTaskDefinition. input_url: {}, bucket: {}, key: {}, user_metadata: {}>".format(799 limitedRepr(800 self.__input_url[:20]801 if isinstance(self.__input_url, bytes)802 else self.__input_url803 ),804 limitedRepr(805 self.__bucket[:20]806 if isinstance(self.__bucket, bytes)807 else self.__bucket808 ),809 limitedRepr(810 self.__key[:20] if isinstance(self.__key, bytes) else self.__key811 ),812 limitedRepr(813 self.__user_metadata[:20]814 if isinstance(self.__user_metadata, bytes)815 else self.__user_metadata816 ),817 )818class StatusContext:819 """820 Context associated with a status message. Describes which stream, export config, message, the status is associated with.821 """822 __slots__ = [823 "__s3_export_task_definition",824 "__export_identifier",825 "__stream_name",826 "__sequence_number",827 ]828 _types_map = {829 "s3_export_task_definition": {"type": S3ExportTaskDefinition, "subtype": None},830 "export_identifier": {"type": str, "subtype": None},831 "stream_name": {"type": str, "subtype": None},832 "sequence_number": {"type": int, "subtype": None},833 }834 _formats_map = {}835 _validations_map = {836 "s3_export_task_definition": {837 "required": False,838 },839 "export_identifier": {840 "required": False,841 },842 "stream_name": {843 "required": False,844 },845 "sequence_number": {846 "required": False,847 },848 }849 def __init__(850 self,851 s3_export_task_definition: S3ExportTaskDefinition = None,852 export_identifier: str = None,853 stream_name: str = None,854 sequence_number: int = None,855 ):856 """857 :param s3_export_task_definition: The task definition of an S3 upload task if the status is associated with it, ie, if the eventType = S3Task.858 :param export_identifier: The export identifier the status is associated with.859 :param stream_name: The name of the stream the status is associated with.860 :param sequence_number: The sequence number of the message the status is associated with.861 """862 pass863 self.__s3_export_task_definition = s3_export_task_definition864 self.__export_identifier = export_identifier865 self.__stream_name = stream_name866 self.__sequence_number = sequence_number867 def _get_s3_export_task_definition(self):868 return self.__s3_export_task_definition869 def _set_s3_export_task_definition(self, value):870 if value is not None and not isinstance(value, S3ExportTaskDefinition):871 raise TypeError("s3_export_task_definition must be S3ExportTaskDefinition")872 self.__s3_export_task_definition = value873 s3_export_task_definition = property(874 _get_s3_export_task_definition, _set_s3_export_task_definition875 )876 """877 The task definition of an S3 upload task if the status is associated with it, ie, if the eventType = S3Task.878 """879 def _get_export_identifier(self):880 return self.__export_identifier881 def _set_export_identifier(self, value):882 if value is not None and not isinstance(value, str):883 raise TypeError("export_identifier must be str")884 self.__export_identifier = value885 export_identifier = property(_get_export_identifier, _set_export_identifier)886 """887 The export identifier the status is associated with.888 """889 def _get_stream_name(self):890 return self.__stream_name891 def _set_stream_name(self, value):892 if value is not None and not isinstance(value, str):893 raise TypeError("stream_name must be str")894 self.__stream_name = value895 stream_name = property(_get_stream_name, _set_stream_name)896 """897 The name of the stream the status is associated with.898 """899 def _get_sequence_number(self):900 return self.__sequence_number901 def _set_sequence_number(self, value):902 if value is not None and not isinstance(value, int):903 raise TypeError("sequence_number must be int")904 self.__sequence_number = value905 sequence_number = property(_get_sequence_number, _set_sequence_number)906 """907 The sequence number of the message the status is associated with.908 """909 @staticmethod910 def from_dict(d):911 v = {}912 if "s3ExportTaskDefinition" in d:913 v["s3_export_task_definition"] = (914 S3ExportTaskDefinition.from_dict(d["s3ExportTaskDefinition"])915 if hasattr(S3ExportTaskDefinition, "from_dict")916 else d["s3ExportTaskDefinition"]917 )918 if "exportIdentifier" in d:919 v["export_identifier"] = (920 str.from_dict(d["exportIdentifier"])921 if hasattr(str, "from_dict")922 else d["exportIdentifier"]923 )924 if "streamName" in d:925 v["stream_name"] = (926 str.from_dict(d["streamName"])927 if hasattr(str, "from_dict")928 else d["streamName"]929 )930 if "sequenceNumber" in d:931 v["sequence_number"] = (932 int.from_dict(d["sequenceNumber"])933 if hasattr(int, "from_dict")934 else d["sequenceNumber"]935 )936 return StatusContext(**v)937 def as_dict(self):938 d = {}939 if self.__s3_export_task_definition is not None:940 d["s3ExportTaskDefinition"] = (941 self.__s3_export_task_definition.as_dict()942 if hasattr(self.__s3_export_task_definition, "as_dict")943 else self.__s3_export_task_definition944 )945 if self.__export_identifier is not None:946 d["exportIdentifier"] = (947 self.__export_identifier.as_dict()948 if hasattr(self.__export_identifier, "as_dict")949 else self.__export_identifier950 )951 if self.__stream_name is not None:952 d["streamName"] = (953 self.__stream_name.as_dict()954 if hasattr(self.__stream_name, "as_dict")955 else self.__stream_name956 )957 if self.__sequence_number is not None:958 d["sequenceNumber"] = (959 self.__sequence_number.as_dict()960 if hasattr(self.__sequence_number, "as_dict")961 else self.__sequence_number962 )963 return d964 def __repr__(self):965 return "<Class StatusContext. s3_export_task_definition: {}, export_identifier: {}, stream_name: {}, sequence_number: {}>".format(966 limitedRepr(967 self.__s3_export_task_definition[:20]968 if isinstance(self.__s3_export_task_definition, bytes)969 else self.__s3_export_task_definition970 ),971 limitedRepr(972 self.__export_identifier[:20]973 if isinstance(self.__export_identifier, bytes)974 else self.__export_identifier975 ),976 limitedRepr(977 self.__stream_name[:20]978 if isinstance(self.__stream_name, bytes)979 else self.__stream_name980 ),981 limitedRepr(982 self.__sequence_number[:20]983 if isinstance(self.__sequence_number, bytes)984 else self.__sequence_number985 ),986 )987class EventType(enum.Enum):988 """989 The type of event, which determines how to interpret the status payload.990 """991 S3Task = 0992 @staticmethod993 def from_dict(d):994 return EventType(d)995 def as_dict(self):996 return self.value997 def __repr__(self):998 return "<Enum EventType. {}: {}>".format(999 limitedRepr(self.name), limitedRepr(self.value)1000 )1001class StatusMessage:1002 """1003 Status object appended to a status-stream.1004 """1005 __slots__ = [1006 "__event_type",1007 "__status_level",1008 "__status",1009 "__status_context",1010 "__message",1011 "__timestamp_epoch_ms",1012 ]1013 _types_map = {1014 "event_type": {"type": EventType, "subtype": None},1015 "status_level": {"type": StatusLevel, "subtype": None},1016 "status": {"type": Status, "subtype": None},1017 "status_context": {"type": StatusContext, "subtype": None},1018 "message": {"type": str, "subtype": None},1019 "timestamp_epoch_ms": {"type": int, "subtype": None},1020 }1021 _formats_map = {}1022 _validations_map = {1023 "event_type": {1024 "required": True,1025 },1026 "status_level": {1027 "required": False,1028 },1029 "status": {1030 "required": True,1031 },1032 "status_context": {1033 "required": False,1034 },1035 "message": {1036 "required": False,1037 },1038 "timestamp_epoch_ms": {1039 "required": False,1040 },1041 }1042 def __init__(1043 self,1044 event_type: EventType = None,1045 status_level: StatusLevel = None,1046 status: Status = None,1047 status_context: StatusContext = None,1048 message: str = None,1049 timestamp_epoch_ms: int = None,1050 ):1051 """1052 :param message: String describing the status message.1053 :param timestamp_epoch_ms: The time this status was added to the status-stream (in milliseconds since epoch).1054 """1055 pass1056 self.__event_type = event_type1057 self.__status_level = status_level1058 self.__status = status1059 self.__status_context = status_context1060 self.__message = message1061 self.__timestamp_epoch_ms = timestamp_epoch_ms1062 def _get_event_type(self):1063 return self.__event_type1064 def _set_event_type(self, value):1065 if not isinstance(value, EventType):1066 raise TypeError("event_type must be EventType")1067 self.__event_type = value1068 event_type = property(_get_event_type, _set_event_type)1069 def _get_status_level(self):1070 return self.__status_level1071 def _set_status_level(self, value):1072 if value is not None and not isinstance(value, StatusLevel):1073 raise TypeError("status_level must be StatusLevel")1074 self.__status_level = value1075 status_level = property(_get_status_level, _set_status_level)1076 def _get_status(self):1077 return self.__status1078 def _set_status(self, value):1079 if not isinstance(value, Status):1080 raise TypeError("status must be Status")1081 self.__status = value1082 status = property(_get_status, _set_status)1083 def _get_status_context(self):1084 return self.__status_context1085 def _set_status_context(self, value):1086 if value is not None and not isinstance(value, StatusContext):1087 raise TypeError("status_context must be StatusContext")1088 self.__status_context = value1089 status_context = property(_get_status_context, _set_status_context)1090 def _get_message(self):1091 return self.__message1092 def _set_message(self, value):1093 if value is not None and not isinstance(value, str):1094 raise TypeError("message must be str")1095 self.__message = value1096 message = property(_get_message, _set_message)1097 """1098 String describing the status message.1099 """1100 def _get_timestamp_epoch_ms(self):1101 return self.__timestamp_epoch_ms1102 def _set_timestamp_epoch_ms(self, value):1103 if value is not None and not isinstance(value, int):1104 raise TypeError("timestamp_epoch_ms must be int")1105 self.__timestamp_epoch_ms = value1106 timestamp_epoch_ms = property(_get_timestamp_epoch_ms, _set_timestamp_epoch_ms)1107 """1108 The time this status was added to the status-stream (in milliseconds since epoch).1109 """1110 @staticmethod1111 def from_dict(d):1112 v = {}1113 if "eventType" in d:1114 v["event_type"] = (1115 EventType.from_dict(d["eventType"])1116 if hasattr(EventType, "from_dict")1117 else d["eventType"]1118 )1119 if "statusLevel" in d:1120 v["status_level"] = (1121 StatusLevel.from_dict(d["statusLevel"])1122 if hasattr(StatusLevel, "from_dict")1123 else d["statusLevel"]1124 )1125 if "status" in d:1126 v["status"] = (1127 Status.from_dict(d["status"])1128 if hasattr(Status, "from_dict")1129 else d["status"]1130 )1131 if "statusContext" in d:1132 v["status_context"] = (1133 StatusContext.from_dict(d["statusContext"])1134 if hasattr(StatusContext, "from_dict")1135 else d["statusContext"]1136 )1137 if "message" in d:1138 v["message"] = (1139 str.from_dict(d["message"])1140 if hasattr(str, "from_dict")1141 else d["message"]1142 )1143 if "timestampEpochMs" in d:1144 v["timestamp_epoch_ms"] = (1145 int.from_dict(d["timestampEpochMs"])1146 if hasattr(int, "from_dict")1147 else d["timestampEpochMs"]1148 )1149 return StatusMessage(**v)1150 def as_dict(self):1151 d = {}1152 if self.__event_type is not None:1153 d["eventType"] = (1154 self.__event_type.as_dict()1155 if hasattr(self.__event_type, "as_dict")1156 else self.__event_type1157 )1158 if self.__status_level is not None:1159 d["statusLevel"] = (1160 self.__status_level.as_dict()1161 if hasattr(self.__status_level, "as_dict")1162 else self.__status_level1163 )1164 if self.__status is not None:1165 d["status"] = (1166 self.__status.as_dict()1167 if hasattr(self.__status, "as_dict")1168 else self.__status1169 )1170 if self.__status_context is not None:1171 d["statusContext"] = (1172 self.__status_context.as_dict()1173 if hasattr(self.__status_context, "as_dict")1174 else self.__status_context1175 )1176 if self.__message is not None:1177 d["message"] = (1178 self.__message.as_dict()1179 if hasattr(self.__message, "as_dict")1180 else self.__message1181 )1182 if self.__timestamp_epoch_ms is not None:1183 d["timestampEpochMs"] = (1184 self.__timestamp_epoch_ms.as_dict()1185 if hasattr(self.__timestamp_epoch_ms, "as_dict")1186 else self.__timestamp_epoch_ms1187 )1188 return d1189 def __repr__(self):1190 return "<Class StatusMessage. event_type: {}, status_level: {}, status: {}, status_context: {}, message: {}, timestamp_epoch_ms: {}>".format(1191 limitedRepr(1192 self.__event_type[:20]1193 if isinstance(self.__event_type, bytes)1194 else self.__event_type1195 ),1196 limitedRepr(1197 self.__status_level[:20]1198 if isinstance(self.__status_level, bytes)1199 else self.__status_level1200 ),1201 limitedRepr(1202 self.__status[:20]1203 if isinstance(self.__status, bytes)1204 else self.__status1205 ),1206 limitedRepr(1207 self.__status_context[:20]1208 if isinstance(self.__status_context, bytes)1209 else self.__status_context1210 ),1211 limitedRepr(1212 self.__message[:20]1213 if isinstance(self.__message, bytes)1214 else self.__message1215 ),1216 limitedRepr(1217 self.__timestamp_epoch_ms[:20]1218 if isinstance(self.__timestamp_epoch_ms, bytes)1219 else self.__timestamp_epoch_ms1220 ),1221 )1222class TraceableRequest:1223 """1224 (Internal Only) TraceableRequest that contains only requestId.1225 """1226 __slots__ = [1227 "__request_id",1228 ]1229 _types_map = {1230 "request_id": {"type": str, "subtype": None},1231 }1232 _formats_map = {}1233 _validations_map = {1234 "request_id": {1235 "required": True,1236 "minLength": 1,1237 "pattern": "^[\w ,.\-_]*$",1238 },1239 }1240 def __init__(self, request_id: str = None):1241 pass1242 self.__request_id = request_id1243 def _get_request_id(self):1244 return self.__request_id1245 def _set_request_id(self, value):1246 if not isinstance(value, str):1247 raise TypeError("request_id must be str")1248 self.__request_id = value1249 request_id = property(_get_request_id, _set_request_id)1250 @staticmethod1251 def from_dict(d):1252 v = {}1253 if "requestId" in d:1254 v["request_id"] = (1255 str.from_dict(d["requestId"])1256 if hasattr(str, "from_dict")1257 else d["requestId"]1258 )1259 return TraceableRequest(**v)1260 def as_dict(self):1261 d = {}1262 if self.__request_id is not None:1263 d["requestId"] = (1264 self.__request_id.as_dict()1265 if hasattr(self.__request_id, "as_dict")1266 else self.__request_id1267 )1268 return d1269 def __repr__(self):1270 return "<Class TraceableRequest. request_id: {}>".format(1271 limitedRepr(1272 self.__request_id[:20]1273 if isinstance(self.__request_id, bytes)1274 else self.__request_id1275 )1276 )1277class UnknownOperationError:1278 """1279 (Internal Only) Response for UnknownOperationError.1280 """1281 __slots__ = [1282 "__request_id",1283 "__status",1284 "__error_message",1285 ]1286 _types_map = {1287 "request_id": {"type": str, "subtype": None},1288 "status": {"type": ResponseStatusCode, "subtype": None},1289 "error_message": {"type": str, "subtype": None},1290 }1291 _formats_map = {}1292 _validations_map = {1293 "request_id": {1294 "required": True,1295 "minLength": 1,1296 "pattern": "^[\w ,.\-_]*$",1297 },1298 "status": {1299 "required": True,1300 },1301 "error_message": {1302 "required": False,1303 },1304 }1305 def __init__(1306 self,1307 request_id: str = None,1308 status: ResponseStatusCode = None,1309 error_message: str = None,1310 ):1311 pass1312 self.__request_id = request_id1313 self.__status = status1314 self.__error_message = error_message1315 def _get_request_id(self):1316 return self.__request_id1317 def _set_request_id(self, value):1318 if not isinstance(value, str):1319 raise TypeError("request_id must be str")1320 self.__request_id = value1321 request_id = property(_get_request_id, _set_request_id)1322 def _get_status(self):1323 return self.__status1324 def _set_status(self, value):1325 if not isinstance(value, ResponseStatusCode):1326 raise TypeError("status must be ResponseStatusCode")1327 self.__status = value1328 status = property(_get_status, _set_status)1329 def _get_error_message(self):1330 return self.__error_message1331 def _set_error_message(self, value):1332 if value is not None and not isinstance(value, str):1333 raise TypeError("error_message must be str")1334 self.__error_message = value1335 error_message = property(_get_error_message, _set_error_message)1336 @staticmethod1337 def from_dict(d):1338 v = {}1339 if "requestId" in d:1340 v["request_id"] = (1341 str.from_dict(d["requestId"])1342 if hasattr(str, "from_dict")1343 else d["requestId"]1344 )1345 if "status" in d:1346 v["status"] = (1347 ResponseStatusCode.from_dict(d["status"])1348 if hasattr(ResponseStatusCode, "from_dict")1349 else d["status"]1350 )1351 if "errorMessage" in d:1352 v["error_message"] = (1353 str.from_dict(d["errorMessage"])1354 if hasattr(str, "from_dict")1355 else d["errorMessage"]1356 )1357 return UnknownOperationError(**v)1358 def as_dict(self):1359 d = {}1360 if self.__request_id is not None:1361 d["requestId"] = (1362 self.__request_id.as_dict()1363 if hasattr(self.__request_id, "as_dict")1364 else self.__request_id1365 )1366 if self.__status is not None:1367 d["status"] = (1368 self.__status.as_dict()1369 if hasattr(self.__status, "as_dict")1370 else self.__status1371 )1372 if self.__error_message is not None:1373 d["errorMessage"] = (1374 self.__error_message.as_dict()1375 if hasattr(self.__error_message, "as_dict")1376 else self.__error_message1377 )1378 return d1379 def __repr__(self):1380 return "<Class UnknownOperationError. request_id: {}, status: {}, error_message: {}>".format(1381 limitedRepr(1382 self.__request_id[:20]1383 if isinstance(self.__request_id, bytes)1384 else self.__request_id1385 ),1386 limitedRepr(1387 self.__status[:20]1388 if isinstance(self.__status, bytes)1389 else self.__status1390 ),1391 limitedRepr(1392 self.__error_message[:20]1393 if isinstance(self.__error_message, bytes)1394 else self.__error_message1395 ),1396 )1397class KinesisConfig:1398 """1399 Configuration object for Kinesis data streams export destination.1400 """1401 __slots__ = [1402 "__identifier",1403 "__kinesis_stream_name",1404 "__batch_size",1405 "__batch_interval_millis",1406 "__priority",1407 "__start_sequence_number",1408 "__disabled",1409 ]1410 _types_map = {1411 "identifier": {"type": str, "subtype": None},1412 "kinesis_stream_name": {"type": str, "subtype": None},1413 "batch_size": {"type": int, "subtype": None},1414 "batch_interval_millis": {"type": int, "subtype": None},1415 "priority": {"type": int, "subtype": None},1416 "start_sequence_number": {"type": int, "subtype": None},1417 "disabled": {"type": bool, "subtype": None},1418 }1419 _formats_map = {}1420 _validations_map = {1421 "identifier": {1422 "required": True,1423 "minLength": 1,1424 "maxLength": 255,1425 "pattern": "^[\w ,.\-_]*$",1426 },1427 "kinesis_stream_name": {1428 "required": True,1429 "minLength": 1,1430 },1431 "batch_size": {1432 "required": False,1433 "maximum": 500,1434 "minimum": 1,1435 },1436 "batch_interval_millis": {1437 "required": False,1438 "maximum": 9223372036854,1439 "minimum": 60000,1440 },1441 "priority": {1442 "required": False,1443 "maximum": 10,1444 "minimum": 1,1445 },1446 "start_sequence_number": {1447 "required": False,1448 "maximum": 9223372036854775807,1449 "minimum": 0,1450 },1451 "disabled": {1452 "required": False,1453 },1454 }1455 def __init__(1456 self,1457 identifier: str = None,1458 kinesis_stream_name: str = None,1459 batch_size: int = None,1460 batch_interval_millis: int = None,1461 priority: int = None,1462 start_sequence_number: int = None,1463 disabled: bool = None,1464 ):1465 """1466 :param identifier: A unique identifier to identify this individual upload stream.1467 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.1468 :param kinesis_stream_name: The name of the Kinesis data stream that this exporter should upload to.1469 :param batch_size: The maximum size of a batch to send to Kinesis. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 500.1470 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1471 The batch size must be between 1 and 500.1472 :param batch_interval_millis: The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.1473 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1474 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.1475 :param priority: Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.1476 :param start_sequence_number: The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.1477 :param disabled: Enable or disable this export. Default is false.1478 """1479 pass1480 self.__identifier = identifier1481 self.__kinesis_stream_name = kinesis_stream_name1482 self.__batch_size = batch_size1483 self.__batch_interval_millis = batch_interval_millis1484 self.__priority = priority1485 self.__start_sequence_number = start_sequence_number1486 self.__disabled = disabled1487 def _get_identifier(self):1488 return self.__identifier1489 def _set_identifier(self, value):1490 if not isinstance(value, str):1491 raise TypeError("identifier must be str")1492 self.__identifier = value1493 identifier = property(_get_identifier, _set_identifier)1494 """1495 A unique identifier to identify this individual upload stream.1496 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.1497 """1498 def _get_kinesis_stream_name(self):1499 return self.__kinesis_stream_name1500 def _set_kinesis_stream_name(self, value):1501 if not isinstance(value, str):1502 raise TypeError("kinesis_stream_name must be str")1503 self.__kinesis_stream_name = value1504 kinesis_stream_name = property(_get_kinesis_stream_name, _set_kinesis_stream_name)1505 """1506 The name of the Kinesis data stream that this exporter should upload to.1507 """1508 def _get_batch_size(self):1509 return self.__batch_size1510 def _set_batch_size(self, value):1511 if value is not None and not isinstance(value, int):1512 raise TypeError("batch_size must be int")1513 self.__batch_size = value1514 batch_size = property(_get_batch_size, _set_batch_size)1515 """1516 The maximum size of a batch to send to Kinesis. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 500.1517 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1518 The batch size must be between 1 and 500.1519 """1520 def _get_batch_interval_millis(self):1521 return self.__batch_interval_millis1522 def _set_batch_interval_millis(self, value):1523 if value is not None and not isinstance(value, int):1524 raise TypeError("batch_interval_millis must be int")1525 self.__batch_interval_millis = value1526 batch_interval_millis = property(1527 _get_batch_interval_millis, _set_batch_interval_millis1528 )1529 """1530 The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.1531 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1532 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.1533 """1534 def _get_priority(self):1535 return self.__priority1536 def _set_priority(self, value):1537 if value is not None and not isinstance(value, int):1538 raise TypeError("priority must be int")1539 self.__priority = value1540 priority = property(_get_priority, _set_priority)1541 """1542 Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.1543 """1544 def _get_start_sequence_number(self):1545 return self.__start_sequence_number1546 def _set_start_sequence_number(self, value):1547 if value is not None and not isinstance(value, int):1548 raise TypeError("start_sequence_number must be int")1549 self.__start_sequence_number = value1550 start_sequence_number = property(1551 _get_start_sequence_number, _set_start_sequence_number1552 )1553 """1554 The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.1555 """1556 def _get_disabled(self):1557 return self.__disabled1558 def _set_disabled(self, value):1559 if value is not None and not isinstance(value, bool):1560 raise TypeError("disabled must be bool")1561 self.__disabled = value1562 disabled = property(_get_disabled, _set_disabled)1563 """1564 Enable or disable this export. Default is false.1565 """1566 @staticmethod1567 def from_dict(d):1568 v = {}1569 if "identifier" in d:1570 v["identifier"] = (1571 str.from_dict(d["identifier"])1572 if hasattr(str, "from_dict")1573 else d["identifier"]1574 )1575 if "kinesisStreamName" in d:1576 v["kinesis_stream_name"] = (1577 str.from_dict(d["kinesisStreamName"])1578 if hasattr(str, "from_dict")1579 else d["kinesisStreamName"]1580 )1581 if "batchSize" in d:1582 v["batch_size"] = (1583 int.from_dict(d["batchSize"])1584 if hasattr(int, "from_dict")1585 else d["batchSize"]1586 )1587 if "batchIntervalMillis" in d:1588 v["batch_interval_millis"] = (1589 int.from_dict(d["batchIntervalMillis"])1590 if hasattr(int, "from_dict")1591 else d["batchIntervalMillis"]1592 )1593 if "priority" in d:1594 v["priority"] = (1595 int.from_dict(d["priority"])1596 if hasattr(int, "from_dict")1597 else d["priority"]1598 )1599 if "startSequenceNumber" in d:1600 v["start_sequence_number"] = (1601 int.from_dict(d["startSequenceNumber"])1602 if hasattr(int, "from_dict")1603 else d["startSequenceNumber"]1604 )1605 if "disabled" in d:1606 v["disabled"] = (1607 bool.from_dict(d["disabled"])1608 if hasattr(bool, "from_dict")1609 else d["disabled"]1610 )1611 return KinesisConfig(**v)1612 def as_dict(self):1613 d = {}1614 if self.__identifier is not None:1615 d["identifier"] = (1616 self.__identifier.as_dict()1617 if hasattr(self.__identifier, "as_dict")1618 else self.__identifier1619 )1620 if self.__kinesis_stream_name is not None:1621 d["kinesisStreamName"] = (1622 self.__kinesis_stream_name.as_dict()1623 if hasattr(self.__kinesis_stream_name, "as_dict")1624 else self.__kinesis_stream_name1625 )1626 if self.__batch_size is not None:1627 d["batchSize"] = (1628 self.__batch_size.as_dict()1629 if hasattr(self.__batch_size, "as_dict")1630 else self.__batch_size1631 )1632 if self.__batch_interval_millis is not None:1633 d["batchIntervalMillis"] = (1634 self.__batch_interval_millis.as_dict()1635 if hasattr(self.__batch_interval_millis, "as_dict")1636 else self.__batch_interval_millis1637 )1638 if self.__priority is not None:1639 d["priority"] = (1640 self.__priority.as_dict()1641 if hasattr(self.__priority, "as_dict")1642 else self.__priority1643 )1644 if self.__start_sequence_number is not None:1645 d["startSequenceNumber"] = (1646 self.__start_sequence_number.as_dict()1647 if hasattr(self.__start_sequence_number, "as_dict")1648 else self.__start_sequence_number1649 )1650 if self.__disabled is not None:1651 d["disabled"] = (1652 self.__disabled.as_dict()1653 if hasattr(self.__disabled, "as_dict")1654 else self.__disabled1655 )1656 return d1657 def __repr__(self):1658 return "<Class KinesisConfig. identifier: {}, kinesis_stream_name: {}, batch_size: {}, batch_interval_millis: {}, priority: {}, start_sequence_number: {}, disabled: {}>".format(1659 limitedRepr(1660 self.__identifier[:20]1661 if isinstance(self.__identifier, bytes)1662 else self.__identifier1663 ),1664 limitedRepr(1665 self.__kinesis_stream_name[:20]1666 if isinstance(self.__kinesis_stream_name, bytes)1667 else self.__kinesis_stream_name1668 ),1669 limitedRepr(1670 self.__batch_size[:20]1671 if isinstance(self.__batch_size, bytes)1672 else self.__batch_size1673 ),1674 limitedRepr(1675 self.__batch_interval_millis[:20]1676 if isinstance(self.__batch_interval_millis, bytes)1677 else self.__batch_interval_millis1678 ),1679 limitedRepr(1680 self.__priority[:20]1681 if isinstance(self.__priority, bytes)1682 else self.__priority1683 ),1684 limitedRepr(1685 self.__start_sequence_number[:20]1686 if isinstance(self.__start_sequence_number, bytes)1687 else self.__start_sequence_number1688 ),1689 limitedRepr(1690 self.__disabled[:20]1691 if isinstance(self.__disabled, bytes)1692 else self.__disabled1693 ),1694 )1695class IoTSiteWiseConfig:1696 """1697 Configuration object for IotSiteWise data streams export destination. Minimum version requirements: StreamManager server version 1.1 (or AWS IoT Greengrass Core 1.11.0)1698 """1699 __slots__ = [1700 "__identifier",1701 "__batch_size",1702 "__batch_interval_millis",1703 "__priority",1704 "__start_sequence_number",1705 "__disabled",1706 ]1707 _types_map = {1708 "identifier": {"type": str, "subtype": None},1709 "batch_size": {"type": int, "subtype": None},1710 "batch_interval_millis": {"type": int, "subtype": None},1711 "priority": {"type": int, "subtype": None},1712 "start_sequence_number": {"type": int, "subtype": None},1713 "disabled": {"type": bool, "subtype": None},1714 }1715 _formats_map = {}1716 _validations_map = {1717 "identifier": {1718 "required": True,1719 "minLength": 1,1720 "maxLength": 255,1721 "pattern": "^[\w ,.\-_]*$",1722 },1723 "batch_size": {1724 "required": False,1725 "maximum": 10,1726 "minimum": 1,1727 },1728 "batch_interval_millis": {1729 "required": False,1730 "maximum": 9223372036854,1731 "minimum": 60000,1732 },1733 "priority": {1734 "required": False,1735 "maximum": 10,1736 "minimum": 1,1737 },1738 "start_sequence_number": {1739 "required": False,1740 "maximum": 9223372036854775807,1741 "minimum": 0,1742 },1743 "disabled": {1744 "required": False,1745 },1746 }1747 def __init__(1748 self,1749 identifier: str = None,1750 batch_size: int = None,1751 batch_interval_millis: int = None,1752 priority: int = None,1753 start_sequence_number: int = None,1754 disabled: bool = None,1755 ):1756 """1757 :param identifier: A unique identifier to identify this individual upload stream.1758 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.1759 :param batch_size: The maximum size of a batch to send to the destination. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 10.1760 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1761 The minimum batch size is 1 and the maximum is 10.1762 :param batch_interval_millis: The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.1763 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1764 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.1765 :param priority: Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.1766 :param start_sequence_number: The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.1767 :param disabled: Enable or disable this export. Default is false.1768 """1769 pass1770 self.__identifier = identifier1771 self.__batch_size = batch_size1772 self.__batch_interval_millis = batch_interval_millis1773 self.__priority = priority1774 self.__start_sequence_number = start_sequence_number1775 self.__disabled = disabled1776 def _get_identifier(self):1777 return self.__identifier1778 def _set_identifier(self, value):1779 if not isinstance(value, str):1780 raise TypeError("identifier must be str")1781 self.__identifier = value1782 identifier = property(_get_identifier, _set_identifier)1783 """1784 A unique identifier to identify this individual upload stream.1785 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.1786 """1787 def _get_batch_size(self):1788 return self.__batch_size1789 def _set_batch_size(self, value):1790 if value is not None and not isinstance(value, int):1791 raise TypeError("batch_size must be int")1792 self.__batch_size = value1793 batch_size = property(_get_batch_size, _set_batch_size)1794 """1795 The maximum size of a batch to send to the destination. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 10.1796 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1797 The minimum batch size is 1 and the maximum is 10.1798 """1799 def _get_batch_interval_millis(self):1800 return self.__batch_interval_millis1801 def _set_batch_interval_millis(self, value):1802 if value is not None and not isinstance(value, int):1803 raise TypeError("batch_interval_millis must be int")1804 self.__batch_interval_millis = value1805 batch_interval_millis = property(1806 _get_batch_interval_millis, _set_batch_interval_millis1807 )1808 """1809 The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.1810 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.1811 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.1812 """1813 def _get_priority(self):1814 return self.__priority1815 def _set_priority(self, value):1816 if value is not None and not isinstance(value, int):1817 raise TypeError("priority must be int")1818 self.__priority = value1819 priority = property(_get_priority, _set_priority)1820 """1821 Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.1822 """1823 def _get_start_sequence_number(self):1824 return self.__start_sequence_number1825 def _set_start_sequence_number(self, value):1826 if value is not None and not isinstance(value, int):1827 raise TypeError("start_sequence_number must be int")1828 self.__start_sequence_number = value1829 start_sequence_number = property(1830 _get_start_sequence_number, _set_start_sequence_number1831 )1832 """1833 The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.1834 """1835 def _get_disabled(self):1836 return self.__disabled1837 def _set_disabled(self, value):1838 if value is not None and not isinstance(value, bool):1839 raise TypeError("disabled must be bool")1840 self.__disabled = value1841 disabled = property(_get_disabled, _set_disabled)1842 """1843 Enable or disable this export. Default is false.1844 """1845 @staticmethod1846 def from_dict(d):1847 v = {}1848 if "identifier" in d:1849 v["identifier"] = (1850 str.from_dict(d["identifier"])1851 if hasattr(str, "from_dict")1852 else d["identifier"]1853 )1854 if "batchSize" in d:1855 v["batch_size"] = (1856 int.from_dict(d["batchSize"])1857 if hasattr(int, "from_dict")1858 else d["batchSize"]1859 )1860 if "batchIntervalMillis" in d:1861 v["batch_interval_millis"] = (1862 int.from_dict(d["batchIntervalMillis"])1863 if hasattr(int, "from_dict")1864 else d["batchIntervalMillis"]1865 )1866 if "priority" in d:1867 v["priority"] = (1868 int.from_dict(d["priority"])1869 if hasattr(int, "from_dict")1870 else d["priority"]1871 )1872 if "startSequenceNumber" in d:1873 v["start_sequence_number"] = (1874 int.from_dict(d["startSequenceNumber"])1875 if hasattr(int, "from_dict")1876 else d["startSequenceNumber"]1877 )1878 if "disabled" in d:1879 v["disabled"] = (1880 bool.from_dict(d["disabled"])1881 if hasattr(bool, "from_dict")1882 else d["disabled"]1883 )1884 return IoTSiteWiseConfig(**v)1885 def as_dict(self):1886 d = {}1887 if self.__identifier is not None:1888 d["identifier"] = (1889 self.__identifier.as_dict()1890 if hasattr(self.__identifier, "as_dict")1891 else self.__identifier1892 )1893 if self.__batch_size is not None:1894 d["batchSize"] = (1895 self.__batch_size.as_dict()1896 if hasattr(self.__batch_size, "as_dict")1897 else self.__batch_size1898 )1899 if self.__batch_interval_millis is not None:1900 d["batchIntervalMillis"] = (1901 self.__batch_interval_millis.as_dict()1902 if hasattr(self.__batch_interval_millis, "as_dict")1903 else self.__batch_interval_millis1904 )1905 if self.__priority is not None:1906 d["priority"] = (1907 self.__priority.as_dict()1908 if hasattr(self.__priority, "as_dict")1909 else self.__priority1910 )1911 if self.__start_sequence_number is not None:1912 d["startSequenceNumber"] = (1913 self.__start_sequence_number.as_dict()1914 if hasattr(self.__start_sequence_number, "as_dict")1915 else self.__start_sequence_number1916 )1917 if self.__disabled is not None:1918 d["disabled"] = (1919 self.__disabled.as_dict()1920 if hasattr(self.__disabled, "as_dict")1921 else self.__disabled1922 )1923 return d1924 def __repr__(self):1925 return "<Class IoTSiteWiseConfig. identifier: {}, batch_size: {}, batch_interval_millis: {}, priority: {}, start_sequence_number: {}, disabled: {}>".format(1926 limitedRepr(1927 self.__identifier[:20]1928 if isinstance(self.__identifier, bytes)1929 else self.__identifier1930 ),1931 limitedRepr(1932 self.__batch_size[:20]1933 if isinstance(self.__batch_size, bytes)1934 else self.__batch_size1935 ),1936 limitedRepr(1937 self.__batch_interval_millis[:20]1938 if isinstance(self.__batch_interval_millis, bytes)1939 else self.__batch_interval_millis1940 ),1941 limitedRepr(1942 self.__priority[:20]1943 if isinstance(self.__priority, bytes)1944 else self.__priority1945 ),1946 limitedRepr(1947 self.__start_sequence_number[:20]1948 if isinstance(self.__start_sequence_number, bytes)1949 else self.__start_sequence_number1950 ),1951 limitedRepr(1952 self.__disabled[:20]1953 if isinstance(self.__disabled, bytes)1954 else self.__disabled1955 ),1956 )1957class ExportFormat(enum.Enum):1958 """1959 ExportFormat is used to define how messages are batched and formatted in the export payload.1960 RAW_NOT_BATCHED: Each message in a batch will be sent as an individual HTTP POST with the payload as the body (even if batchSize is set).1961 JSON_BATCHED: Each batch of messages will be sent as a JSON list of Message objects as the body.1962 """1963 RAW_NOT_BATCHED = 01964 JSON_BATCHED = 11965 @staticmethod1966 def from_dict(d):1967 return ExportFormat(d)1968 def as_dict(self):1969 return self.value1970 def __repr__(self):1971 return "<Enum ExportFormat. {}: {}>".format(1972 limitedRepr(self.name), limitedRepr(self.value)1973 )1974class HTTPConfig:1975 """1976 This export destination is not supported! The interface may change at any time without notice and should not be relied on for any production use.1977 There are no guarantees around its correctness.1978 This configures an HTTP endpoint which sends a POST request to the provided URI. Each request contains a single message in the body of the request.1979 """1980 __slots__ = [1981 "__identifier",1982 "__uri",1983 "__batch_size",1984 "__batch_interval_millis",1985 "__priority",1986 "__start_sequence_number",1987 "__disabled",1988 "__export_format",1989 ]1990 _types_map = {1991 "identifier": {"type": str, "subtype": None},1992 "uri": {"type": str, "subtype": None},1993 "batch_size": {"type": int, "subtype": None},1994 "batch_interval_millis": {"type": int, "subtype": None},1995 "priority": {"type": int, "subtype": None},1996 "start_sequence_number": {"type": int, "subtype": None},1997 "disabled": {"type": bool, "subtype": None},1998 "export_format": {"type": ExportFormat, "subtype": None},1999 }2000 _formats_map = {}2001 _validations_map = {2002 "identifier": {2003 "required": True,2004 "minLength": 1,2005 "maxLength": 255,2006 "pattern": "^[\w ,.\-_]*$",2007 },2008 "uri": {2009 "required": True,2010 "minLength": 1,2011 },2012 "batch_size": {2013 "required": False,2014 "maximum": 500,2015 "minimum": 1,2016 },2017 "batch_interval_millis": {2018 "required": False,2019 "maximum": 9223372036854,2020 "minimum": 60000,2021 },2022 "priority": {2023 "required": False,2024 "maximum": 10,2025 "minimum": 1,2026 },2027 "start_sequence_number": {2028 "required": False,2029 "maximum": 9223372036854775807,2030 "minimum": 0,2031 },2032 "disabled": {2033 "required": False,2034 },2035 "export_format": {2036 "required": False,2037 },2038 }2039 def __init__(2040 self,2041 identifier: str = None,2042 uri: str = None,2043 batch_size: int = None,2044 batch_interval_millis: int = None,2045 priority: int = None,2046 start_sequence_number: int = None,2047 disabled: bool = None,2048 export_format: ExportFormat = None,2049 ):2050 """2051 :param identifier: A unique identifier to identify this individual upload stream.2052 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.2053 :param uri: URL for HTTP endpoint which should receive the POST requests for export.2054 :param batch_size: The maximum size of a batch to send to the destination. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 500.2055 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2056 The minimum batch size is 1 and the maximum is 500.2057 :param batch_interval_millis: The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.2058 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2059 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.2060 :param priority: Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.2061 :param start_sequence_number: The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.2062 :param disabled: Enable or disable this export. Default is false.2063 :param export_format: Defines how messages are batched and formatted in the export payload.2064 """2065 pass2066 self.__identifier = identifier2067 self.__uri = uri2068 self.__batch_size = batch_size2069 self.__batch_interval_millis = batch_interval_millis2070 self.__priority = priority2071 self.__start_sequence_number = start_sequence_number2072 self.__disabled = disabled2073 self.__export_format = export_format2074 def _get_identifier(self):2075 return self.__identifier2076 def _set_identifier(self, value):2077 if not isinstance(value, str):2078 raise TypeError("identifier must be str")2079 self.__identifier = value2080 identifier = property(_get_identifier, _set_identifier)2081 """2082 A unique identifier to identify this individual upload stream.2083 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.2084 """2085 def _get_uri(self):2086 return self.__uri2087 def _set_uri(self, value):2088 if not isinstance(value, str):2089 raise TypeError("uri must be str")2090 self.__uri = value2091 uri = property(_get_uri, _set_uri)2092 """2093 URL for HTTP endpoint which should receive the POST requests for export.2094 """2095 def _get_batch_size(self):2096 return self.__batch_size2097 def _set_batch_size(self, value):2098 if value is not None and not isinstance(value, int):2099 raise TypeError("batch_size must be int")2100 self.__batch_size = value2101 batch_size = property(_get_batch_size, _set_batch_size)2102 """2103 The maximum size of a batch to send to the destination. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 500.2104 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2105 The minimum batch size is 1 and the maximum is 500.2106 """2107 def _get_batch_interval_millis(self):2108 return self.__batch_interval_millis2109 def _set_batch_interval_millis(self, value):2110 if value is not None and not isinstance(value, int):2111 raise TypeError("batch_interval_millis must be int")2112 self.__batch_interval_millis = value2113 batch_interval_millis = property(2114 _get_batch_interval_millis, _set_batch_interval_millis2115 )2116 """2117 The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.2118 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2119 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.2120 """2121 def _get_priority(self):2122 return self.__priority2123 def _set_priority(self, value):2124 if value is not None and not isinstance(value, int):2125 raise TypeError("priority must be int")2126 self.__priority = value2127 priority = property(_get_priority, _set_priority)2128 """2129 Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.2130 """2131 def _get_start_sequence_number(self):2132 return self.__start_sequence_number2133 def _set_start_sequence_number(self, value):2134 if value is not None and not isinstance(value, int):2135 raise TypeError("start_sequence_number must be int")2136 self.__start_sequence_number = value2137 start_sequence_number = property(2138 _get_start_sequence_number, _set_start_sequence_number2139 )2140 """2141 The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.2142 """2143 def _get_disabled(self):2144 return self.__disabled2145 def _set_disabled(self, value):2146 if value is not None and not isinstance(value, bool):2147 raise TypeError("disabled must be bool")2148 self.__disabled = value2149 disabled = property(_get_disabled, _set_disabled)2150 """2151 Enable or disable this export. Default is false.2152 """2153 def _get_export_format(self):2154 return self.__export_format2155 def _set_export_format(self, value):2156 if value is not None and not isinstance(value, ExportFormat):2157 raise TypeError("export_format must be ExportFormat")2158 self.__export_format = value2159 export_format = property(_get_export_format, _set_export_format)2160 """2161 Defines how messages are batched and formatted in the export payload.2162 """2163 @staticmethod2164 def from_dict(d):2165 v = {}2166 if "identifier" in d:2167 v["identifier"] = (2168 str.from_dict(d["identifier"])2169 if hasattr(str, "from_dict")2170 else d["identifier"]2171 )2172 if "uri" in d:2173 v["uri"] = (2174 str.from_dict(d["uri"]) if hasattr(str, "from_dict") else d["uri"]2175 )2176 if "batchSize" in d:2177 v["batch_size"] = (2178 int.from_dict(d["batchSize"])2179 if hasattr(int, "from_dict")2180 else d["batchSize"]2181 )2182 if "batchIntervalMillis" in d:2183 v["batch_interval_millis"] = (2184 int.from_dict(d["batchIntervalMillis"])2185 if hasattr(int, "from_dict")2186 else d["batchIntervalMillis"]2187 )2188 if "priority" in d:2189 v["priority"] = (2190 int.from_dict(d["priority"])2191 if hasattr(int, "from_dict")2192 else d["priority"]2193 )2194 if "startSequenceNumber" in d:2195 v["start_sequence_number"] = (2196 int.from_dict(d["startSequenceNumber"])2197 if hasattr(int, "from_dict")2198 else d["startSequenceNumber"]2199 )2200 if "disabled" in d:2201 v["disabled"] = (2202 bool.from_dict(d["disabled"])2203 if hasattr(bool, "from_dict")2204 else d["disabled"]2205 )2206 if "exportFormat" in d:2207 v["export_format"] = (2208 ExportFormat.from_dict(d["exportFormat"])2209 if hasattr(ExportFormat, "from_dict")2210 else d["exportFormat"]2211 )2212 return HTTPConfig(**v)2213 def as_dict(self):2214 d = {}2215 if self.__identifier is not None:2216 d["identifier"] = (2217 self.__identifier.as_dict()2218 if hasattr(self.__identifier, "as_dict")2219 else self.__identifier2220 )2221 if self.__uri is not None:2222 d["uri"] = (2223 self.__uri.as_dict() if hasattr(self.__uri, "as_dict") else self.__uri2224 )2225 if self.__batch_size is not None:2226 d["batchSize"] = (2227 self.__batch_size.as_dict()2228 if hasattr(self.__batch_size, "as_dict")2229 else self.__batch_size2230 )2231 if self.__batch_interval_millis is not None:2232 d["batchIntervalMillis"] = (2233 self.__batch_interval_millis.as_dict()2234 if hasattr(self.__batch_interval_millis, "as_dict")2235 else self.__batch_interval_millis2236 )2237 if self.__priority is not None:2238 d["priority"] = (2239 self.__priority.as_dict()2240 if hasattr(self.__priority, "as_dict")2241 else self.__priority2242 )2243 if self.__start_sequence_number is not None:2244 d["startSequenceNumber"] = (2245 self.__start_sequence_number.as_dict()2246 if hasattr(self.__start_sequence_number, "as_dict")2247 else self.__start_sequence_number2248 )2249 if self.__disabled is not None:2250 d["disabled"] = (2251 self.__disabled.as_dict()2252 if hasattr(self.__disabled, "as_dict")2253 else self.__disabled2254 )2255 if self.__export_format is not None:2256 d["exportFormat"] = (2257 self.__export_format.as_dict()2258 if hasattr(self.__export_format, "as_dict")2259 else self.__export_format2260 )2261 return d2262 def __repr__(self):2263 return "<Class HTTPConfig. identifier: {}, uri: {}, batch_size: {}, batch_interval_millis: {}, priority: {}, start_sequence_number: {}, disabled: {}, export_format: {}>".format(2264 limitedRepr(2265 self.__identifier[:20]2266 if isinstance(self.__identifier, bytes)2267 else self.__identifier2268 ),2269 limitedRepr(2270 self.__uri[:20] if isinstance(self.__uri, bytes) else self.__uri2271 ),2272 limitedRepr(2273 self.__batch_size[:20]2274 if isinstance(self.__batch_size, bytes)2275 else self.__batch_size2276 ),2277 limitedRepr(2278 self.__batch_interval_millis[:20]2279 if isinstance(self.__batch_interval_millis, bytes)2280 else self.__batch_interval_millis2281 ),2282 limitedRepr(2283 self.__priority[:20]2284 if isinstance(self.__priority, bytes)2285 else self.__priority2286 ),2287 limitedRepr(2288 self.__start_sequence_number[:20]2289 if isinstance(self.__start_sequence_number, bytes)2290 else self.__start_sequence_number2291 ),2292 limitedRepr(2293 self.__disabled[:20]2294 if isinstance(self.__disabled, bytes)2295 else self.__disabled2296 ),2297 limitedRepr(2298 self.__export_format[:20]2299 if isinstance(self.__export_format, bytes)2300 else self.__export_format2301 ),2302 )2303class StatusConfig:2304 """2305 Configuration for status in a status-stream.2306 """2307 __slots__ = [2308 "__status_level",2309 "__status_stream_name",2310 ]2311 _types_map = {2312 "status_level": {"type": StatusLevel, "subtype": None},2313 "status_stream_name": {"type": str, "subtype": None},2314 }2315 _formats_map = {}2316 _validations_map = {2317 "status_level": {2318 "required": False,2319 },2320 "status_stream_name": {2321 "required": False,2322 "minLength": 1,2323 "maxLength": 255,2324 "pattern": "^[\w ,.\-_]*$",2325 },2326 }2327 def __init__(2328 self, status_level: StatusLevel = None, status_stream_name: str = None2329 ):2330 """2331 :param status_level: Defines the verbosity of status messages in a status-stream.2332 :param status_stream_name: The name of the stream to which status messages are appended.2333 The status-stream should be created before associating it with another stream.2334 """2335 pass2336 self.__status_level = status_level2337 self.__status_stream_name = status_stream_name2338 def _get_status_level(self):2339 return self.__status_level2340 def _set_status_level(self, value):2341 if value is not None and not isinstance(value, StatusLevel):2342 raise TypeError("status_level must be StatusLevel")2343 self.__status_level = value2344 status_level = property(_get_status_level, _set_status_level)2345 """2346 Defines the verbosity of status messages in a status-stream.2347 """2348 def _get_status_stream_name(self):2349 return self.__status_stream_name2350 def _set_status_stream_name(self, value):2351 if value is not None and not isinstance(value, str):2352 raise TypeError("status_stream_name must be str")2353 self.__status_stream_name = value2354 status_stream_name = property(_get_status_stream_name, _set_status_stream_name)2355 """2356 The name of the stream to which status messages are appended.2357 The status-stream should be created before associating it with another stream.2358 """2359 @staticmethod2360 def from_dict(d):2361 v = {}2362 if "statusLevel" in d:2363 v["status_level"] = (2364 StatusLevel.from_dict(d["statusLevel"])2365 if hasattr(StatusLevel, "from_dict")2366 else d["statusLevel"]2367 )2368 if "statusStreamName" in d:2369 v["status_stream_name"] = (2370 str.from_dict(d["statusStreamName"])2371 if hasattr(str, "from_dict")2372 else d["statusStreamName"]2373 )2374 return StatusConfig(**v)2375 def as_dict(self):2376 d = {}2377 if self.__status_level is not None:2378 d["statusLevel"] = (2379 self.__status_level.as_dict()2380 if hasattr(self.__status_level, "as_dict")2381 else self.__status_level2382 )2383 if self.__status_stream_name is not None:2384 d["statusStreamName"] = (2385 self.__status_stream_name.as_dict()2386 if hasattr(self.__status_stream_name, "as_dict")2387 else self.__status_stream_name2388 )2389 return d2390 def __repr__(self):2391 return "<Class StatusConfig. status_level: {}, status_stream_name: {}>".format(2392 limitedRepr(2393 self.__status_level[:20]2394 if isinstance(self.__status_level, bytes)2395 else self.__status_level2396 ),2397 limitedRepr(2398 self.__status_stream_name[:20]2399 if isinstance(self.__status_stream_name, bytes)2400 else self.__status_stream_name2401 ),2402 )2403class S3ExportTaskExecutorConfig:2404 """2405 Configuration object for S3 export tasks executor. Minimum version requirements: StreamManager server version 1.1 (or AWS IoT Greengrass Core 1.11.0)2406 """2407 __slots__ = [2408 "__identifier",2409 "__size_threshold_for_multipart_upload_bytes",2410 "__priority",2411 "__disabled",2412 "__status_config",2413 ]2414 _types_map = {2415 "identifier": {"type": str, "subtype": None},2416 "size_threshold_for_multipart_upload_bytes": {"type": int, "subtype": None},2417 "priority": {"type": int, "subtype": None},2418 "disabled": {"type": bool, "subtype": None},2419 "status_config": {"type": StatusConfig, "subtype": None},2420 }2421 _formats_map = {}2422 _validations_map = {2423 "identifier": {2424 "required": True,2425 "minLength": 1,2426 "maxLength": 255,2427 "pattern": "^[\w ,.\-_]*$",2428 },2429 "size_threshold_for_multipart_upload_bytes": {2430 "required": False,2431 "minimum": 5242880,2432 },2433 "priority": {2434 "required": False,2435 "maximum": 10,2436 "minimum": 1,2437 },2438 "disabled": {2439 "required": False,2440 },2441 "status_config": {2442 "required": False,2443 },2444 }2445 def __init__(2446 self,2447 identifier: str = None,2448 size_threshold_for_multipart_upload_bytes: int = None,2449 priority: int = None,2450 disabled: bool = None,2451 status_config: StatusConfig = None,2452 ):2453 """2454 :param identifier: A unique identifier to identify this individual upload task.2455 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.2456 :param size_threshold_for_multipart_upload_bytes: The size threshold in bytes for when to use multipart uploads. Uploads over this size will automatically use a multipart upload strategy, while uploads equal or smaller than this threshold will use a single connection to upload the whole object.2457 :param priority: Priority for this upload task. Lower values are higher priority. If not specified it will have the lowest priority.2458 :param disabled: Enable or disable this export. Default is false.2459 :param status_config: Event status configuration that specifies the target status stream and verbosity.2460 """2461 pass2462 self.__identifier = identifier2463 self.__size_threshold_for_multipart_upload_bytes = (2464 size_threshold_for_multipart_upload_bytes2465 )2466 self.__priority = priority2467 self.__disabled = disabled2468 self.__status_config = status_config2469 def _get_identifier(self):2470 return self.__identifier2471 def _set_identifier(self, value):2472 if not isinstance(value, str):2473 raise TypeError("identifier must be str")2474 self.__identifier = value2475 identifier = property(_get_identifier, _set_identifier)2476 """2477 A unique identifier to identify this individual upload task.2478 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.2479 """2480 def _get_size_threshold_for_multipart_upload_bytes(self):2481 return self.__size_threshold_for_multipart_upload_bytes2482 def _set_size_threshold_for_multipart_upload_bytes(self, value):2483 if value is not None and not isinstance(value, int):2484 raise TypeError("size_threshold_for_multipart_upload_bytes must be int")2485 self.__size_threshold_for_multipart_upload_bytes = value2486 size_threshold_for_multipart_upload_bytes = property(2487 _get_size_threshold_for_multipart_upload_bytes,2488 _set_size_threshold_for_multipart_upload_bytes,2489 )2490 """2491 The size threshold in bytes for when to use multipart uploads. Uploads over this size will automatically use a multipart upload strategy, while uploads equal or smaller than this threshold will use a single connection to upload the whole object.2492 """2493 def _get_priority(self):2494 return self.__priority2495 def _set_priority(self, value):2496 if value is not None and not isinstance(value, int):2497 raise TypeError("priority must be int")2498 self.__priority = value2499 priority = property(_get_priority, _set_priority)2500 """2501 Priority for this upload task. Lower values are higher priority. If not specified it will have the lowest priority.2502 """2503 def _get_disabled(self):2504 return self.__disabled2505 def _set_disabled(self, value):2506 if value is not None and not isinstance(value, bool):2507 raise TypeError("disabled must be bool")2508 self.__disabled = value2509 disabled = property(_get_disabled, _set_disabled)2510 """2511 Enable or disable this export. Default is false.2512 """2513 def _get_status_config(self):2514 return self.__status_config2515 def _set_status_config(self, value):2516 if value is not None and not isinstance(value, StatusConfig):2517 raise TypeError("status_config must be StatusConfig")2518 self.__status_config = value2519 status_config = property(_get_status_config, _set_status_config)2520 """2521 Event status configuration that specifies the target status stream and verbosity.2522 """2523 @staticmethod2524 def from_dict(d):2525 v = {}2526 if "identifier" in d:2527 v["identifier"] = (2528 str.from_dict(d["identifier"])2529 if hasattr(str, "from_dict")2530 else d["identifier"]2531 )2532 if "sizeThresholdForMultipartUploadBytes" in d:2533 v["size_threshold_for_multipart_upload_bytes"] = (2534 int.from_dict(d["sizeThresholdForMultipartUploadBytes"])2535 if hasattr(int, "from_dict")2536 else d["sizeThresholdForMultipartUploadBytes"]2537 )2538 if "priority" in d:2539 v["priority"] = (2540 int.from_dict(d["priority"])2541 if hasattr(int, "from_dict")2542 else d["priority"]2543 )2544 if "disabled" in d:2545 v["disabled"] = (2546 bool.from_dict(d["disabled"])2547 if hasattr(bool, "from_dict")2548 else d["disabled"]2549 )2550 if "statusConfig" in d:2551 v["status_config"] = (2552 StatusConfig.from_dict(d["statusConfig"])2553 if hasattr(StatusConfig, "from_dict")2554 else d["statusConfig"]2555 )2556 return S3ExportTaskExecutorConfig(**v)2557 def as_dict(self):2558 d = {}2559 if self.__identifier is not None:2560 d["identifier"] = (2561 self.__identifier.as_dict()2562 if hasattr(self.__identifier, "as_dict")2563 else self.__identifier2564 )2565 if self.__size_threshold_for_multipart_upload_bytes is not None:2566 d["sizeThresholdForMultipartUploadBytes"] = (2567 self.__size_threshold_for_multipart_upload_bytes.as_dict()2568 if hasattr(self.__size_threshold_for_multipart_upload_bytes, "as_dict")2569 else self.__size_threshold_for_multipart_upload_bytes2570 )2571 if self.__priority is not None:2572 d["priority"] = (2573 self.__priority.as_dict()2574 if hasattr(self.__priority, "as_dict")2575 else self.__priority2576 )2577 if self.__disabled is not None:2578 d["disabled"] = (2579 self.__disabled.as_dict()2580 if hasattr(self.__disabled, "as_dict")2581 else self.__disabled2582 )2583 if self.__status_config is not None:2584 d["statusConfig"] = (2585 self.__status_config.as_dict()2586 if hasattr(self.__status_config, "as_dict")2587 else self.__status_config2588 )2589 return d2590 def __repr__(self):2591 return "<Class S3ExportTaskExecutorConfig. identifier: {}, size_threshold_for_multipart_upload_bytes: {}, priority: {}, disabled: {}, status_config: {}>".format(2592 limitedRepr(2593 self.__identifier[:20]2594 if isinstance(self.__identifier, bytes)2595 else self.__identifier2596 ),2597 limitedRepr(2598 self.__size_threshold_for_multipart_upload_bytes[:20]2599 if isinstance(self.__size_threshold_for_multipart_upload_bytes, bytes)2600 else self.__size_threshold_for_multipart_upload_bytes2601 ),2602 limitedRepr(2603 self.__priority[:20]2604 if isinstance(self.__priority, bytes)2605 else self.__priority2606 ),2607 limitedRepr(2608 self.__disabled[:20]2609 if isinstance(self.__disabled, bytes)2610 else self.__disabled2611 ),2612 limitedRepr(2613 self.__status_config[:20]2614 if isinstance(self.__status_config, bytes)2615 else self.__status_config2616 ),2617 )2618class IoTAnalyticsConfig:2619 """2620 Configuration object for IoT Analytics export destination.2621 """2622 __slots__ = [2623 "__identifier",2624 "__iot_channel",2625 "__iot_msg_id_prefix",2626 "__batch_size",2627 "__batch_interval_millis",2628 "__priority",2629 "__start_sequence_number",2630 "__disabled",2631 ]2632 _types_map = {2633 "identifier": {"type": str, "subtype": None},2634 "iot_channel": {"type": str, "subtype": None},2635 "iot_msg_id_prefix": {"type": str, "subtype": None},2636 "batch_size": {"type": int, "subtype": None},2637 "batch_interval_millis": {"type": int, "subtype": None},2638 "priority": {"type": int, "subtype": None},2639 "start_sequence_number": {"type": int, "subtype": None},2640 "disabled": {"type": bool, "subtype": None},2641 }2642 _formats_map = {}2643 _validations_map = {2644 "identifier": {2645 "required": True,2646 "minLength": 1,2647 "maxLength": 255,2648 "pattern": "^[\w ,.\-_]*$",2649 },2650 "iot_channel": {2651 "required": True,2652 "minLength": 1,2653 },2654 "iot_msg_id_prefix": {2655 "required": False,2656 "maxLength": 32,2657 },2658 "batch_size": {2659 "required": False,2660 "maximum": 100,2661 "minimum": 1,2662 },2663 "batch_interval_millis": {2664 "required": False,2665 "maximum": 9223372036854,2666 "minimum": 60000,2667 },2668 "priority": {2669 "required": False,2670 "maximum": 10,2671 "minimum": 1,2672 },2673 "start_sequence_number": {2674 "required": False,2675 "maximum": 9223372036854775807,2676 "minimum": 0,2677 },2678 "disabled": {2679 "required": False,2680 },2681 }2682 def __init__(2683 self,2684 identifier: str = None,2685 iot_channel: str = None,2686 iot_msg_id_prefix: str = None,2687 batch_size: int = None,2688 batch_interval_millis: int = None,2689 priority: int = None,2690 start_sequence_number: int = None,2691 disabled: bool = None,2692 ):2693 """2694 :param identifier: A unique identifier to identify this individual upload stream.2695 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.2696 :param iot_channel: The name of the IoT Analytics Channel that this exporter should upload to.2697 :param iot_msg_id_prefix: A string prefixed to each unique message id. After this prefix, StreamManager may append more data to make the message ID unique.2698 This prefix must be less than 32 characters.2699 :param batch_size: The maximum size of a batch to send to IoT Analytics. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 100.2700 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2701 The batch size must be between 1 and 100.2702 :param batch_interval_millis: The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.2703 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2704 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.2705 :param priority: Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.2706 :param start_sequence_number: The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.2707 :param disabled: Enable or disable this export. Default is false.2708 """2709 pass2710 self.__identifier = identifier2711 self.__iot_channel = iot_channel2712 self.__iot_msg_id_prefix = iot_msg_id_prefix2713 self.__batch_size = batch_size2714 self.__batch_interval_millis = batch_interval_millis2715 self.__priority = priority2716 self.__start_sequence_number = start_sequence_number2717 self.__disabled = disabled2718 def _get_identifier(self):2719 return self.__identifier2720 def _set_identifier(self, value):2721 if not isinstance(value, str):2722 raise TypeError("identifier must be str")2723 self.__identifier = value2724 identifier = property(_get_identifier, _set_identifier)2725 """2726 A unique identifier to identify this individual upload stream.2727 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.2728 """2729 def _get_iot_channel(self):2730 return self.__iot_channel2731 def _set_iot_channel(self, value):2732 if not isinstance(value, str):2733 raise TypeError("iot_channel must be str")2734 self.__iot_channel = value2735 iot_channel = property(_get_iot_channel, _set_iot_channel)2736 """2737 The name of the IoT Analytics Channel that this exporter should upload to.2738 """2739 def _get_iot_msg_id_prefix(self):2740 return self.__iot_msg_id_prefix2741 def _set_iot_msg_id_prefix(self, value):2742 if value is not None and not isinstance(value, str):2743 raise TypeError("iot_msg_id_prefix must be str")2744 self.__iot_msg_id_prefix = value2745 iot_msg_id_prefix = property(_get_iot_msg_id_prefix, _set_iot_msg_id_prefix)2746 """2747 A string prefixed to each unique message id. After this prefix, StreamManager may append more data to make the message ID unique.2748 This prefix must be less than 32 characters.2749 """2750 def _get_batch_size(self):2751 return self.__batch_size2752 def _set_batch_size(self, value):2753 if value is not None and not isinstance(value, int):2754 raise TypeError("batch_size must be int")2755 self.__batch_size = value2756 batch_size = property(_get_batch_size, _set_batch_size)2757 """2758 The maximum size of a batch to send to IoT Analytics. Messages will be queued until the batch size is reached, after which they will then be uploaded. If unspecified the default will be 100.2759 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2760 The batch size must be between 1 and 100.2761 """2762 def _get_batch_interval_millis(self):2763 return self.__batch_interval_millis2764 def _set_batch_interval_millis(self, value):2765 if value is not None and not isinstance(value, int):2766 raise TypeError("batch_interval_millis must be int")2767 self.__batch_interval_millis = value2768 batch_interval_millis = property(2769 _get_batch_interval_millis, _set_batch_interval_millis2770 )2771 """2772 The time in milliseconds between the earliest un-uploaded message and the current time. If this time is exceeded, messages will be uploaded in the next batch. If unspecified messages will be eligible for upload immediately.2773 If both batchSize and batchIntervalMillis are specified, then messages will be eligible for upload when either condition is met.2774 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.2775 """2776 def _get_priority(self):2777 return self.__priority2778 def _set_priority(self, value):2779 if value is not None and not isinstance(value, int):2780 raise TypeError("priority must be int")2781 self.__priority = value2782 priority = property(_get_priority, _set_priority)2783 """2784 Priority for this upload stream. Lower values are higher priority. If not specified it will have the lowest priority.2785 """2786 def _get_start_sequence_number(self):2787 return self.__start_sequence_number2788 def _set_start_sequence_number(self, value):2789 if value is not None and not isinstance(value, int):2790 raise TypeError("start_sequence_number must be int")2791 self.__start_sequence_number = value2792 start_sequence_number = property(2793 _get_start_sequence_number, _set_start_sequence_number2794 )2795 """2796 The sequence number of the message to use as the starting message in the export. Default is 0. The sequence number provided should be less than the newest sequence number in the stream, i.e., sequence number of the last messaged appended. To find the newest sequence number, describe the stream and then check the storage status of the returned MessageStreamInfo object.2797 """2798 def _get_disabled(self):2799 return self.__disabled2800 def _set_disabled(self, value):2801 if value is not None and not isinstance(value, bool):2802 raise TypeError("disabled must be bool")2803 self.__disabled = value2804 disabled = property(_get_disabled, _set_disabled)2805 """2806 Enable or disable this export. Default is false.2807 """2808 @staticmethod2809 def from_dict(d):2810 v = {}2811 if "identifier" in d:2812 v["identifier"] = (2813 str.from_dict(d["identifier"])2814 if hasattr(str, "from_dict")2815 else d["identifier"]2816 )2817 if "iotChannel" in d:2818 v["iot_channel"] = (2819 str.from_dict(d["iotChannel"])2820 if hasattr(str, "from_dict")2821 else d["iotChannel"]2822 )2823 if "iotMsgIdPrefix" in d:2824 v["iot_msg_id_prefix"] = (2825 str.from_dict(d["iotMsgIdPrefix"])2826 if hasattr(str, "from_dict")2827 else d["iotMsgIdPrefix"]2828 )2829 if "batchSize" in d:2830 v["batch_size"] = (2831 int.from_dict(d["batchSize"])2832 if hasattr(int, "from_dict")2833 else d["batchSize"]2834 )2835 if "batchIntervalMillis" in d:2836 v["batch_interval_millis"] = (2837 int.from_dict(d["batchIntervalMillis"])2838 if hasattr(int, "from_dict")2839 else d["batchIntervalMillis"]2840 )2841 if "priority" in d:2842 v["priority"] = (2843 int.from_dict(d["priority"])2844 if hasattr(int, "from_dict")2845 else d["priority"]2846 )2847 if "startSequenceNumber" in d:2848 v["start_sequence_number"] = (2849 int.from_dict(d["startSequenceNumber"])2850 if hasattr(int, "from_dict")2851 else d["startSequenceNumber"]2852 )2853 if "disabled" in d:2854 v["disabled"] = (2855 bool.from_dict(d["disabled"])2856 if hasattr(bool, "from_dict")2857 else d["disabled"]2858 )2859 return IoTAnalyticsConfig(**v)2860 def as_dict(self):2861 d = {}2862 if self.__identifier is not None:2863 d["identifier"] = (2864 self.__identifier.as_dict()2865 if hasattr(self.__identifier, "as_dict")2866 else self.__identifier2867 )2868 if self.__iot_channel is not None:2869 d["iotChannel"] = (2870 self.__iot_channel.as_dict()2871 if hasattr(self.__iot_channel, "as_dict")2872 else self.__iot_channel2873 )2874 if self.__iot_msg_id_prefix is not None:2875 d["iotMsgIdPrefix"] = (2876 self.__iot_msg_id_prefix.as_dict()2877 if hasattr(self.__iot_msg_id_prefix, "as_dict")2878 else self.__iot_msg_id_prefix2879 )2880 if self.__batch_size is not None:2881 d["batchSize"] = (2882 self.__batch_size.as_dict()2883 if hasattr(self.__batch_size, "as_dict")2884 else self.__batch_size2885 )2886 if self.__batch_interval_millis is not None:2887 d["batchIntervalMillis"] = (2888 self.__batch_interval_millis.as_dict()2889 if hasattr(self.__batch_interval_millis, "as_dict")2890 else self.__batch_interval_millis2891 )2892 if self.__priority is not None:2893 d["priority"] = (2894 self.__priority.as_dict()2895 if hasattr(self.__priority, "as_dict")2896 else self.__priority2897 )2898 if self.__start_sequence_number is not None:2899 d["startSequenceNumber"] = (2900 self.__start_sequence_number.as_dict()2901 if hasattr(self.__start_sequence_number, "as_dict")2902 else self.__start_sequence_number2903 )2904 if self.__disabled is not None:2905 d["disabled"] = (2906 self.__disabled.as_dict()2907 if hasattr(self.__disabled, "as_dict")2908 else self.__disabled2909 )2910 return d2911 def __repr__(self):2912 return "<Class IoTAnalyticsConfig. identifier: {}, iot_channel: {}, iot_msg_id_prefix: {}, batch_size: {}, batch_interval_millis: {}, priority: {}, start_sequence_number: {}, disabled: {}>".format(2913 limitedRepr(2914 self.__identifier[:20]2915 if isinstance(self.__identifier, bytes)2916 else self.__identifier2917 ),2918 limitedRepr(2919 self.__iot_channel[:20]2920 if isinstance(self.__iot_channel, bytes)2921 else self.__iot_channel2922 ),2923 limitedRepr(2924 self.__iot_msg_id_prefix[:20]2925 if isinstance(self.__iot_msg_id_prefix, bytes)2926 else self.__iot_msg_id_prefix2927 ),2928 limitedRepr(2929 self.__batch_size[:20]2930 if isinstance(self.__batch_size, bytes)2931 else self.__batch_size2932 ),2933 limitedRepr(2934 self.__batch_interval_millis[:20]2935 if isinstance(self.__batch_interval_millis, bytes)2936 else self.__batch_interval_millis2937 ),2938 limitedRepr(2939 self.__priority[:20]2940 if isinstance(self.__priority, bytes)2941 else self.__priority2942 ),2943 limitedRepr(2944 self.__start_sequence_number[:20]2945 if isinstance(self.__start_sequence_number, bytes)2946 else self.__start_sequence_number2947 ),2948 limitedRepr(2949 self.__disabled[:20]2950 if isinstance(self.__disabled, bytes)2951 else self.__disabled2952 ),2953 )2954class ExportDefinition:2955 """2956 Defines how and where the stream is uploaded.2957 """2958 __slots__ = [2959 "__http",2960 "__iot_analytics",2961 "__kinesis",2962 "__iot_sitewise",2963 "__s3_task_executor",2964 ]2965 _types_map = {2966 "http": {"type": list, "subtype": HTTPConfig},2967 "iot_analytics": {"type": list, "subtype": IoTAnalyticsConfig},2968 "kinesis": {"type": list, "subtype": KinesisConfig},2969 "iot_sitewise": {"type": list, "subtype": IoTSiteWiseConfig},2970 "s3_task_executor": {"type": list, "subtype": S3ExportTaskExecutorConfig},2971 }2972 _formats_map = {}2973 _validations_map = {2974 "http": {2975 "required": False,2976 },2977 "iot_analytics": {2978 "required": False,2979 },2980 "kinesis": {2981 "required": False,2982 },2983 "iot_sitewise": {2984 "required": False,2985 },2986 "s3_task_executor": {2987 "required": False,2988 },2989 }2990 def __init__(2991 self,2992 http: List[HTTPConfig] = None,2993 iot_analytics: List[IoTAnalyticsConfig] = None,2994 kinesis: List[KinesisConfig] = None,2995 iot_sitewise: List[IoTSiteWiseConfig] = None,2996 s3_task_executor: List[S3ExportTaskExecutorConfig] = None,2997 ):2998 """2999 :param http: Defines how the stream is uploaded to an HTTP endpoint.3000 :param iot_analytics: Defines how the stream is uploaded to IoT Analytics.3001 :param kinesis: Defines how the stream is uploaded to Kinesis.3002 :param iot_sitewise: Defines how the stream is uploaded to IoT SiteWise.3003 :param s3_task_executor: Defines the list of configs for S3 task executors.3004 """3005 pass3006 self.__http = http3007 self.__iot_analytics = iot_analytics3008 self.__kinesis = kinesis3009 self.__iot_sitewise = iot_sitewise3010 self.__s3_task_executor = s3_task_executor3011 def _get_http(self):3012 return self.__http3013 def _set_http(self, value):3014 if value is not None and not isinstance(value, list):3015 raise TypeError("http must be list")3016 if value is not None and not all(isinstance(i, HTTPConfig) for i in value):3017 raise TypeError("http list values must be HTTPConfig")3018 self.__http = value3019 http = property(_get_http, _set_http)3020 """3021 Defines how the stream is uploaded to an HTTP endpoint.3022 """3023 def _get_iot_analytics(self):3024 return self.__iot_analytics3025 def _set_iot_analytics(self, value):3026 if value is not None and not isinstance(value, list):3027 raise TypeError("iot_analytics must be list")3028 if value is not None and not all(3029 isinstance(i, IoTAnalyticsConfig) for i in value3030 ):3031 raise TypeError("iot_analytics list values must be IoTAnalyticsConfig")3032 self.__iot_analytics = value3033 iot_analytics = property(_get_iot_analytics, _set_iot_analytics)3034 """3035 Defines how the stream is uploaded to IoT Analytics.3036 """3037 def _get_kinesis(self):3038 return self.__kinesis3039 def _set_kinesis(self, value):3040 if value is not None and not isinstance(value, list):3041 raise TypeError("kinesis must be list")3042 if value is not None and not all(isinstance(i, KinesisConfig) for i in value):3043 raise TypeError("kinesis list values must be KinesisConfig")3044 self.__kinesis = value3045 kinesis = property(_get_kinesis, _set_kinesis)3046 """3047 Defines how the stream is uploaded to Kinesis.3048 """3049 def _get_iot_sitewise(self):3050 return self.__iot_sitewise3051 def _set_iot_sitewise(self, value):3052 if value is not None and not isinstance(value, list):3053 raise TypeError("iot_sitewise must be list")3054 if value is not None and not all(3055 isinstance(i, IoTSiteWiseConfig) for i in value3056 ):3057 raise TypeError("iot_sitewise list values must be IoTSiteWiseConfig")3058 self.__iot_sitewise = value3059 iot_sitewise = property(_get_iot_sitewise, _set_iot_sitewise)3060 """3061 Defines how the stream is uploaded to IoT SiteWise.3062 """3063 def _get_s3_task_executor(self):3064 return self.__s3_task_executor3065 def _set_s3_task_executor(self, value):3066 if value is not None and not isinstance(value, list):3067 raise TypeError("s3_task_executor must be list")3068 if value is not None and not all(3069 isinstance(i, S3ExportTaskExecutorConfig) for i in value3070 ):3071 raise TypeError(3072 "s3_task_executor list values must be S3ExportTaskExecutorConfig"3073 )3074 self.__s3_task_executor = value3075 s3_task_executor = property(_get_s3_task_executor, _set_s3_task_executor)3076 """3077 Defines the list of configs for S3 task executors.3078 """3079 @staticmethod3080 def from_dict(d):3081 v = {}3082 if "http" in d:3083 v["http"] = [3084 HTTPConfig.from_dict(p) if hasattr(HTTPConfig, "from_dict") else p3085 for p in d["http"]3086 ]3087 if "iotAnalytics" in d:3088 v["iot_analytics"] = [3089 IoTAnalyticsConfig.from_dict(p)3090 if hasattr(IoTAnalyticsConfig, "from_dict")3091 else p3092 for p in d["iotAnalytics"]3093 ]3094 if "kinesis" in d:3095 v["kinesis"] = [3096 KinesisConfig.from_dict(p) if hasattr(KinesisConfig, "from_dict") else p3097 for p in d["kinesis"]3098 ]3099 if "IotSitewise" in d:3100 v["iot_sitewise"] = [3101 IoTSiteWiseConfig.from_dict(p)3102 if hasattr(IoTSiteWiseConfig, "from_dict")3103 else p3104 for p in d["IotSitewise"]3105 ]3106 if "s3TaskExecutor" in d:3107 v["s3_task_executor"] = [3108 S3ExportTaskExecutorConfig.from_dict(p)3109 if hasattr(S3ExportTaskExecutorConfig, "from_dict")3110 else p3111 for p in d["s3TaskExecutor"]3112 ]3113 return ExportDefinition(**v)3114 def as_dict(self):3115 d = {}3116 if self.__http is not None:3117 d["http"] = [3118 p.as_dict() if hasattr(p, "as_dict") else p for p in self.__http3119 ]3120 if self.__iot_analytics is not None:3121 d["iotAnalytics"] = [3122 p.as_dict() if hasattr(p, "as_dict") else p3123 for p in self.__iot_analytics3124 ]3125 if self.__kinesis is not None:3126 d["kinesis"] = [3127 p.as_dict() if hasattr(p, "as_dict") else p for p in self.__kinesis3128 ]3129 if self.__iot_sitewise is not None:3130 d["IotSitewise"] = [3131 p.as_dict() if hasattr(p, "as_dict") else p for p in self.__iot_sitewise3132 ]3133 if self.__s3_task_executor is not None:3134 d["s3TaskExecutor"] = [3135 p.as_dict() if hasattr(p, "as_dict") else p3136 for p in self.__s3_task_executor3137 ]3138 return d3139 def __repr__(self):3140 return "<Class ExportDefinition. http: {}, iot_analytics: {}, kinesis: {}, iot_sitewise: {}, s3_task_executor: {}>".format(3141 limitedRepr(3142 self.__http[:20] if isinstance(self.__http, bytes) else self.__http3143 ),3144 limitedRepr(3145 self.__iot_analytics[:20]3146 if isinstance(self.__iot_analytics, bytes)3147 else self.__iot_analytics3148 ),3149 limitedRepr(3150 self.__kinesis[:20]3151 if isinstance(self.__kinesis, bytes)3152 else self.__kinesis3153 ),3154 limitedRepr(3155 self.__iot_sitewise[:20]3156 if isinstance(self.__iot_sitewise, bytes)3157 else self.__iot_sitewise3158 ),3159 limitedRepr(3160 self.__s3_task_executor[:20]3161 if isinstance(self.__s3_task_executor, bytes)3162 else self.__s3_task_executor3163 ),3164 )3165class StrategyOnFull(enum.Enum):3166 """3167 StrategyOnFull is used in the MessageStreamDefinition when creating a stream.3168 It defines the behavior when the stream has reached the maximum size.3169 RejectNewData: any append message request after the stream is full will be rejected with an exception.3170 OverwriteOldestData: the oldest stream segments will be deleted until there is room for the new message.3171 """3172 RejectNewData = 03173 OverwriteOldestData = 13174 @staticmethod3175 def from_dict(d):3176 return StrategyOnFull(d)3177 def as_dict(self):3178 return self.value3179 def __repr__(self):3180 return "<Enum StrategyOnFull. {}: {}>".format(3181 limitedRepr(self.name), limitedRepr(self.value)3182 )3183class Persistence(enum.Enum):3184 """3185 Stream persistence. If set to File, the file system will be used to persist messages long-term and is resilient to restarts.3186 Memory should be used when performance matters more than durability as it only stores the stream in memory and never writes to the disk.3187 """3188 File = 03189 Memory = 13190 @staticmethod3191 def from_dict(d):3192 return Persistence(d)3193 def as_dict(self):3194 return self.value3195 def __repr__(self):3196 return "<Enum Persistence. {}: {}>".format(3197 limitedRepr(self.name), limitedRepr(self.value)3198 )3199class MessageStreamDefinition:3200 """3201 Object defining a message stream used in the CreateMessageStream and UpdateMessageStream API.3202 """3203 __slots__ = [3204 "__name",3205 "__max_size",3206 "__stream_segment_size",3207 "__time_to_live_millis",3208 "__strategy_on_full",3209 "__persistence",3210 "__flush_on_write",3211 "__export_definition",3212 ]3213 _types_map = {3214 "name": {"type": str, "subtype": None},3215 "max_size": {"type": int, "subtype": None},3216 "stream_segment_size": {"type": int, "subtype": None},3217 "time_to_live_millis": {"type": int, "subtype": None},3218 "strategy_on_full": {"type": StrategyOnFull, "subtype": None},3219 "persistence": {"type": Persistence, "subtype": None},3220 "flush_on_write": {"type": bool, "subtype": None},3221 "export_definition": {"type": ExportDefinition, "subtype": None},3222 }3223 _formats_map = {}3224 _validations_map = {3225 "name": {3226 "required": True,3227 "minLength": 1,3228 "maxLength": 255,3229 "pattern": "^[\w ,.\-_]*$",3230 },3231 "max_size": {3232 "required": False,3233 "maximum": 9223372036854775807,3234 "minimum": 1024,3235 },3236 "stream_segment_size": {3237 "required": False,3238 "maximum": 2147483647,3239 "minimum": 1024,3240 },3241 "time_to_live_millis": {3242 "required": False,3243 "maximum": 9223372036854,3244 "minimum": 60000,3245 },3246 "strategy_on_full": {3247 "required": True,3248 },3249 "persistence": {3250 "required": False,3251 },3252 "flush_on_write": {3253 "required": False,3254 },3255 "export_definition": {3256 "required": False,3257 },3258 }3259 def __init__(3260 self,3261 name: str = None,3262 max_size: int = 268435456,3263 stream_segment_size: int = 16777216,3264 time_to_live_millis: int = None,3265 strategy_on_full: StrategyOnFull = None,3266 persistence: Persistence = None,3267 flush_on_write: bool = None,3268 export_definition: ExportDefinition = None,3269 ):3270 """3271 :param name: The unique name of the stream.3272 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.3273 :param max_size: The maximum size in bytes for the entire stream. Set to 256MB by default with a minimum of 1KB and a maximum of 8192PB.3274 :param stream_segment_size: The size of each segment of the stream. Set to 16MB by default with a minimum of 1KB and a maximum of 2GB.3275 Data is only deleted segment by segment, so the segment size is the smallest amount of data which can be deleted.3276 :param time_to_live_millis: Time to live for each message in milliseconds. Data may be deleted at any time after the TTL expires; deletion is not guaranteed to occur immediately when the TTL expires.3277 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.3278 :param strategy_on_full: What to do when the maximum size of the stream is reached.3279 RejectNewData: any append message request after the stream is full will be rejected with an exception.3280 OverwriteOldestData: the oldest stream segments will be deleted until there is room for the new message.3281 :param persistence: Stream persistence. If set to File, the file system will be used to persist messages long-term and is resilient to restarts.3282 Memory should be used when performance matters more than durability as it only stores the stream in memory and never writes to the disk.3283 :param flush_on_write: This only applies when Persistence is set to File mode.3284 Waits for the filesystem to complete the write for every message. This is safer, but slower. Default is false.3285 :param export_definition: Defines how and where the stream is uploaded. See the definition of the ExportDefinition object for more detail.3286 """3287 pass3288 self.__name = name3289 self.__max_size = max_size3290 self.__stream_segment_size = stream_segment_size3291 self.__time_to_live_millis = time_to_live_millis3292 self.__strategy_on_full = strategy_on_full3293 self.__persistence = persistence3294 self.__flush_on_write = flush_on_write3295 self.__export_definition = export_definition3296 def _get_name(self):3297 return self.__name3298 def _set_name(self, value):3299 if not isinstance(value, str):3300 raise TypeError("name must be str")3301 self.__name = value3302 name = property(_get_name, _set_name)3303 """3304 The unique name of the stream.3305 Must be an alphanumeric string including spaces, commas, periods, hyphens, and underscores with length between 1 and 255.3306 """3307 def _get_max_size(self):3308 return self.__max_size3309 def _set_max_size(self, value):3310 if value is not None and not isinstance(value, int):3311 raise TypeError("max_size must be int")3312 self.__max_size = value3313 max_size = property(_get_max_size, _set_max_size)3314 """3315 The maximum size in bytes for the entire stream. Set to 256MB by default with a minimum of 1KB and a maximum of 8192PB.3316 """3317 def _get_stream_segment_size(self):3318 return self.__stream_segment_size3319 def _set_stream_segment_size(self, value):3320 if value is not None and not isinstance(value, int):3321 raise TypeError("stream_segment_size must be int")3322 self.__stream_segment_size = value3323 stream_segment_size = property(_get_stream_segment_size, _set_stream_segment_size)3324 """3325 The size of each segment of the stream. Set to 16MB by default with a minimum of 1KB and a maximum of 2GB.3326 Data is only deleted segment by segment, so the segment size is the smallest amount of data which can be deleted.3327 """3328 def _get_time_to_live_millis(self):3329 return self.__time_to_live_millis3330 def _set_time_to_live_millis(self, value):3331 if value is not None and not isinstance(value, int):3332 raise TypeError("time_to_live_millis must be int")3333 self.__time_to_live_millis = value3334 time_to_live_millis = property(_get_time_to_live_millis, _set_time_to_live_millis)3335 """3336 Time to live for each message in milliseconds. Data may be deleted at any time after the TTL expires; deletion is not guaranteed to occur immediately when the TTL expires.3337 The minimum value is 60000 milliseconds and the maximum is 9223372036854 milliseconds.3338 """3339 def _get_strategy_on_full(self):3340 return self.__strategy_on_full3341 def _set_strategy_on_full(self, value):3342 if not isinstance(value, StrategyOnFull):3343 raise TypeError("strategy_on_full must be StrategyOnFull")3344 self.__strategy_on_full = value3345 strategy_on_full = property(_get_strategy_on_full, _set_strategy_on_full)3346 """3347 What to do when the maximum size of the stream is reached.3348 RejectNewData: any append message request after the stream is full will be rejected with an exception.3349 OverwriteOldestData: the oldest stream segments will be deleted until there is room for the new message.3350 """3351 def _get_persistence(self):3352 return self.__persistence3353 def _set_persistence(self, value):3354 if value is not None and not isinstance(value, Persistence):3355 raise TypeError("persistence must be Persistence")3356 self.__persistence = value3357 persistence = property(_get_persistence, _set_persistence)3358 """3359 Stream persistence. If set to File, the file system will be used to persist messages long-term and is resilient to restarts.3360 Memory should be used when performance matters more than durability as it only stores the stream in memory and never writes to the disk.3361 """3362 def _get_flush_on_write(self):3363 return self.__flush_on_write3364 def _set_flush_on_write(self, value):3365 if value is not None and not isinstance(value, bool):3366 raise TypeError("flush_on_write must be bool")3367 self.__flush_on_write = value3368 flush_on_write = property(_get_flush_on_write, _set_flush_on_write)3369 """3370 This only applies when Persistence is set to File mode.3371 Waits for the filesystem to complete the write for every message. This is safer, but slower. Default is false.3372 """3373 def _get_export_definition(self):3374 return self.__export_definition3375 def _set_export_definition(self, value):3376 if value is not None and not isinstance(value, ExportDefinition):3377 raise TypeError("export_definition must be ExportDefinition")3378 self.__export_definition = value3379 export_definition = property(_get_export_definition, _set_export_definition)3380 """3381 Defines how and where the stream is uploaded. See the definition of the ExportDefinition object for more detail.3382 """3383 @staticmethod3384 def from_dict(d):3385 v = {}3386 if "name" in d:3387 v["name"] = (3388 str.from_dict(d["name"]) if hasattr(str, "from_dict") else d["name"]3389 )3390 if "maxSize" in d:3391 v["max_size"] = (3392 int.from_dict(d["maxSize"])3393 if hasattr(int, "from_dict")3394 else d["maxSize"]3395 )3396 if "streamSegmentSize" in d:3397 v["stream_segment_size"] = (3398 int.from_dict(d["streamSegmentSize"])3399 if hasattr(int, "from_dict")3400 else d["streamSegmentSize"]3401 )3402 if "timeToLiveMillis" in d:3403 v["time_to_live_millis"] = (3404 int.from_dict(d["timeToLiveMillis"])3405 if hasattr(int, "from_dict")3406 else d["timeToLiveMillis"]3407 )3408 if "strategyOnFull" in d:3409 v["strategy_on_full"] = (3410 StrategyOnFull.from_dict(d["strategyOnFull"])3411 if hasattr(StrategyOnFull, "from_dict")3412 else d["strategyOnFull"]3413 )3414 if "persistence" in d:3415 v["persistence"] = (3416 Persistence.from_dict(d["persistence"])3417 if hasattr(Persistence, "from_dict")3418 else d["persistence"]3419 )3420 if "flushOnWrite" in d:3421 v["flush_on_write"] = (3422 bool.from_dict(d["flushOnWrite"])3423 if hasattr(bool, "from_dict")3424 else d["flushOnWrite"]3425 )3426 if "exportDefinition" in d:3427 v["export_definition"] = (3428 ExportDefinition.from_dict(d["exportDefinition"])3429 if hasattr(ExportDefinition, "from_dict")3430 else d["exportDefinition"]3431 )3432 return MessageStreamDefinition(**v)3433 def as_dict(self):3434 d = {}3435 if self.__name is not None:3436 d["name"] = (3437 self.__name.as_dict()3438 if hasattr(self.__name, "as_dict")3439 else self.__name3440 )3441 if self.__max_size is not None:3442 d["maxSize"] = (3443 self.__max_size.as_dict()3444 if hasattr(self.__max_size, "as_dict")3445 else self.__max_size3446 )3447 if self.__stream_segment_size is not None:3448 d["streamSegmentSize"] = (3449 self.__stream_segment_size.as_dict()3450 if hasattr(self.__stream_segment_size, "as_dict")3451 else self.__stream_segment_size3452 )3453 if self.__time_to_live_millis is not None:3454 d["timeToLiveMillis"] = (3455 self.__time_to_live_millis.as_dict()3456 if hasattr(self.__time_to_live_millis, "as_dict")3457 else self.__time_to_live_millis3458 )3459 if self.__strategy_on_full is not None:3460 d["strategyOnFull"] = (3461 self.__strategy_on_full.as_dict()3462 if hasattr(self.__strategy_on_full, "as_dict")3463 else self.__strategy_on_full3464 )3465 if self.__persistence is not None:3466 d["persistence"] = (3467 self.__persistence.as_dict()3468 if hasattr(self.__persistence, "as_dict")3469 else self.__persistence3470 )3471 if self.__flush_on_write is not None:3472 d["flushOnWrite"] = (3473 self.__flush_on_write.as_dict()3474 if hasattr(self.__flush_on_write, "as_dict")3475 else self.__flush_on_write3476 )3477 if self.__export_definition is not None:3478 d["exportDefinition"] = (3479 self.__export_definition.as_dict()3480 if hasattr(self.__export_definition, "as_dict")3481 else self.__export_definition3482 )3483 return d3484 def __repr__(self):3485 return "<Class MessageStreamDefinition. name: {}, max_size: {}, stream_segment_size: {}, time_to_live_millis: {}, strategy_on_full: {}, persistence: {}, flush_on_write: {}, export_definition: {}>".format(3486 limitedRepr(3487 self.__name[:20] if isinstance(self.__name, bytes) else self.__name3488 ),3489 limitedRepr(3490 self.__max_size[:20]3491 if isinstance(self.__max_size, bytes)3492 else self.__max_size3493 ),3494 limitedRepr(3495 self.__stream_segment_size[:20]3496 if isinstance(self.__stream_segment_size, bytes)3497 else self.__stream_segment_size3498 ),3499 limitedRepr(3500 self.__time_to_live_millis[:20]3501 if isinstance(self.__time_to_live_millis, bytes)3502 else self.__time_to_live_millis3503 ),3504 limitedRepr(3505 self.__strategy_on_full[:20]3506 if isinstance(self.__strategy_on_full, bytes)3507 else self.__strategy_on_full3508 ),3509 limitedRepr(3510 self.__persistence[:20]3511 if isinstance(self.__persistence, bytes)3512 else self.__persistence3513 ),3514 limitedRepr(3515 self.__flush_on_write[:20]3516 if isinstance(self.__flush_on_write, bytes)3517 else self.__flush_on_write3518 ),3519 limitedRepr(3520 self.__export_definition[:20]3521 if isinstance(self.__export_definition, bytes)3522 else self.__export_definition3523 ),3524 )3525class CreateMessageStreamRequest:3526 """3527 (Internal Only) Request object for creating a message stream.3528 """3529 __slots__ = [3530 "__request_id",3531 "__definition",3532 ]3533 _types_map = {3534 "request_id": {"type": str, "subtype": None},3535 "definition": {"type": MessageStreamDefinition, "subtype": None},3536 }3537 _formats_map = {}3538 _validations_map = {3539 "request_id": {3540 "required": True,3541 "minLength": 1,3542 "pattern": "^[\w ,.\-_]*$",3543 },3544 "definition": {3545 "required": True,3546 },3547 }3548 def __init__(3549 self, request_id: str = None, definition: MessageStreamDefinition = None3550 ):3551 pass3552 self.__request_id = request_id3553 self.__definition = definition3554 def _get_request_id(self):3555 return self.__request_id3556 def _set_request_id(self, value):3557 if not isinstance(value, str):3558 raise TypeError("request_id must be str")3559 self.__request_id = value3560 request_id = property(_get_request_id, _set_request_id)3561 def _get_definition(self):3562 return self.__definition3563 def _set_definition(self, value):3564 if not isinstance(value, MessageStreamDefinition):3565 raise TypeError("definition must be MessageStreamDefinition")3566 self.__definition = value3567 definition = property(_get_definition, _set_definition)3568 @staticmethod3569 def from_dict(d):3570 v = {}3571 if "requestId" in d:3572 v["request_id"] = (3573 str.from_dict(d["requestId"])3574 if hasattr(str, "from_dict")3575 else d["requestId"]3576 )3577 if "definition" in d:3578 v["definition"] = (3579 MessageStreamDefinition.from_dict(d["definition"])3580 if hasattr(MessageStreamDefinition, "from_dict")3581 else d["definition"]3582 )3583 return CreateMessageStreamRequest(**v)3584 def as_dict(self):3585 d = {}3586 if self.__request_id is not None:3587 d["requestId"] = (3588 self.__request_id.as_dict()3589 if hasattr(self.__request_id, "as_dict")3590 else self.__request_id3591 )3592 if self.__definition is not None:3593 d["definition"] = (3594 self.__definition.as_dict()3595 if hasattr(self.__definition, "as_dict")3596 else self.__definition3597 )3598 return d3599 def __repr__(self):3600 return (3601 "<Class CreateMessageStreamRequest. request_id: {}, definition: {}>".format(3602 limitedRepr(3603 self.__request_id[:20]3604 if isinstance(self.__request_id, bytes)3605 else self.__request_id3606 ),3607 limitedRepr(3608 self.__definition[:20]3609 if isinstance(self.__definition, bytes)3610 else self.__definition3611 ),3612 )3613 )3614class CreateMessageStreamResponse:3615 """3616 Internal Only.3617 """3618 __slots__ = [3619 "__request_id",3620 "__status",3621 "__error_message",3622 ]3623 _types_map = {3624 "request_id": {"type": str, "subtype": None},3625 "status": {"type": ResponseStatusCode, "subtype": None},3626 "error_message": {"type": str, "subtype": None},3627 }3628 _formats_map = {}3629 _validations_map = {3630 "request_id": {3631 "required": True,3632 "minLength": 1,3633 "pattern": "^[\w ,.\-_]*$",3634 },3635 "status": {3636 "required": True,3637 },3638 "error_message": {3639 "required": False,3640 },3641 }3642 def __init__(3643 self,3644 request_id: str = None,3645 status: ResponseStatusCode = None,3646 error_message: str = None,3647 ):3648 pass3649 self.__request_id = request_id3650 self.__status = status3651 self.__error_message = error_message3652 def _get_request_id(self):3653 return self.__request_id3654 def _set_request_id(self, value):3655 if not isinstance(value, str):3656 raise TypeError("request_id must be str")3657 self.__request_id = value3658 request_id = property(_get_request_id, _set_request_id)3659 def _get_status(self):3660 return self.__status3661 def _set_status(self, value):3662 if not isinstance(value, ResponseStatusCode):3663 raise TypeError("status must be ResponseStatusCode")3664 self.__status = value3665 status = property(_get_status, _set_status)3666 def _get_error_message(self):3667 return self.__error_message3668 def _set_error_message(self, value):3669 if value is not None and not isinstance(value, str):3670 raise TypeError("error_message must be str")3671 self.__error_message = value3672 error_message = property(_get_error_message, _set_error_message)3673 @staticmethod3674 def from_dict(d):3675 v = {}3676 if "requestId" in d:3677 v["request_id"] = (3678 str.from_dict(d["requestId"])3679 if hasattr(str, "from_dict")3680 else d["requestId"]3681 )3682 if "status" in d:3683 v["status"] = (3684 ResponseStatusCode.from_dict(d["status"])3685 if hasattr(ResponseStatusCode, "from_dict")3686 else d["status"]3687 )3688 if "errorMessage" in d:3689 v["error_message"] = (3690 str.from_dict(d["errorMessage"])3691 if hasattr(str, "from_dict")3692 else d["errorMessage"]3693 )3694 return CreateMessageStreamResponse(**v)3695 def as_dict(self):3696 d = {}3697 if self.__request_id is not None:3698 d["requestId"] = (3699 self.__request_id.as_dict()3700 if hasattr(self.__request_id, "as_dict")3701 else self.__request_id3702 )3703 if self.__status is not None:3704 d["status"] = (3705 self.__status.as_dict()3706 if hasattr(self.__status, "as_dict")3707 else self.__status3708 )3709 if self.__error_message is not None:3710 d["errorMessage"] = (3711 self.__error_message.as_dict()3712 if hasattr(self.__error_message, "as_dict")3713 else self.__error_message3714 )3715 return d3716 def __repr__(self):3717 return "<Class CreateMessageStreamResponse. request_id: {}, status: {}, error_message: {}>".format(3718 limitedRepr(3719 self.__request_id[:20]3720 if isinstance(self.__request_id, bytes)3721 else self.__request_id3722 ),3723 limitedRepr(3724 self.__status[:20]3725 if isinstance(self.__status, bytes)3726 else self.__status3727 ),3728 limitedRepr(3729 self.__error_message[:20]3730 if isinstance(self.__error_message, bytes)3731 else self.__error_message3732 ),3733 )3734class UpdateMessageStreamRequest:3735 """3736 (Internal Only) Request object for updating a message stream.3737 """3738 __slots__ = [3739 "__request_id",3740 "__definition",3741 ]3742 _types_map = {3743 "request_id": {"type": str, "subtype": None},3744 "definition": {"type": MessageStreamDefinition, "subtype": None},3745 }3746 _formats_map = {}3747 _validations_map = {3748 "request_id": {3749 "required": True,3750 "minLength": 1,3751 "pattern": "^[\w ,.\-_]*$",3752 },3753 "definition": {3754 "required": True,3755 },3756 }3757 def __init__(3758 self, request_id: str = None, definition: MessageStreamDefinition = None3759 ):3760 pass3761 self.__request_id = request_id3762 self.__definition = definition3763 def _get_request_id(self):3764 return self.__request_id3765 def _set_request_id(self, value):3766 if not isinstance(value, str):3767 raise TypeError("request_id must be str")3768 self.__request_id = value3769 request_id = property(_get_request_id, _set_request_id)3770 def _get_definition(self):3771 return self.__definition3772 def _set_definition(self, value):3773 if not isinstance(value, MessageStreamDefinition):3774 raise TypeError("definition must be MessageStreamDefinition")3775 self.__definition = value3776 definition = property(_get_definition, _set_definition)3777 @staticmethod3778 def from_dict(d):3779 v = {}3780 if "requestId" in d:3781 v["request_id"] = (3782 str.from_dict(d["requestId"])3783 if hasattr(str, "from_dict")3784 else d["requestId"]3785 )3786 if "definition" in d:3787 v["definition"] = (3788 MessageStreamDefinition.from_dict(d["definition"])3789 if hasattr(MessageStreamDefinition, "from_dict")3790 else d["definition"]3791 )3792 return UpdateMessageStreamRequest(**v)3793 def as_dict(self):3794 d = {}3795 if self.__request_id is not None:3796 d["requestId"] = (3797 self.__request_id.as_dict()3798 if hasattr(self.__request_id, "as_dict")3799 else self.__request_id3800 )3801 if self.__definition is not None:3802 d["definition"] = (3803 self.__definition.as_dict()3804 if hasattr(self.__definition, "as_dict")3805 else self.__definition3806 )3807 return d3808 def __repr__(self):3809 return (3810 "<Class UpdateMessageStreamRequest. request_id: {}, definition: {}>".format(3811 limitedRepr(3812 self.__request_id[:20]3813 if isinstance(self.__request_id, bytes)3814 else self.__request_id3815 ),3816 limitedRepr(3817 self.__definition[:20]3818 if isinstance(self.__definition, bytes)3819 else self.__definition3820 ),3821 )3822 )3823class UpdateMessageStreamResponse:3824 """3825 (Internal Only) Response for UpdateMessageStreamRequest.3826 """3827 __slots__ = [3828 "__request_id",3829 "__status",3830 "__error_message",3831 ]3832 _types_map = {3833 "request_id": {"type": str, "subtype": None},3834 "status": {"type": ResponseStatusCode, "subtype": None},3835 "error_message": {"type": str, "subtype": None},3836 }3837 _formats_map = {}3838 _validations_map = {3839 "request_id": {3840 "required": True,3841 "minLength": 1,3842 "pattern": "^[\w ,.\-_]*$",3843 },3844 "status": {3845 "required": True,3846 },3847 "error_message": {3848 "required": False,3849 },3850 }3851 def __init__(3852 self,3853 request_id: str = None,3854 status: ResponseStatusCode = None,3855 error_message: str = None,3856 ):3857 pass3858 self.__request_id = request_id3859 self.__status = status3860 self.__error_message = error_message3861 def _get_request_id(self):3862 return self.__request_id3863 def _set_request_id(self, value):3864 if not isinstance(value, str):3865 raise TypeError("request_id must be str")3866 self.__request_id = value3867 request_id = property(_get_request_id, _set_request_id)3868 def _get_status(self):3869 return self.__status3870 def _set_status(self, value):3871 if not isinstance(value, ResponseStatusCode):3872 raise TypeError("status must be ResponseStatusCode")3873 self.__status = value3874 status = property(_get_status, _set_status)3875 def _get_error_message(self):3876 return self.__error_message3877 def _set_error_message(self, value):3878 if value is not None and not isinstance(value, str):3879 raise TypeError("error_message must be str")3880 self.__error_message = value3881 error_message = property(_get_error_message, _set_error_message)3882 @staticmethod3883 def from_dict(d):3884 v = {}3885 if "requestId" in d:3886 v["request_id"] = (3887 str.from_dict(d["requestId"])3888 if hasattr(str, "from_dict")3889 else d["requestId"]3890 )3891 if "status" in d:3892 v["status"] = (3893 ResponseStatusCode.from_dict(d["status"])3894 if hasattr(ResponseStatusCode, "from_dict")3895 else d["status"]3896 )3897 if "errorMessage" in d:3898 v["error_message"] = (3899 str.from_dict(d["errorMessage"])3900 if hasattr(str, "from_dict")3901 else d["errorMessage"]3902 )3903 return UpdateMessageStreamResponse(**v)3904 def as_dict(self):3905 d = {}3906 if self.__request_id is not None:3907 d["requestId"] = (3908 self.__request_id.as_dict()3909 if hasattr(self.__request_id, "as_dict")3910 else self.__request_id3911 )3912 if self.__status is not None:3913 d["status"] = (3914 self.__status.as_dict()3915 if hasattr(self.__status, "as_dict")3916 else self.__status3917 )3918 if self.__error_message is not None:3919 d["errorMessage"] = (3920 self.__error_message.as_dict()3921 if hasattr(self.__error_message, "as_dict")3922 else self.__error_message3923 )3924 return d3925 def __repr__(self):3926 return "<Class UpdateMessageStreamResponse. request_id: {}, status: {}, error_message: {}>".format(3927 limitedRepr(3928 self.__request_id[:20]3929 if isinstance(self.__request_id, bytes)3930 else self.__request_id3931 ),3932 limitedRepr(3933 self.__status[:20]3934 if isinstance(self.__status, bytes)3935 else self.__status3936 ),3937 limitedRepr(3938 self.__error_message[:20]3939 if isinstance(self.__error_message, bytes)3940 else self.__error_message3941 ),3942 )3943class DeleteMessageStreamRequest:3944 """3945 (Internal Only) Request object for deleting a message stream.3946 """3947 __slots__ = [3948 "__request_id",3949 "__name",3950 ]3951 _types_map = {3952 "request_id": {"type": str, "subtype": None},3953 "name": {"type": str, "subtype": None},3954 }3955 _formats_map = {}3956 _validations_map = {3957 "request_id": {3958 "required": True,3959 "minLength": 1,3960 "pattern": "^[\w ,.\-_]*$",3961 },3962 "name": {3963 "required": True,3964 "minLength": 1,3965 "maxLength": 255,3966 "pattern": "^[\w ,.\-_]*$",3967 },3968 }3969 def __init__(self, request_id: str = None, name: str = None):3970 pass3971 self.__request_id = request_id3972 self.__name = name3973 def _get_request_id(self):3974 return self.__request_id3975 def _set_request_id(self, value):3976 if not isinstance(value, str):3977 raise TypeError("request_id must be str")3978 self.__request_id = value3979 request_id = property(_get_request_id, _set_request_id)3980 def _get_name(self):3981 return self.__name3982 def _set_name(self, value):3983 if not isinstance(value, str):3984 raise TypeError("name must be str")3985 self.__name = value3986 name = property(_get_name, _set_name)3987 @staticmethod3988 def from_dict(d):3989 v = {}3990 if "requestId" in d:3991 v["request_id"] = (3992 str.from_dict(d["requestId"])3993 if hasattr(str, "from_dict")3994 else d["requestId"]3995 )3996 if "name" in d:3997 v["name"] = (3998 str.from_dict(d["name"]) if hasattr(str, "from_dict") else d["name"]3999 )4000 return DeleteMessageStreamRequest(**v)4001 def as_dict(self):4002 d = {}4003 if self.__request_id is not None:4004 d["requestId"] = (4005 self.__request_id.as_dict()4006 if hasattr(self.__request_id, "as_dict")4007 else self.__request_id4008 )4009 if self.__name is not None:4010 d["name"] = (4011 self.__name.as_dict()4012 if hasattr(self.__name, "as_dict")4013 else self.__name4014 )4015 return d4016 def __repr__(self):4017 return "<Class DeleteMessageStreamRequest. request_id: {}, name: {}>".format(4018 limitedRepr(4019 self.__request_id[:20]4020 if isinstance(self.__request_id, bytes)4021 else self.__request_id4022 ),4023 limitedRepr(4024 self.__name[:20] if isinstance(self.__name, bytes) else self.__name4025 ),4026 )4027class DeleteMessageStreamResponse:4028 """4029 Internal Only.4030 """4031 __slots__ = [4032 "__request_id",4033 "__status",4034 "__error_message",4035 ]4036 _types_map = {4037 "request_id": {"type": str, "subtype": None},4038 "status": {"type": ResponseStatusCode, "subtype": None},4039 "error_message": {"type": str, "subtype": None},4040 }4041 _formats_map = {}4042 _validations_map = {4043 "request_id": {4044 "required": True,4045 "minLength": 1,4046 "pattern": "^[\w ,.\-_]*$",4047 },4048 "status": {4049 "required": True,4050 },4051 "error_message": {4052 "required": False,4053 },4054 }4055 def __init__(4056 self,4057 request_id: str = None,4058 status: ResponseStatusCode = None,4059 error_message: str = None,4060 ):4061 pass4062 self.__request_id = request_id4063 self.__status = status4064 self.__error_message = error_message4065 def _get_request_id(self):4066 return self.__request_id4067 def _set_request_id(self, value):4068 if not isinstance(value, str):4069 raise TypeError("request_id must be str")4070 self.__request_id = value4071 request_id = property(_get_request_id, _set_request_id)4072 def _get_status(self):4073 return self.__status4074 def _set_status(self, value):4075 if not isinstance(value, ResponseStatusCode):4076 raise TypeError("status must be ResponseStatusCode")4077 self.__status = value4078 status = property(_get_status, _set_status)4079 def _get_error_message(self):4080 return self.__error_message4081 def _set_error_message(self, value):4082 if value is not None and not isinstance(value, str):4083 raise TypeError("error_message must be str")4084 self.__error_message = value4085 error_message = property(_get_error_message, _set_error_message)4086 @staticmethod4087 def from_dict(d):4088 v = {}4089 if "requestId" in d:4090 v["request_id"] = (4091 str.from_dict(d["requestId"])4092 if hasattr(str, "from_dict")4093 else d["requestId"]4094 )4095 if "status" in d:4096 v["status"] = (4097 ResponseStatusCode.from_dict(d["status"])4098 if hasattr(ResponseStatusCode, "from_dict")4099 else d["status"]4100 )4101 if "errorMessage" in d:4102 v["error_message"] = (4103 str.from_dict(d["errorMessage"])4104 if hasattr(str, "from_dict")4105 else d["errorMessage"]4106 )4107 return DeleteMessageStreamResponse(**v)4108 def as_dict(self):4109 d = {}4110 if self.__request_id is not None:4111 d["requestId"] = (4112 self.__request_id.as_dict()4113 if hasattr(self.__request_id, "as_dict")4114 else self.__request_id4115 )4116 if self.__status is not None:4117 d["status"] = (4118 self.__status.as_dict()4119 if hasattr(self.__status, "as_dict")4120 else self.__status4121 )4122 if self.__error_message is not None:4123 d["errorMessage"] = (4124 self.__error_message.as_dict()4125 if hasattr(self.__error_message, "as_dict")4126 else self.__error_message4127 )4128 return d4129 def __repr__(self):4130 return "<Class DeleteMessageStreamResponse. request_id: {}, status: {}, error_message: {}>".format(4131 limitedRepr(4132 self.__request_id[:20]4133 if isinstance(self.__request_id, bytes)4134 else self.__request_id4135 ),4136 limitedRepr(4137 self.__status[:20]4138 if isinstance(self.__status, bytes)4139 else self.__status4140 ),4141 limitedRepr(4142 self.__error_message[:20]4143 if isinstance(self.__error_message, bytes)4144 else self.__error_message4145 ),4146 )4147class DescribeMessageStreamRequest:4148 """4149 (Internal Only) Request object for describing a message stream.4150 """4151 __slots__ = [4152 "__request_id",4153 "__name",4154 ]4155 _types_map = {4156 "request_id": {"type": str, "subtype": None},4157 "name": {"type": str, "subtype": None},4158 }4159 _formats_map = {}4160 _validations_map = {4161 "request_id": {4162 "required": True,4163 "minLength": 1,4164 "pattern": "^[\w ,.\-_]*$",4165 },4166 "name": {4167 "required": True,4168 "minLength": 1,4169 "maxLength": 255,4170 "pattern": "^[\w ,.\-_]*$",4171 },4172 }4173 def __init__(self, request_id: str = None, name: str = None):4174 pass4175 self.__request_id = request_id4176 self.__name = name4177 def _get_request_id(self):4178 return self.__request_id4179 def _set_request_id(self, value):4180 if not isinstance(value, str):4181 raise TypeError("request_id must be str")4182 self.__request_id = value4183 request_id = property(_get_request_id, _set_request_id)4184 def _get_name(self):4185 return self.__name4186 def _set_name(self, value):4187 if not isinstance(value, str):4188 raise TypeError("name must be str")4189 self.__name = value4190 name = property(_get_name, _set_name)4191 @staticmethod4192 def from_dict(d):4193 v = {}4194 if "requestId" in d:4195 v["request_id"] = (4196 str.from_dict(d["requestId"])4197 if hasattr(str, "from_dict")4198 else d["requestId"]4199 )4200 if "name" in d:4201 v["name"] = (4202 str.from_dict(d["name"]) if hasattr(str, "from_dict") else d["name"]4203 )4204 return DescribeMessageStreamRequest(**v)4205 def as_dict(self):4206 d = {}4207 if self.__request_id is not None:4208 d["requestId"] = (4209 self.__request_id.as_dict()4210 if hasattr(self.__request_id, "as_dict")4211 else self.__request_id4212 )4213 if self.__name is not None:4214 d["name"] = (4215 self.__name.as_dict()4216 if hasattr(self.__name, "as_dict")4217 else self.__name4218 )4219 return d4220 def __repr__(self):4221 return "<Class DescribeMessageStreamRequest. request_id: {}, name: {}>".format(4222 limitedRepr(4223 self.__request_id[:20]4224 if isinstance(self.__request_id, bytes)4225 else self.__request_id4226 ),4227 limitedRepr(4228 self.__name[:20] if isinstance(self.__name, bytes) else self.__name4229 ),4230 )4231class MessageStreamInfo:4232 """4233 Message stream information including its definition, storage status and export status.4234 """4235 class storageStatus:4236 """4237 Stream status including oldest/newest sequence number and total bytes.4238 """4239 __slots__ = [4240 "__oldest_sequence_number",4241 "__newest_sequence_number",4242 "__total_bytes",4243 ]4244 _types_map = {4245 "oldest_sequence_number": {"type": int, "subtype": None},4246 "newest_sequence_number": {"type": int, "subtype": None},4247 "total_bytes": {"type": int, "subtype": None},4248 }4249 _formats_map = {}4250 _validations_map = {4251 "oldest_sequence_number": {4252 "required": False,4253 },4254 "newest_sequence_number": {4255 "required": False,4256 },4257 "total_bytes": {4258 "required": False,4259 },4260 }4261 def __init__(4262 self,4263 oldest_sequence_number: int = None,4264 newest_sequence_number: int = None,4265 total_bytes: int = None,4266 ):4267 """4268 :param oldest_sequence_number: The sequence number of the first message which is still accessible in the stream.4269 :param newest_sequence_number: The sequence number of the last appended message.4270 :param total_bytes: The current total size of the stream in bytes.4271 """4272 pass4273 self.__oldest_sequence_number = oldest_sequence_number4274 self.__newest_sequence_number = newest_sequence_number4275 self.__total_bytes = total_bytes4276 def _get_oldest_sequence_number(self):4277 return self.__oldest_sequence_number4278 def _set_oldest_sequence_number(self, value):4279 if value is not None and not isinstance(value, int):4280 raise TypeError("oldest_sequence_number must be int")4281 self.__oldest_sequence_number = value4282 oldest_sequence_number = property(4283 _get_oldest_sequence_number, _set_oldest_sequence_number4284 )4285 """4286 The sequence number of the first message which is still accessible in the stream.4287 """4288 def _get_newest_sequence_number(self):4289 return self.__newest_sequence_number4290 def _set_newest_sequence_number(self, value):4291 if value is not None and not isinstance(value, int):4292 raise TypeError("newest_sequence_number must be int")4293 self.__newest_sequence_number = value4294 newest_sequence_number = property(4295 _get_newest_sequence_number, _set_newest_sequence_number4296 )4297 """4298 The sequence number of the last appended message.4299 """4300 def _get_total_bytes(self):4301 return self.__total_bytes4302 def _set_total_bytes(self, value):4303 if value is not None and not isinstance(value, int):4304 raise TypeError("total_bytes must be int")4305 self.__total_bytes = value4306 total_bytes = property(_get_total_bytes, _set_total_bytes)4307 """4308 The current total size of the stream in bytes.4309 """4310 @staticmethod4311 def from_dict(d):4312 v = {}4313 if "oldestSequenceNumber" in d:4314 v["oldest_sequence_number"] = (4315 int.from_dict(d["oldestSequenceNumber"])4316 if hasattr(int, "from_dict")4317 else d["oldestSequenceNumber"]4318 )4319 if "newestSequenceNumber" in d:4320 v["newest_sequence_number"] = (4321 int.from_dict(d["newestSequenceNumber"])4322 if hasattr(int, "from_dict")4323 else d["newestSequenceNumber"]4324 )4325 if "totalBytes" in d:4326 v["total_bytes"] = (4327 int.from_dict(d["totalBytes"])4328 if hasattr(int, "from_dict")4329 else d["totalBytes"]4330 )4331 return MessageStreamInfo.storageStatus(**v)4332 def as_dict(self):4333 d = {}4334 if self.__oldest_sequence_number is not None:4335 d["oldestSequenceNumber"] = (4336 self.__oldest_sequence_number.as_dict()4337 if hasattr(self.__oldest_sequence_number, "as_dict")4338 else self.__oldest_sequence_number4339 )4340 if self.__newest_sequence_number is not None:4341 d["newestSequenceNumber"] = (4342 self.__newest_sequence_number.as_dict()4343 if hasattr(self.__newest_sequence_number, "as_dict")4344 else self.__newest_sequence_number4345 )4346 if self.__total_bytes is not None:4347 d["totalBytes"] = (4348 self.__total_bytes.as_dict()4349 if hasattr(self.__total_bytes, "as_dict")4350 else self.__total_bytes4351 )4352 return d4353 def __repr__(self):4354 return "<Class storageStatus. oldest_sequence_number: {}, newest_sequence_number: {}, total_bytes: {}>".format(4355 limitedRepr(4356 self.__oldest_sequence_number[:20]4357 if isinstance(self.__oldest_sequence_number, bytes)4358 else self.__oldest_sequence_number4359 ),4360 limitedRepr(4361 self.__newest_sequence_number[:20]4362 if isinstance(self.__newest_sequence_number, bytes)4363 else self.__newest_sequence_number4364 ),4365 limitedRepr(4366 self.__total_bytes[:20]4367 if isinstance(self.__total_bytes, bytes)4368 else self.__total_bytes4369 ),4370 )4371 class exportStatuses:4372 """4373 Export status including the export identifier and the last exported sequence number for that export task.4374 """4375 __slots__ = [4376 "__export_config_identifier",4377 "__last_exported_sequence_number",4378 "__last_export_time",4379 "__error_message",4380 "__exported_bytes_from_stream",4381 "__exported_messages_count",4382 ]4383 _types_map = {4384 "export_config_identifier": {"type": str, "subtype": None},4385 "last_exported_sequence_number": {"type": int, "subtype": None},4386 "last_export_time": {"type": int, "subtype": None},4387 "error_message": {"type": str, "subtype": None},4388 "exported_bytes_from_stream": {"type": int, "subtype": None},4389 "exported_messages_count": {"type": int, "subtype": None},4390 }4391 _formats_map = {}4392 _validations_map = {4393 "export_config_identifier": {4394 "required": False,4395 },4396 "last_exported_sequence_number": {4397 "required": True,4398 },4399 "last_export_time": {4400 "required": False,4401 },4402 "error_message": {4403 "required": False,4404 },4405 "exported_bytes_from_stream": {4406 "required": False,4407 },4408 "exported_messages_count": {4409 "required": False,4410 },4411 }4412 def __init__(4413 self,4414 export_config_identifier: str = None,4415 last_exported_sequence_number: int = None,4416 last_export_time: int = None,4417 error_message: str = None,4418 exported_bytes_from_stream: int = None,4419 exported_messages_count: int = None,4420 ):4421 """4422 :param export_config_identifier: The unique export identifier.4423 :param last_exported_sequence_number: The sequence number of the last message which was successfully exported.4424 :param last_export_time: The last time an export was attempted. Data is Unix epoch time in milliseconds.4425 :param error_message: Error message from the last export attempt if it failed.4426 :param exported_bytes_from_stream: Total bytes exported from the stream for this Export Config. It does not include the failed export attempts or messages which are skipped because of some non-retryable error.4427 :param exported_messages_count: Total messages exported/processed.4428 """4429 pass4430 self.__export_config_identifier = export_config_identifier4431 self.__last_exported_sequence_number = last_exported_sequence_number4432 self.__last_export_time = last_export_time4433 self.__error_message = error_message4434 self.__exported_bytes_from_stream = exported_bytes_from_stream4435 self.__exported_messages_count = exported_messages_count4436 def _get_export_config_identifier(self):4437 return self.__export_config_identifier4438 def _set_export_config_identifier(self, value):4439 if value is not None and not isinstance(value, str):4440 raise TypeError("export_config_identifier must be str")4441 self.__export_config_identifier = value4442 export_config_identifier = property(4443 _get_export_config_identifier, _set_export_config_identifier4444 )4445 """4446 The unique export identifier.4447 """4448 def _get_last_exported_sequence_number(self):4449 return self.__last_exported_sequence_number4450 def _set_last_exported_sequence_number(self, value):4451 if not isinstance(value, int):4452 raise TypeError("last_exported_sequence_number must be int")4453 self.__last_exported_sequence_number = value4454 last_exported_sequence_number = property(4455 _get_last_exported_sequence_number, _set_last_exported_sequence_number4456 )4457 """4458 The sequence number of the last message which was successfully exported.4459 """4460 def _get_last_export_time(self):4461 return self.__last_export_time4462 def _set_last_export_time(self, value):4463 if value is not None and not isinstance(value, int):4464 raise TypeError("last_export_time must be int")4465 self.__last_export_time = value4466 last_export_time = property(_get_last_export_time, _set_last_export_time)4467 """4468 The last time an export was attempted. Data is Unix epoch time in milliseconds.4469 """4470 def _get_error_message(self):4471 return self.__error_message4472 def _set_error_message(self, value):4473 if value is not None and not isinstance(value, str):4474 raise TypeError("error_message must be str")4475 self.__error_message = value4476 error_message = property(_get_error_message, _set_error_message)4477 """4478 Error message from the last export attempt if it failed.4479 """4480 def _get_exported_bytes_from_stream(self):4481 return self.__exported_bytes_from_stream4482 def _set_exported_bytes_from_stream(self, value):4483 if value is not None and not isinstance(value, int):4484 raise TypeError("exported_bytes_from_stream must be int")4485 self.__exported_bytes_from_stream = value4486 exported_bytes_from_stream = property(4487 _get_exported_bytes_from_stream, _set_exported_bytes_from_stream4488 )4489 """4490 Total bytes exported from the stream for this Export Config. It does not include the failed export attempts or messages which are skipped because of some non-retryable error.4491 """4492 def _get_exported_messages_count(self):4493 return self.__exported_messages_count4494 def _set_exported_messages_count(self, value):4495 if value is not None and not isinstance(value, int):4496 raise TypeError("exported_messages_count must be int")4497 self.__exported_messages_count = value4498 exported_messages_count = property(4499 _get_exported_messages_count, _set_exported_messages_count4500 )4501 """4502 Total messages exported/processed.4503 """4504 @staticmethod4505 def from_dict(d):4506 v = {}4507 if "exportConfigIdentifier" in d:4508 v["export_config_identifier"] = (4509 str.from_dict(d["exportConfigIdentifier"])4510 if hasattr(str, "from_dict")4511 else d["exportConfigIdentifier"]4512 )4513 if "lastExportedSequenceNumber" in d:4514 v["last_exported_sequence_number"] = (4515 int.from_dict(d["lastExportedSequenceNumber"])4516 if hasattr(int, "from_dict")4517 else d["lastExportedSequenceNumber"]4518 )4519 if "lastExportTime" in d:4520 v["last_export_time"] = (4521 int.from_dict(d["lastExportTime"])4522 if hasattr(int, "from_dict")4523 else d["lastExportTime"]4524 )4525 if "errorMessage" in d:4526 v["error_message"] = (4527 str.from_dict(d["errorMessage"])4528 if hasattr(str, "from_dict")4529 else d["errorMessage"]4530 )4531 if "exportedBytesFromStream" in d:4532 v["exported_bytes_from_stream"] = (4533 int.from_dict(d["exportedBytesFromStream"])4534 if hasattr(int, "from_dict")4535 else d["exportedBytesFromStream"]4536 )4537 if "exportedMessagesCount" in d:4538 v["exported_messages_count"] = (4539 int.from_dict(d["exportedMessagesCount"])4540 if hasattr(int, "from_dict")4541 else d["exportedMessagesCount"]4542 )4543 return MessageStreamInfo.exportStatuses(**v)4544 def as_dict(self):4545 d = {}4546 if self.__export_config_identifier is not None:4547 d["exportConfigIdentifier"] = (4548 self.__export_config_identifier.as_dict()4549 if hasattr(self.__export_config_identifier, "as_dict")4550 else self.__export_config_identifier4551 )4552 if self.__last_exported_sequence_number is not None:4553 d["lastExportedSequenceNumber"] = (4554 self.__last_exported_sequence_number.as_dict()4555 if hasattr(self.__last_exported_sequence_number, "as_dict")4556 else self.__last_exported_sequence_number4557 )4558 if self.__last_export_time is not None:4559 d["lastExportTime"] = (4560 self.__last_export_time.as_dict()4561 if hasattr(self.__last_export_time, "as_dict")4562 else self.__last_export_time4563 )4564 if self.__error_message is not None:4565 d["errorMessage"] = (4566 self.__error_message.as_dict()4567 if hasattr(self.__error_message, "as_dict")4568 else self.__error_message4569 )4570 if self.__exported_bytes_from_stream is not None:4571 d["exportedBytesFromStream"] = (4572 self.__exported_bytes_from_stream.as_dict()4573 if hasattr(self.__exported_bytes_from_stream, "as_dict")4574 else self.__exported_bytes_from_stream4575 )4576 if self.__exported_messages_count is not None:4577 d["exportedMessagesCount"] = (4578 self.__exported_messages_count.as_dict()4579 if hasattr(self.__exported_messages_count, "as_dict")4580 else self.__exported_messages_count4581 )4582 return d4583 def __repr__(self):4584 return "<Class exportStatuses. export_config_identifier: {}, last_exported_sequence_number: {}, last_export_time: {}, error_message: {}, exported_bytes_from_stream: {}, exported_messages_count: {}>".format(4585 limitedRepr(4586 self.__export_config_identifier[:20]4587 if isinstance(self.__export_config_identifier, bytes)4588 else self.__export_config_identifier4589 ),4590 limitedRepr(4591 self.__last_exported_sequence_number[:20]4592 if isinstance(self.__last_exported_sequence_number, bytes)4593 else self.__last_exported_sequence_number4594 ),4595 limitedRepr(4596 self.__last_export_time[:20]4597 if isinstance(self.__last_export_time, bytes)4598 else self.__last_export_time4599 ),4600 limitedRepr(4601 self.__error_message[:20]4602 if isinstance(self.__error_message, bytes)4603 else self.__error_message4604 ),4605 limitedRepr(4606 self.__exported_bytes_from_stream[:20]4607 if isinstance(self.__exported_bytes_from_stream, bytes)4608 else self.__exported_bytes_from_stream4609 ),4610 limitedRepr(4611 self.__exported_messages_count[:20]4612 if isinstance(self.__exported_messages_count, bytes)4613 else self.__exported_messages_count4614 ),4615 )4616 __slots__ = [4617 "__definition",4618 "__storage_status",4619 "__export_statuses",4620 ]4621 _types_map = {4622 "definition": {"type": MessageStreamDefinition, "subtype": None},4623 "storage_status": {"type": storageStatus, "subtype": None},4624 "export_statuses": {"type": list, "subtype": exportStatuses},4625 }4626 _formats_map = {}4627 _validations_map = {4628 "definition": {4629 "required": True,4630 },4631 "storage_status": {4632 "required": True,4633 },4634 "export_statuses": {4635 "required": False,4636 },4637 }4638 def __init__(4639 self,4640 definition: MessageStreamDefinition = None,4641 storage_status: storageStatus = None,4642 export_statuses: List[exportStatuses] = None,4643 ):4644 """4645 :param storage_status: Stream status including oldest/newest sequence number and total bytes.4646 """4647 pass4648 self.__definition = definition4649 self.__storage_status = storage_status4650 self.__export_statuses = export_statuses4651 def _get_definition(self):4652 return self.__definition4653 def _set_definition(self, value):4654 if not isinstance(value, MessageStreamDefinition):4655 raise TypeError("definition must be MessageStreamDefinition")4656 self.__definition = value4657 definition = property(_get_definition, _set_definition)4658 def _get_storage_status(self):4659 return self.__storage_status4660 def _set_storage_status(self, value):4661 if not isinstance(value, MessageStreamInfo.storageStatus):4662 raise TypeError("storage_status must be MessageStreamInfo.storageStatus")4663 self.__storage_status = value4664 storage_status = property(_get_storage_status, _set_storage_status)4665 """4666 Stream status including oldest/newest sequence number and total bytes.4667 """4668 def _get_export_statuses(self):4669 return self.__export_statuses4670 def _set_export_statuses(self, value):4671 if value is not None and not isinstance(value, list):4672 raise TypeError("export_statuses must be list")4673 if value is not None and not all(4674 isinstance(i, MessageStreamInfo.exportStatuses) for i in value4675 ):4676 raise TypeError(4677 "export_statuses list values must be MessageStreamInfo.exportStatuses"4678 )4679 self.__export_statuses = value4680 export_statuses = property(_get_export_statuses, _set_export_statuses)4681 @staticmethod4682 def from_dict(d):4683 v = {}4684 if "definition" in d:4685 v["definition"] = (4686 MessageStreamDefinition.from_dict(d["definition"])4687 if hasattr(MessageStreamDefinition, "from_dict")4688 else d["definition"]4689 )4690 if "storageStatus" in d:4691 v["storage_status"] = (4692 MessageStreamInfo.storageStatus.from_dict(d["storageStatus"])4693 if hasattr(MessageStreamInfo.storageStatus, "from_dict")4694 else d["storageStatus"]4695 )4696 if "exportStatuses" in d:4697 v["export_statuses"] = [4698 MessageStreamInfo.exportStatuses.from_dict(p)4699 if hasattr(MessageStreamInfo.exportStatuses, "from_dict")4700 else p4701 for p in d["exportStatuses"]4702 ]4703 return MessageStreamInfo(**v)4704 def as_dict(self):4705 d = {}4706 if self.__definition is not None:4707 d["definition"] = (4708 self.__definition.as_dict()4709 if hasattr(self.__definition, "as_dict")4710 else self.__definition4711 )4712 if self.__storage_status is not None:4713 d["storageStatus"] = (4714 self.__storage_status.as_dict()4715 if hasattr(self.__storage_status, "as_dict")4716 else self.__storage_status4717 )4718 if self.__export_statuses is not None:4719 d["exportStatuses"] = [4720 p.as_dict() if hasattr(p, "as_dict") else p4721 for p in self.__export_statuses4722 ]4723 return d4724 def __repr__(self):4725 return "<Class MessageStreamInfo. definition: {}, storage_status: {}, export_statuses: {}>".format(4726 limitedRepr(4727 self.__definition[:20]4728 if isinstance(self.__definition, bytes)4729 else self.__definition4730 ),4731 limitedRepr(4732 self.__storage_status[:20]4733 if isinstance(self.__storage_status, bytes)4734 else self.__storage_status4735 ),4736 limitedRepr(4737 self.__export_statuses[:20]4738 if isinstance(self.__export_statuses, bytes)4739 else self.__export_statuses4740 ),4741 )4742class DescribeMessageStreamResponse:4743 """4744 (Internal Only) Response object for describing a message stream.4745 """4746 __slots__ = [4747 "__request_id",4748 "__status",4749 "__error_message",4750 "__message_stream_info",4751 ]4752 _types_map = {4753 "request_id": {"type": str, "subtype": None},4754 "status": {"type": ResponseStatusCode, "subtype": None},4755 "error_message": {"type": str, "subtype": None},4756 "message_stream_info": {"type": MessageStreamInfo, "subtype": None},4757 }4758 _formats_map = {}4759 _validations_map = {4760 "request_id": {4761 "required": True,4762 "minLength": 1,4763 "pattern": "^[\w ,.\-_]*$",4764 },4765 "status": {4766 "required": True,4767 },4768 "error_message": {4769 "required": False,4770 },4771 "message_stream_info": {4772 "required": False,4773 },4774 }4775 def __init__(4776 self,4777 request_id: str = None,4778 status: ResponseStatusCode = None,4779 error_message: str = None,4780 message_stream_info: MessageStreamInfo = None,4781 ):4782 pass4783 self.__request_id = request_id4784 self.__status = status4785 self.__error_message = error_message4786 self.__message_stream_info = message_stream_info4787 def _get_request_id(self):4788 return self.__request_id4789 def _set_request_id(self, value):4790 if not isinstance(value, str):4791 raise TypeError("request_id must be str")4792 self.__request_id = value4793 request_id = property(_get_request_id, _set_request_id)4794 def _get_status(self):4795 return self.__status4796 def _set_status(self, value):4797 if not isinstance(value, ResponseStatusCode):4798 raise TypeError("status must be ResponseStatusCode")4799 self.__status = value4800 status = property(_get_status, _set_status)4801 def _get_error_message(self):4802 return self.__error_message4803 def _set_error_message(self, value):4804 if value is not None and not isinstance(value, str):4805 raise TypeError("error_message must be str")4806 self.__error_message = value4807 error_message = property(_get_error_message, _set_error_message)4808 def _get_message_stream_info(self):4809 return self.__message_stream_info4810 def _set_message_stream_info(self, value):4811 if value is not None and not isinstance(value, MessageStreamInfo):4812 raise TypeError("message_stream_info must be MessageStreamInfo")4813 self.__message_stream_info = value4814 message_stream_info = property(_get_message_stream_info, _set_message_stream_info)4815 @staticmethod4816 def from_dict(d):4817 v = {}4818 if "requestId" in d:4819 v["request_id"] = (4820 str.from_dict(d["requestId"])4821 if hasattr(str, "from_dict")4822 else d["requestId"]4823 )4824 if "status" in d:4825 v["status"] = (4826 ResponseStatusCode.from_dict(d["status"])4827 if hasattr(ResponseStatusCode, "from_dict")4828 else d["status"]4829 )4830 if "errorMessage" in d:4831 v["error_message"] = (4832 str.from_dict(d["errorMessage"])4833 if hasattr(str, "from_dict")4834 else d["errorMessage"]4835 )4836 if "messageStreamInfo" in d:4837 v["message_stream_info"] = (4838 MessageStreamInfo.from_dict(d["messageStreamInfo"])4839 if hasattr(MessageStreamInfo, "from_dict")4840 else d["messageStreamInfo"]4841 )4842 return DescribeMessageStreamResponse(**v)4843 def as_dict(self):4844 d = {}4845 if self.__request_id is not None:4846 d["requestId"] = (4847 self.__request_id.as_dict()4848 if hasattr(self.__request_id, "as_dict")4849 else self.__request_id4850 )4851 if self.__status is not None:4852 d["status"] = (4853 self.__status.as_dict()4854 if hasattr(self.__status, "as_dict")4855 else self.__status4856 )4857 if self.__error_message is not None:4858 d["errorMessage"] = (4859 self.__error_message.as_dict()4860 if hasattr(self.__error_message, "as_dict")4861 else self.__error_message4862 )4863 if self.__message_stream_info is not None:4864 d["messageStreamInfo"] = (4865 self.__message_stream_info.as_dict()4866 if hasattr(self.__message_stream_info, "as_dict")4867 else self.__message_stream_info4868 )4869 return d4870 def __repr__(self):4871 return "<Class DescribeMessageStreamResponse. request_id: {}, status: {}, error_message: {}, message_stream_info: {}>".format(4872 limitedRepr(4873 self.__request_id[:20]4874 if isinstance(self.__request_id, bytes)4875 else self.__request_id4876 ),4877 limitedRepr(4878 self.__status[:20]4879 if isinstance(self.__status, bytes)4880 else self.__status4881 ),4882 limitedRepr(4883 self.__error_message[:20]4884 if isinstance(self.__error_message, bytes)4885 else self.__error_message4886 ),4887 limitedRepr(4888 self.__message_stream_info[:20]4889 if isinstance(self.__message_stream_info, bytes)4890 else self.__message_stream_info4891 ),4892 )4893class AppendMessageRequest:4894 """4895 (Internal Only) Request object for appending to a message stream.4896 """4897 __slots__ = [4898 "__request_id",4899 "__name",4900 "__payload",4901 ]4902 _types_map = {4903 "request_id": {"type": str, "subtype": None},4904 "name": {"type": str, "subtype": None},4905 "payload": {"type": bytes, "subtype": None},4906 }4907 _formats_map = {}4908 _validations_map = {4909 "request_id": {4910 "required": True,4911 "minLength": 1,4912 "pattern": "^[\w ,.\-_]*$",4913 },4914 "name": {4915 "required": True,4916 "minLength": 1,4917 "maxLength": 255,4918 "pattern": "^[\w ,.\-_]*$",4919 },4920 "payload": {4921 "required": True,4922 "minLength": 1,4923 },4924 }4925 def __init__(self, request_id: str = None, name: str = None, payload: bytes = None):4926 pass4927 self.__request_id = request_id4928 self.__name = name4929 self.__payload = payload4930 def _get_request_id(self):4931 return self.__request_id4932 def _set_request_id(self, value):4933 if not isinstance(value, str):4934 raise TypeError("request_id must be str")4935 self.__request_id = value4936 request_id = property(_get_request_id, _set_request_id)4937 def _get_name(self):4938 return self.__name4939 def _set_name(self, value):4940 if not isinstance(value, str):4941 raise TypeError("name must be str")4942 self.__name = value4943 name = property(_get_name, _set_name)4944 def _get_payload(self):4945 return self.__payload4946 def _set_payload(self, value):4947 if not isinstance(value, bytes):4948 raise TypeError("payload must be bytes")4949 self.__payload = value4950 payload = property(_get_payload, _set_payload)4951 @staticmethod4952 def from_dict(d):4953 v = {}4954 if "requestId" in d:4955 v["request_id"] = (4956 str.from_dict(d["requestId"])4957 if hasattr(str, "from_dict")4958 else d["requestId"]4959 )4960 if "name" in d:4961 v["name"] = (4962 str.from_dict(d["name"]) if hasattr(str, "from_dict") else d["name"]4963 )4964 if "payload" in d:4965 v["payload"] = (4966 bytes.from_dict(d["payload"])4967 if hasattr(bytes, "from_dict")4968 else d["payload"]4969 )4970 return AppendMessageRequest(**v)4971 def as_dict(self):4972 d = {}4973 if self.__request_id is not None:4974 d["requestId"] = (4975 self.__request_id.as_dict()4976 if hasattr(self.__request_id, "as_dict")4977 else self.__request_id4978 )4979 if self.__name is not None:4980 d["name"] = (4981 self.__name.as_dict()4982 if hasattr(self.__name, "as_dict")4983 else self.__name4984 )4985 if self.__payload is not None:4986 d["payload"] = (4987 self.__payload.as_dict()4988 if hasattr(self.__payload, "as_dict")4989 else self.__payload4990 )4991 return d4992 def __repr__(self):4993 return "<Class AppendMessageRequest. request_id: {}, name: {}, payload: {}>".format(4994 limitedRepr(4995 self.__request_id[:20]4996 if isinstance(self.__request_id, bytes)4997 else self.__request_id4998 ),4999 limitedRepr(5000 self.__name[:20] if isinstance(self.__name, bytes) else self.__name5001 ),5002 limitedRepr(5003 self.__payload[:20]5004 if isinstance(self.__payload, bytes)5005 else self.__payload5006 ),5007 )5008class AppendMessageResponse:5009 """5010 Internal Only.5011 """5012 __slots__ = [5013 "__request_id",5014 "__status",5015 "__error_message",5016 "__sequence_number",5017 ]5018 _types_map = {5019 "request_id": {"type": str, "subtype": None},5020 "status": {"type": ResponseStatusCode, "subtype": None},5021 "error_message": {"type": str, "subtype": None},5022 "sequence_number": {"type": int, "subtype": None},5023 }5024 _formats_map = {}5025 _validations_map = {5026 "request_id": {5027 "required": True,5028 "minLength": 1,5029 "pattern": "^[\w ,.\-_]*$",5030 },5031 "status": {5032 "required": True,5033 },5034 "error_message": {5035 "required": False,5036 },5037 "sequence_number": {5038 "required": False,5039 },5040 }5041 def __init__(5042 self,5043 request_id: str = None,5044 status: ResponseStatusCode = None,5045 error_message: str = None,5046 sequence_number: int = None,5047 ):5048 pass5049 self.__request_id = request_id5050 self.__status = status5051 self.__error_message = error_message5052 self.__sequence_number = sequence_number5053 def _get_request_id(self):5054 return self.__request_id5055 def _set_request_id(self, value):5056 if not isinstance(value, str):5057 raise TypeError("request_id must be str")5058 self.__request_id = value5059 request_id = property(_get_request_id, _set_request_id)5060 def _get_status(self):5061 return self.__status5062 def _set_status(self, value):5063 if not isinstance(value, ResponseStatusCode):5064 raise TypeError("status must be ResponseStatusCode")5065 self.__status = value5066 status = property(_get_status, _set_status)5067 def _get_error_message(self):5068 return self.__error_message5069 def _set_error_message(self, value):5070 if value is not None and not isinstance(value, str):5071 raise TypeError("error_message must be str")5072 self.__error_message = value5073 error_message = property(_get_error_message, _set_error_message)5074 def _get_sequence_number(self):5075 return self.__sequence_number5076 def _set_sequence_number(self, value):5077 if value is not None and not isinstance(value, int):5078 raise TypeError("sequence_number must be int")5079 self.__sequence_number = value5080 sequence_number = property(_get_sequence_number, _set_sequence_number)5081 @staticmethod5082 def from_dict(d):5083 v = {}5084 if "requestId" in d:5085 v["request_id"] = (5086 str.from_dict(d["requestId"])5087 if hasattr(str, "from_dict")5088 else d["requestId"]5089 )5090 if "status" in d:5091 v["status"] = (5092 ResponseStatusCode.from_dict(d["status"])5093 if hasattr(ResponseStatusCode, "from_dict")5094 else d["status"]5095 )5096 if "errorMessage" in d:5097 v["error_message"] = (5098 str.from_dict(d["errorMessage"])5099 if hasattr(str, "from_dict")5100 else d["errorMessage"]5101 )5102 if "sequenceNumber" in d:5103 v["sequence_number"] = (5104 int.from_dict(d["sequenceNumber"])5105 if hasattr(int, "from_dict")5106 else d["sequenceNumber"]5107 )5108 return AppendMessageResponse(**v)5109 def as_dict(self):5110 d = {}5111 if self.__request_id is not None:5112 d["requestId"] = (5113 self.__request_id.as_dict()5114 if hasattr(self.__request_id, "as_dict")5115 else self.__request_id5116 )5117 if self.__status is not None:5118 d["status"] = (5119 self.__status.as_dict()5120 if hasattr(self.__status, "as_dict")5121 else self.__status5122 )5123 if self.__error_message is not None:5124 d["errorMessage"] = (5125 self.__error_message.as_dict()5126 if hasattr(self.__error_message, "as_dict")5127 else self.__error_message5128 )5129 if self.__sequence_number is not None:5130 d["sequenceNumber"] = (5131 self.__sequence_number.as_dict()5132 if hasattr(self.__sequence_number, "as_dict")5133 else self.__sequence_number5134 )5135 return d5136 def __repr__(self):5137 return "<Class AppendMessageResponse. request_id: {}, status: {}, error_message: {}, sequence_number: {}>".format(5138 limitedRepr(5139 self.__request_id[:20]5140 if isinstance(self.__request_id, bytes)5141 else self.__request_id5142 ),5143 limitedRepr(5144 self.__status[:20]5145 if isinstance(self.__status, bytes)5146 else self.__status5147 ),5148 limitedRepr(5149 self.__error_message[:20]5150 if isinstance(self.__error_message, bytes)5151 else self.__error_message5152 ),5153 limitedRepr(5154 self.__sequence_number[:20]5155 if isinstance(self.__sequence_number, bytes)5156 else self.__sequence_number5157 ),5158 )5159class ReadMessagesOptions:5160 """5161 Options for the ReadMessages API. All fields are optional.5162 """5163 __slots__ = [5164 "__desired_start_sequence_number",5165 "__min_message_count",5166 "__max_message_count",5167 "__read_timeout_millis",5168 ]5169 _types_map = {5170 "desired_start_sequence_number": {"type": int, "subtype": None},5171 "min_message_count": {"type": int, "subtype": None},5172 "max_message_count": {"type": int, "subtype": None},5173 "read_timeout_millis": {"type": int, "subtype": None},5174 }5175 _formats_map = {}5176 _validations_map = {5177 "desired_start_sequence_number": {5178 "required": False,5179 "maximum": 9223372036854775807,5180 "minimum": 0,5181 },5182 "min_message_count": {5183 "required": False,5184 "maximum": 2147483647,5185 "minimum": 1,5186 },5187 "max_message_count": {5188 "required": False,5189 "maximum": 2147483647,5190 "minimum": 1,5191 },5192 "read_timeout_millis": {5193 "required": False,5194 "maximum": 9223372036854,5195 "minimum": 0,5196 },5197 }5198 def __init__(5199 self,5200 desired_start_sequence_number: int = None,5201 min_message_count: int = 1,5202 max_message_count: int = None,5203 read_timeout_millis: int = 0,5204 ):5205 """5206 :param desired_start_sequence_number: The desired beginning sequence number to start reading from. If the desired sequence number is less than the current minimum of the stream, then it will instead start reading from the current minimum.5207 :param min_message_count: The minimum number of messages that will be returned. If not enough messages are available for reading, then NotEnoughMessages exception will be thrown.5208 The minimum values is 1 and the maximum value is 2147483647.5209 :param max_message_count: The maximum number of messages that will be returned.5210 The minimum values is the value of the minimum message count and the maximum value is 2147483647.5211 :param read_timeout_millis: The time to wait for messages in milliseconds. Default is 0, meaning that the server will not wait for messages.5212 If it can fulfill the minimum messages it will return them, but otherwise NotEnoughMessages exception will be thrown.5213 If the timeout is greater than zero, then the server will wait up to that time for more messages to be appended to the stream, waiting until the minimum number of messages is reached.5214 The maximum value is the value of the client timeout.5215 """5216 pass5217 self.__desired_start_sequence_number = desired_start_sequence_number5218 self.__min_message_count = min_message_count5219 self.__max_message_count = max_message_count5220 self.__read_timeout_millis = read_timeout_millis5221 def _get_desired_start_sequence_number(self):5222 return self.__desired_start_sequence_number5223 def _set_desired_start_sequence_number(self, value):5224 if value is not None and not isinstance(value, int):5225 raise TypeError("desired_start_sequence_number must be int")5226 self.__desired_start_sequence_number = value5227 desired_start_sequence_number = property(5228 _get_desired_start_sequence_number, _set_desired_start_sequence_number5229 )5230 """5231 The desired beginning sequence number to start reading from. If the desired sequence number is less than the current minimum of the stream, then it will instead start reading from the current minimum.5232 """5233 def _get_min_message_count(self):5234 return self.__min_message_count5235 def _set_min_message_count(self, value):5236 if value is not None and not isinstance(value, int):5237 raise TypeError("min_message_count must be int")5238 self.__min_message_count = value5239 min_message_count = property(_get_min_message_count, _set_min_message_count)5240 """5241 The minimum number of messages that will be returned. If not enough messages are available for reading, then NotEnoughMessages exception will be thrown.5242 The minimum values is 1 and the maximum value is 2147483647.5243 """5244 def _get_max_message_count(self):5245 return self.__max_message_count5246 def _set_max_message_count(self, value):5247 if value is not None and not isinstance(value, int):5248 raise TypeError("max_message_count must be int")5249 self.__max_message_count = value5250 max_message_count = property(_get_max_message_count, _set_max_message_count)5251 """5252 The maximum number of messages that will be returned.5253 The minimum values is the value of the minimum message count and the maximum value is 2147483647.5254 """5255 def _get_read_timeout_millis(self):5256 return self.__read_timeout_millis5257 def _set_read_timeout_millis(self, value):5258 if value is not None and not isinstance(value, int):5259 raise TypeError("read_timeout_millis must be int")5260 self.__read_timeout_millis = value5261 read_timeout_millis = property(_get_read_timeout_millis, _set_read_timeout_millis)5262 """5263 The time to wait for messages in milliseconds. Default is 0, meaning that the server will not wait for messages.5264 If it can fulfill the minimum messages it will return them, but otherwise NotEnoughMessages exception will be thrown.5265 If the timeout is greater than zero, then the server will wait up to that time for more messages to be appended to the stream, waiting until the minimum number of messages is reached.5266 The maximum value is the value of the client timeout.5267 """5268 @staticmethod5269 def from_dict(d):5270 v = {}5271 if "desiredStartSequenceNumber" in d:5272 v["desired_start_sequence_number"] = (5273 int.from_dict(d["desiredStartSequenceNumber"])5274 if hasattr(int, "from_dict")5275 else d["desiredStartSequenceNumber"]5276 )5277 if "minMessageCount" in d:5278 v["min_message_count"] = (5279 int.from_dict(d["minMessageCount"])5280 if hasattr(int, "from_dict")5281 else d["minMessageCount"]5282 )5283 if "maxMessageCount" in d:5284 v["max_message_count"] = (5285 int.from_dict(d["maxMessageCount"])5286 if hasattr(int, "from_dict")5287 else d["maxMessageCount"]5288 )5289 if "readTimeoutMillis" in d:5290 v["read_timeout_millis"] = (5291 int.from_dict(d["readTimeoutMillis"])5292 if hasattr(int, "from_dict")5293 else d["readTimeoutMillis"]5294 )5295 return ReadMessagesOptions(**v)5296 def as_dict(self):5297 d = {}5298 if self.__desired_start_sequence_number is not None:5299 d["desiredStartSequenceNumber"] = (5300 self.__desired_start_sequence_number.as_dict()5301 if hasattr(self.__desired_start_sequence_number, "as_dict")5302 else self.__desired_start_sequence_number5303 )5304 if self.__min_message_count is not None:5305 d["minMessageCount"] = (5306 self.__min_message_count.as_dict()5307 if hasattr(self.__min_message_count, "as_dict")5308 else self.__min_message_count5309 )5310 if self.__max_message_count is not None:5311 d["maxMessageCount"] = (5312 self.__max_message_count.as_dict()5313 if hasattr(self.__max_message_count, "as_dict")5314 else self.__max_message_count5315 )5316 if self.__read_timeout_millis is not None:5317 d["readTimeoutMillis"] = (5318 self.__read_timeout_millis.as_dict()5319 if hasattr(self.__read_timeout_millis, "as_dict")5320 else self.__read_timeout_millis5321 )5322 return d5323 def __repr__(self):5324 return "<Class ReadMessagesOptions. desired_start_sequence_number: {}, min_message_count: {}, max_message_count: {}, read_timeout_millis: {}>".format(5325 limitedRepr(5326 self.__desired_start_sequence_number[:20]5327 if isinstance(self.__desired_start_sequence_number, bytes)5328 else self.__desired_start_sequence_number5329 ),5330 limitedRepr(5331 self.__min_message_count[:20]5332 if isinstance(self.__min_message_count, bytes)5333 else self.__min_message_count5334 ),5335 limitedRepr(5336 self.__max_message_count[:20]5337 if isinstance(self.__max_message_count, bytes)5338 else self.__max_message_count5339 ),5340 limitedRepr(5341 self.__read_timeout_millis[:20]5342 if isinstance(self.__read_timeout_millis, bytes)5343 else self.__read_timeout_millis5344 ),5345 )5346class ReadMessagesRequest:5347 """5348 (Internal Only) Request object for reading from a message stream. readMessagesOptions is optional.5349 """5350 __slots__ = [5351 "__request_id",5352 "__stream_name",5353 "__read_messages_options",5354 ]5355 _types_map = {5356 "request_id": {"type": str, "subtype": None},5357 "stream_name": {"type": str, "subtype": None},5358 "read_messages_options": {"type": ReadMessagesOptions, "subtype": None},5359 }5360 _formats_map = {}5361 _validations_map = {5362 "request_id": {5363 "required": True,5364 "minLength": 1,5365 "pattern": "^[\w ,.\-_]*$",5366 },5367 "stream_name": {5368 "required": True,5369 "minLength": 1,5370 "maxLength": 255,5371 "pattern": "^[\w ,.\-_]*$",5372 },5373 "read_messages_options": {5374 "required": False,5375 },5376 }5377 def __init__(5378 self,5379 request_id: str = None,5380 stream_name: str = None,5381 read_messages_options: ReadMessagesOptions = None,5382 ):5383 pass5384 self.__request_id = request_id5385 self.__stream_name = stream_name5386 self.__read_messages_options = read_messages_options5387 def _get_request_id(self):5388 return self.__request_id5389 def _set_request_id(self, value):5390 if not isinstance(value, str):5391 raise TypeError("request_id must be str")5392 self.__request_id = value5393 request_id = property(_get_request_id, _set_request_id)5394 def _get_stream_name(self):5395 return self.__stream_name5396 def _set_stream_name(self, value):5397 if not isinstance(value, str):5398 raise TypeError("stream_name must be str")5399 self.__stream_name = value5400 stream_name = property(_get_stream_name, _set_stream_name)5401 def _get_read_messages_options(self):5402 return self.__read_messages_options5403 def _set_read_messages_options(self, value):5404 if value is not None and not isinstance(value, ReadMessagesOptions):5405 raise TypeError("read_messages_options must be ReadMessagesOptions")5406 self.__read_messages_options = value5407 read_messages_options = property(5408 _get_read_messages_options, _set_read_messages_options5409 )5410 @staticmethod5411 def from_dict(d):5412 v = {}5413 if "requestId" in d:5414 v["request_id"] = (5415 str.from_dict(d["requestId"])5416 if hasattr(str, "from_dict")5417 else d["requestId"]5418 )5419 if "streamName" in d:5420 v["stream_name"] = (5421 str.from_dict(d["streamName"])5422 if hasattr(str, "from_dict")5423 else d["streamName"]5424 )5425 if "readMessagesOptions" in d:5426 v["read_messages_options"] = (5427 ReadMessagesOptions.from_dict(d["readMessagesOptions"])5428 if hasattr(ReadMessagesOptions, "from_dict")5429 else d["readMessagesOptions"]5430 )5431 return ReadMessagesRequest(**v)5432 def as_dict(self):5433 d = {}5434 if self.__request_id is not None:5435 d["requestId"] = (5436 self.__request_id.as_dict()5437 if hasattr(self.__request_id, "as_dict")5438 else self.__request_id5439 )5440 if self.__stream_name is not None:5441 d["streamName"] = (5442 self.__stream_name.as_dict()5443 if hasattr(self.__stream_name, "as_dict")5444 else self.__stream_name5445 )5446 if self.__read_messages_options is not None:5447 d["readMessagesOptions"] = (5448 self.__read_messages_options.as_dict()5449 if hasattr(self.__read_messages_options, "as_dict")5450 else self.__read_messages_options5451 )5452 return d5453 def __repr__(self):5454 return "<Class ReadMessagesRequest. request_id: {}, stream_name: {}, read_messages_options: {}>".format(5455 limitedRepr(5456 self.__request_id[:20]5457 if isinstance(self.__request_id, bytes)5458 else self.__request_id5459 ),5460 limitedRepr(5461 self.__stream_name[:20]5462 if isinstance(self.__stream_name, bytes)5463 else self.__stream_name5464 ),5465 limitedRepr(5466 self.__read_messages_options[:20]5467 if isinstance(self.__read_messages_options, bytes)5468 else self.__read_messages_options5469 ),5470 )5471class Message:5472 """5473 Message object containing metadata and the user's payload.5474 """5475 __slots__ = [5476 "__stream_name",5477 "__sequence_number",5478 "__ingest_time",5479 "__payload",5480 ]5481 _types_map = {5482 "stream_name": {"type": str, "subtype": None},5483 "sequence_number": {"type": int, "subtype": None},5484 "ingest_time": {"type": int, "subtype": None},5485 "payload": {"type": bytes, "subtype": None},5486 }5487 _formats_map = {}5488 _validations_map = {5489 "stream_name": {5490 "required": True,5491 },5492 "sequence_number": {5493 "required": False,5494 },5495 "ingest_time": {5496 "required": False,5497 },5498 "payload": {5499 "required": True,5500 },5501 }5502 def __init__(5503 self,5504 stream_name: str = None,5505 sequence_number: int = None,5506 ingest_time: int = None,5507 payload: bytes = None,5508 ):5509 """5510 :param stream_name: The name of the stream which this message is in.5511 :param sequence_number: The sequence number of this message within the stream.5512 :param ingest_time: The time that the message was ingested to Stream Manager. Data is Unix epoch time in milliseconds.5513 :param payload: The binary message data.5514 """5515 pass5516 self.__stream_name = stream_name5517 self.__sequence_number = sequence_number5518 self.__ingest_time = ingest_time5519 self.__payload = payload5520 def _get_stream_name(self):5521 return self.__stream_name5522 def _set_stream_name(self, value):5523 if not isinstance(value, str):5524 raise TypeError("stream_name must be str")5525 self.__stream_name = value5526 stream_name = property(_get_stream_name, _set_stream_name)5527 """5528 The name of the stream which this message is in.5529 """5530 def _get_sequence_number(self):5531 return self.__sequence_number5532 def _set_sequence_number(self, value):5533 if value is not None and not isinstance(value, int):5534 raise TypeError("sequence_number must be int")5535 self.__sequence_number = value5536 sequence_number = property(_get_sequence_number, _set_sequence_number)5537 """5538 The sequence number of this message within the stream.5539 """5540 def _get_ingest_time(self):5541 return self.__ingest_time5542 def _set_ingest_time(self, value):5543 if value is not None and not isinstance(value, int):5544 raise TypeError("ingest_time must be int")5545 self.__ingest_time = value5546 ingest_time = property(_get_ingest_time, _set_ingest_time)5547 """5548 The time that the message was ingested to Stream Manager. Data is Unix epoch time in milliseconds.5549 """5550 def _get_payload(self):5551 return self.__payload5552 def _set_payload(self, value):5553 if not isinstance(value, bytes):5554 raise TypeError("payload must be bytes")5555 self.__payload = value5556 payload = property(_get_payload, _set_payload)5557 """5558 The binary message data.5559 """5560 @staticmethod5561 def from_dict(d):5562 v = {}5563 if "streamName" in d:5564 v["stream_name"] = (5565 str.from_dict(d["streamName"])5566 if hasattr(str, "from_dict")5567 else d["streamName"]5568 )5569 if "sequenceNumber" in d:5570 v["sequence_number"] = (5571 int.from_dict(d["sequenceNumber"])5572 if hasattr(int, "from_dict")5573 else d["sequenceNumber"]5574 )5575 if "ingestTime" in d:5576 v["ingest_time"] = (5577 int.from_dict(d["ingestTime"])5578 if hasattr(int, "from_dict")5579 else d["ingestTime"]5580 )5581 if "payload" in d:5582 v["payload"] = (5583 bytes.from_dict(d["payload"])5584 if hasattr(bytes, "from_dict")5585 else d["payload"]5586 )5587 return Message(**v)5588 def as_dict(self):5589 d = {}5590 if self.__stream_name is not None:5591 d["streamName"] = (5592 self.__stream_name.as_dict()5593 if hasattr(self.__stream_name, "as_dict")5594 else self.__stream_name5595 )5596 if self.__sequence_number is not None:5597 d["sequenceNumber"] = (5598 self.__sequence_number.as_dict()5599 if hasattr(self.__sequence_number, "as_dict")5600 else self.__sequence_number5601 )5602 if self.__ingest_time is not None:5603 d["ingestTime"] = (5604 self.__ingest_time.as_dict()5605 if hasattr(self.__ingest_time, "as_dict")5606 else self.__ingest_time5607 )5608 if self.__payload is not None:5609 d["payload"] = (5610 self.__payload.as_dict()5611 if hasattr(self.__payload, "as_dict")5612 else self.__payload5613 )5614 return d5615 def __repr__(self):5616 return "<Class Message. stream_name: {}, sequence_number: {}, ingest_time: {}, payload: {}>".format(5617 limitedRepr(5618 self.__stream_name[:20]5619 if isinstance(self.__stream_name, bytes)5620 else self.__stream_name5621 ),5622 limitedRepr(5623 self.__sequence_number[:20]5624 if isinstance(self.__sequence_number, bytes)5625 else self.__sequence_number5626 ),5627 limitedRepr(5628 self.__ingest_time[:20]5629 if isinstance(self.__ingest_time, bytes)5630 else self.__ingest_time5631 ),5632 limitedRepr(5633 self.__payload[:20]5634 if isinstance(self.__payload, bytes)5635 else self.__payload5636 ),5637 )5638class ReadMessagesResponse:5639 """5640 Internal Only.5641 """5642 __slots__ = [5643 "__request_id",5644 "__messages",5645 "__status",5646 "__error_message",5647 ]5648 _types_map = {5649 "request_id": {"type": str, "subtype": None},5650 "messages": {"type": list, "subtype": Message},5651 "status": {"type": ResponseStatusCode, "subtype": None},5652 "error_message": {"type": str, "subtype": None},5653 }5654 _formats_map = {}5655 _validations_map = {5656 "request_id": {5657 "required": False,5658 "minLength": 1,5659 "pattern": "^[\w ,.\-_]*$",5660 },5661 "messages": {5662 "required": False,5663 },5664 "status": {5665 "required": False,5666 },5667 "error_message": {5668 "required": False,5669 },5670 }5671 def __init__(5672 self,5673 request_id: str = None,5674 messages: List[Message] = None,5675 status: ResponseStatusCode = None,5676 error_message: str = None,5677 ):5678 pass5679 self.__request_id = request_id5680 self.__messages = messages5681 self.__status = status5682 self.__error_message = error_message5683 def _get_request_id(self):5684 return self.__request_id5685 def _set_request_id(self, value):5686 if value is not None and not isinstance(value, str):5687 raise TypeError("request_id must be str")5688 self.__request_id = value5689 request_id = property(_get_request_id, _set_request_id)5690 def _get_messages(self):5691 return self.__messages5692 def _set_messages(self, value):5693 if value is not None and not isinstance(value, list):5694 raise TypeError("messages must be list")5695 if value is not None and not all(isinstance(i, Message) for i in value):5696 raise TypeError("messages list values must be Message")5697 self.__messages = value5698 messages = property(_get_messages, _set_messages)5699 def _get_status(self):5700 return self.__status5701 def _set_status(self, value):5702 if value is not None and not isinstance(value, ResponseStatusCode):5703 raise TypeError("status must be ResponseStatusCode")5704 self.__status = value5705 status = property(_get_status, _set_status)5706 def _get_error_message(self):5707 return self.__error_message5708 def _set_error_message(self, value):5709 if value is not None and not isinstance(value, str):5710 raise TypeError("error_message must be str")5711 self.__error_message = value5712 error_message = property(_get_error_message, _set_error_message)5713 @staticmethod5714 def from_dict(d):5715 v = {}5716 if "requestId" in d:5717 v["request_id"] = (5718 str.from_dict(d["requestId"])5719 if hasattr(str, "from_dict")5720 else d["requestId"]5721 )5722 if "messages" in d:5723 v["messages"] = [5724 Message.from_dict(p) if hasattr(Message, "from_dict") else p5725 for p in d["messages"]5726 ]5727 if "status" in d:5728 v["status"] = (5729 ResponseStatusCode.from_dict(d["status"])5730 if hasattr(ResponseStatusCode, "from_dict")5731 else d["status"]5732 )5733 if "errorMessage" in d:5734 v["error_message"] = (5735 str.from_dict(d["errorMessage"])5736 if hasattr(str, "from_dict")5737 else d["errorMessage"]5738 )5739 return ReadMessagesResponse(**v)5740 def as_dict(self):5741 d = {}5742 if self.__request_id is not None:5743 d["requestId"] = (5744 self.__request_id.as_dict()5745 if hasattr(self.__request_id, "as_dict")5746 else self.__request_id5747 )5748 if self.__messages is not None:5749 d["messages"] = [5750 p.as_dict() if hasattr(p, "as_dict") else p for p in self.__messages5751 ]5752 if self.__status is not None:5753 d["status"] = (5754 self.__status.as_dict()5755 if hasattr(self.__status, "as_dict")5756 else self.__status5757 )5758 if self.__error_message is not None:5759 d["errorMessage"] = (5760 self.__error_message.as_dict()5761 if hasattr(self.__error_message, "as_dict")5762 else self.__error_message5763 )5764 return d5765 def __repr__(self):5766 return "<Class ReadMessagesResponse. request_id: {}, messages: {}, status: {}, error_message: {}>".format(5767 limitedRepr(5768 self.__request_id[:20]5769 if isinstance(self.__request_id, bytes)5770 else self.__request_id5771 ),5772 limitedRepr(5773 self.__messages[:20]5774 if isinstance(self.__messages, bytes)5775 else self.__messages5776 ),5777 limitedRepr(5778 self.__status[:20]5779 if isinstance(self.__status, bytes)5780 else self.__status5781 ),5782 limitedRepr(5783 self.__error_message[:20]5784 if isinstance(self.__error_message, bytes)5785 else self.__error_message5786 ),5787 )5788class ListStreamsRequest:5789 """5790 (Internal Only) Request object to list all available streams. There are no options.5791 """5792 __slots__ = [5793 "__request_id",5794 ]5795 _types_map = {5796 "request_id": {"type": str, "subtype": None},5797 }5798 _formats_map = {}5799 _validations_map = {5800 "request_id": {5801 "required": True,5802 "minLength": 1,5803 "pattern": "^[\w ,.\-_]*$",5804 },5805 }5806 def __init__(self, request_id: str = None):5807 pass5808 self.__request_id = request_id5809 def _get_request_id(self):5810 return self.__request_id5811 def _set_request_id(self, value):5812 if not isinstance(value, str):5813 raise TypeError("request_id must be str")5814 self.__request_id = value5815 request_id = property(_get_request_id, _set_request_id)5816 @staticmethod5817 def from_dict(d):5818 v = {}5819 if "requestId" in d:5820 v["request_id"] = (5821 str.from_dict(d["requestId"])5822 if hasattr(str, "from_dict")5823 else d["requestId"]5824 )5825 return ListStreamsRequest(**v)5826 def as_dict(self):5827 d = {}5828 if self.__request_id is not None:5829 d["requestId"] = (5830 self.__request_id.as_dict()5831 if hasattr(self.__request_id, "as_dict")5832 else self.__request_id5833 )5834 return d5835 def __repr__(self):5836 return "<Class ListStreamsRequest. request_id: {}>".format(5837 limitedRepr(5838 self.__request_id[:20]5839 if isinstance(self.__request_id, bytes)5840 else self.__request_id5841 )5842 )5843class ListStreamsResponse:5844 """5845 Internal Only.5846 """5847 __slots__ = [5848 "__request_id",5849 "__status",5850 "__error_message",5851 "__streams",5852 ]5853 _types_map = {5854 "request_id": {"type": str, "subtype": None},5855 "status": {"type": ResponseStatusCode, "subtype": None},5856 "error_message": {"type": str, "subtype": None},5857 "streams": {"type": list, "subtype": str},5858 }5859 _formats_map = {}5860 _validations_map = {5861 "request_id": {5862 "required": True,5863 "minLength": 1,5864 "pattern": "^[\w ,.\-_]*$",5865 },5866 "status": {5867 "required": True,5868 },5869 "error_message": {5870 "required": False,5871 },5872 "streams": {5873 "required": False,5874 },5875 }5876 def __init__(5877 self,5878 request_id: str = None,5879 status: ResponseStatusCode = None,5880 error_message: str = None,5881 streams: List[str] = None,5882 ):5883 pass5884 self.__request_id = request_id5885 self.__status = status5886 self.__error_message = error_message5887 self.__streams = streams5888 def _get_request_id(self):5889 return self.__request_id5890 def _set_request_id(self, value):5891 if not isinstance(value, str):5892 raise TypeError("request_id must be str")5893 self.__request_id = value5894 request_id = property(_get_request_id, _set_request_id)5895 def _get_status(self):5896 return self.__status5897 def _set_status(self, value):5898 if not isinstance(value, ResponseStatusCode):5899 raise TypeError("status must be ResponseStatusCode")5900 self.__status = value5901 status = property(_get_status, _set_status)5902 def _get_error_message(self):5903 return self.__error_message5904 def _set_error_message(self, value):5905 if value is not None and not isinstance(value, str):5906 raise TypeError("error_message must be str")5907 self.__error_message = value5908 error_message = property(_get_error_message, _set_error_message)5909 def _get_streams(self):5910 return self.__streams5911 def _set_streams(self, value):5912 if value is not None and not isinstance(value, list):5913 raise TypeError("streams must be list")5914 if value is not None and not all(isinstance(i, str) for i in value):5915 raise TypeError("streams list values must be str")5916 self.__streams = value5917 streams = property(_get_streams, _set_streams)5918 @staticmethod5919 def from_dict(d):5920 v = {}5921 if "requestId" in d:5922 v["request_id"] = (5923 str.from_dict(d["requestId"])5924 if hasattr(str, "from_dict")5925 else d["requestId"]5926 )5927 if "status" in d:5928 v["status"] = (5929 ResponseStatusCode.from_dict(d["status"])5930 if hasattr(ResponseStatusCode, "from_dict")5931 else d["status"]5932 )5933 if "errorMessage" in d:5934 v["error_message"] = (5935 str.from_dict(d["errorMessage"])5936 if hasattr(str, "from_dict")5937 else d["errorMessage"]5938 )5939 if "streams" in d:5940 v["streams"] = [5941 str.from_dict(p) if hasattr(str, "from_dict") else p5942 for p in d["streams"]5943 ]5944 return ListStreamsResponse(**v)5945 def as_dict(self):5946 d = {}5947 if self.__request_id is not None:5948 d["requestId"] = (5949 self.__request_id.as_dict()5950 if hasattr(self.__request_id, "as_dict")5951 else self.__request_id5952 )5953 if self.__status is not None:5954 d["status"] = (5955 self.__status.as_dict()5956 if hasattr(self.__status, "as_dict")5957 else self.__status5958 )5959 if self.__error_message is not None:5960 d["errorMessage"] = (5961 self.__error_message.as_dict()5962 if hasattr(self.__error_message, "as_dict")5963 else self.__error_message5964 )5965 if self.__streams is not None:5966 d["streams"] = [5967 p.as_dict() if hasattr(p, "as_dict") else p for p in self.__streams5968 ]5969 return d5970 def __repr__(self):5971 return "<Class ListStreamsResponse. request_id: {}, status: {}, error_message: {}, streams: {}>".format(5972 limitedRepr(5973 self.__request_id[:20]5974 if isinstance(self.__request_id, bytes)5975 else self.__request_id5976 ),5977 limitedRepr(5978 self.__status[:20]5979 if isinstance(self.__status, bytes)5980 else self.__status5981 ),5982 limitedRepr(5983 self.__error_message[:20]5984 if isinstance(self.__error_message, bytes)5985 else self.__error_message5986 ),5987 limitedRepr(5988 self.__streams[:20]5989 if isinstance(self.__streams, bytes)5990 else self.__streams5991 ),5992 )5993class TimeInNanos:5994 """5995 Contains a timestamp with optional nanosecond granularity.5996 """5997 __slots__ = [5998 "__time_in_seconds",5999 "__offset_in_nanos",6000 ]6001 _types_map = {6002 "time_in_seconds": {"type": int, "subtype": None},6003 "offset_in_nanos": {"type": int, "subtype": None},6004 }6005 _formats_map = {}6006 _validations_map = {6007 "time_in_seconds": {6008 "required": True,6009 "maximum": 31556889864403199,6010 "minimum": 1,6011 },6012 "offset_in_nanos": {6013 "required": False,6014 "maximum": 999999999,6015 "minimum": 0,6016 },6017 }6018 def __init__(self, time_in_seconds: int = None, offset_in_nanos: int = None):6019 """6020 :param time_in_seconds: The timestamp date, in seconds, in the Unix epoch format. Fractional nanosecond data is provided by offsetInNanos.6021 :param offset_in_nanos: The nanosecond offset from timeInSeconds.6022 """6023 pass6024 self.__time_in_seconds = time_in_seconds6025 self.__offset_in_nanos = offset_in_nanos6026 def _get_time_in_seconds(self):6027 return self.__time_in_seconds6028 def _set_time_in_seconds(self, value):6029 if not isinstance(value, int):6030 raise TypeError("time_in_seconds must be int")6031 self.__time_in_seconds = value6032 time_in_seconds = property(_get_time_in_seconds, _set_time_in_seconds)6033 """6034 The timestamp date, in seconds, in the Unix epoch format. Fractional nanosecond data is provided by offsetInNanos.6035 """6036 def _get_offset_in_nanos(self):6037 return self.__offset_in_nanos6038 def _set_offset_in_nanos(self, value):6039 if value is not None and not isinstance(value, int):6040 raise TypeError("offset_in_nanos must be int")6041 self.__offset_in_nanos = value6042 offset_in_nanos = property(_get_offset_in_nanos, _set_offset_in_nanos)6043 """6044 The nanosecond offset from timeInSeconds.6045 """6046 @staticmethod6047 def from_dict(d):6048 v = {}6049 if "timeInSeconds" in d:6050 v["time_in_seconds"] = (6051 int.from_dict(d["timeInSeconds"])6052 if hasattr(int, "from_dict")6053 else d["timeInSeconds"]6054 )6055 if "offsetInNanos" in d:6056 v["offset_in_nanos"] = (6057 int.from_dict(d["offsetInNanos"])6058 if hasattr(int, "from_dict")6059 else d["offsetInNanos"]6060 )6061 return TimeInNanos(**v)6062 def as_dict(self):6063 d = {}6064 if self.__time_in_seconds is not None:6065 d["timeInSeconds"] = (6066 self.__time_in_seconds.as_dict()6067 if hasattr(self.__time_in_seconds, "as_dict")6068 else self.__time_in_seconds6069 )6070 if self.__offset_in_nanos is not None:6071 d["offsetInNanos"] = (6072 self.__offset_in_nanos.as_dict()6073 if hasattr(self.__offset_in_nanos, "as_dict")6074 else self.__offset_in_nanos6075 )6076 return d6077 def __repr__(self):6078 return "<Class TimeInNanos. time_in_seconds: {}, offset_in_nanos: {}>".format(6079 limitedRepr(6080 self.__time_in_seconds[:20]6081 if isinstance(self.__time_in_seconds, bytes)6082 else self.__time_in_seconds6083 ),6084 limitedRepr(6085 self.__offset_in_nanos[:20]6086 if isinstance(self.__offset_in_nanos, bytes)6087 else self.__offset_in_nanos6088 ),6089 )6090class Quality(enum.Enum):6091 GOOD = "GOOD"6092 BAD = "BAD"6093 UNCERTAIN = "UNCERTAIN"6094 @staticmethod6095 def from_dict(d):6096 return Quality(d)6097 def as_dict(self):6098 return self.value6099 def __repr__(self):6100 return "<Enum Quality. {}: {}>".format(6101 limitedRepr(self.name), limitedRepr(self.value)6102 )6103class Variant:6104 """6105 Contains an asset property value (of a single type only).6106 """6107 __slots__ = [6108 "__string_value",6109 "__integer_value",6110 "__double_value",6111 "__boolean_value",6112 ]6113 _types_map = {6114 "string_value": {"type": str, "subtype": None},6115 "integer_value": {"type": int, "subtype": None},6116 "double_value": {"type": float, "subtype": None},6117 "boolean_value": {"type": bool, "subtype": None},6118 }6119 _formats_map = {}6120 _validations_map = {6121 "string_value": {6122 "required": False,6123 "minLength": 1,6124 "maxLength": 1024,6125 "pattern": "[^\u0000-\u001F\u007F]+",6126 },6127 "integer_value": {6128 "required": False,6129 "maximum": 2147483647,6130 "minimum": 0,6131 },6132 "double_value": {6133 "required": False,6134 },6135 "boolean_value": {6136 "required": False,6137 },6138 }6139 def __init__(6140 self,6141 string_value: str = None,6142 integer_value: int = None,6143 double_value: float = None,6144 boolean_value: bool = None,6145 ):6146 """6147 :param string_value: Asset property data of type string (sequence of characters).6148 :param integer_value: Asset property data of type integer (whole number).6149 :param double_value: Asset property data of type double (floating point number).6150 :param boolean_value: Asset property data of type Boolean (true or false).6151 """6152 pass6153 self.__string_value = string_value6154 self.__integer_value = integer_value6155 self.__double_value = double_value6156 self.__boolean_value = boolean_value6157 def _get_string_value(self):6158 return self.__string_value6159 def _set_string_value(self, value):6160 if value is not None and not isinstance(value, str):6161 raise TypeError("string_value must be str")6162 self.__string_value = value6163 string_value = property(_get_string_value, _set_string_value)6164 """6165 Asset property data of type string (sequence of characters).6166 """6167 def _get_integer_value(self):6168 return self.__integer_value6169 def _set_integer_value(self, value):6170 if value is not None and not isinstance(value, int):6171 raise TypeError("integer_value must be int")6172 self.__integer_value = value6173 integer_value = property(_get_integer_value, _set_integer_value)6174 """6175 Asset property data of type integer (whole number).6176 """6177 def _get_double_value(self):6178 return self.__double_value6179 def _set_double_value(self, value):6180 if value is not None and not isinstance(value, float):6181 raise TypeError("double_value must be float")6182 self.__double_value = value6183 double_value = property(_get_double_value, _set_double_value)6184 """6185 Asset property data of type double (floating point number).6186 """6187 def _get_boolean_value(self):6188 return self.__boolean_value6189 def _set_boolean_value(self, value):6190 if value is not None and not isinstance(value, bool):6191 raise TypeError("boolean_value must be bool")6192 self.__boolean_value = value6193 boolean_value = property(_get_boolean_value, _set_boolean_value)6194 """6195 Asset property data of type Boolean (true or false).6196 """6197 @staticmethod6198 def from_dict(d):6199 v = {}6200 if "stringValue" in d:6201 v["string_value"] = (6202 str.from_dict(d["stringValue"])6203 if hasattr(str, "from_dict")6204 else d["stringValue"]6205 )6206 if "integerValue" in d:6207 v["integer_value"] = (6208 int.from_dict(d["integerValue"])6209 if hasattr(int, "from_dict")6210 else d["integerValue"]6211 )6212 if "doubleValue" in d:6213 v["double_value"] = (6214 float.from_dict(d["doubleValue"])6215 if hasattr(float, "from_dict")6216 else d["doubleValue"]6217 )6218 if "booleanValue" in d:6219 v["boolean_value"] = (6220 bool.from_dict(d["booleanValue"])6221 if hasattr(bool, "from_dict")6222 else d["booleanValue"]6223 )6224 return Variant(**v)6225 def as_dict(self):6226 d = {}6227 if self.__string_value is not None:6228 d["stringValue"] = (6229 self.__string_value.as_dict()6230 if hasattr(self.__string_value, "as_dict")6231 else self.__string_value6232 )6233 if self.__integer_value is not None:6234 d["integerValue"] = (6235 self.__integer_value.as_dict()6236 if hasattr(self.__integer_value, "as_dict")6237 else self.__integer_value6238 )6239 if self.__double_value is not None:6240 d["doubleValue"] = (6241 self.__double_value.as_dict()6242 if hasattr(self.__double_value, "as_dict")6243 else self.__double_value6244 )6245 if self.__boolean_value is not None:6246 d["booleanValue"] = (6247 self.__boolean_value.as_dict()6248 if hasattr(self.__boolean_value, "as_dict")6249 else self.__boolean_value6250 )6251 return d6252 def __repr__(self):6253 return "<Class Variant. string_value: {}, integer_value: {}, double_value: {}, boolean_value: {}>".format(6254 limitedRepr(6255 self.__string_value[:20]6256 if isinstance(self.__string_value, bytes)6257 else self.__string_value6258 ),6259 limitedRepr(6260 self.__integer_value[:20]6261 if isinstance(self.__integer_value, bytes)6262 else self.__integer_value6263 ),6264 limitedRepr(6265 self.__double_value[:20]6266 if isinstance(self.__double_value, bytes)6267 else self.__double_value6268 ),6269 limitedRepr(6270 self.__boolean_value[:20]6271 if isinstance(self.__boolean_value, bytes)6272 else self.__boolean_value6273 ),6274 )6275class AssetPropertyValue:6276 """6277 Contains asset property value information.6278 """6279 __slots__ = [6280 "__value",6281 "__timestamp",6282 "__quality",6283 ]6284 _types_map = {6285 "value": {"type": Variant, "subtype": None},6286 "timestamp": {"type": TimeInNanos, "subtype": None},6287 "quality": {"type": Quality, "subtype": None},6288 }6289 _formats_map = {}6290 _validations_map = {6291 "value": {6292 "required": True,6293 },6294 "timestamp": {6295 "required": True,6296 },6297 "quality": {6298 "required": False,6299 },6300 }6301 def __init__(6302 self,6303 value: Variant = None,6304 timestamp: TimeInNanos = None,6305 quality: Quality = None,6306 ):6307 """6308 :param value: The value of the asset property.6309 :param timestamp: The timestamp of the asset property value.6310 :param quality: The quality of the asset property value.6311 """6312 pass6313 self.__value = value6314 self.__timestamp = timestamp6315 self.__quality = quality6316 def _get_value(self):6317 return self.__value6318 def _set_value(self, value):6319 if not isinstance(value, Variant):6320 raise TypeError("value must be Variant")6321 self.__value = value6322 value = property(_get_value, _set_value)6323 """6324 The value of the asset property.6325 """6326 def _get_timestamp(self):6327 return self.__timestamp6328 def _set_timestamp(self, value):6329 if not isinstance(value, TimeInNanos):6330 raise TypeError("timestamp must be TimeInNanos")6331 self.__timestamp = value6332 timestamp = property(_get_timestamp, _set_timestamp)6333 """6334 The timestamp of the asset property value.6335 """6336 def _get_quality(self):6337 return self.__quality6338 def _set_quality(self, value):6339 if value is not None and not isinstance(value, Quality):6340 raise TypeError("quality must be Quality")6341 self.__quality = value6342 quality = property(_get_quality, _set_quality)6343 """6344 The quality of the asset property value.6345 """6346 @staticmethod6347 def from_dict(d):6348 v = {}6349 if "value" in d:6350 v["value"] = (6351 Variant.from_dict(d["value"])6352 if hasattr(Variant, "from_dict")6353 else d["value"]6354 )6355 if "timestamp" in d:6356 v["timestamp"] = (6357 TimeInNanos.from_dict(d["timestamp"])6358 if hasattr(TimeInNanos, "from_dict")6359 else d["timestamp"]6360 )6361 if "quality" in d:6362 v["quality"] = (6363 Quality.from_dict(d["quality"])6364 if hasattr(Quality, "from_dict")6365 else d["quality"]6366 )6367 return AssetPropertyValue(**v)6368 def as_dict(self):6369 d = {}6370 if self.__value is not None:6371 d["value"] = (6372 self.__value.as_dict()6373 if hasattr(self.__value, "as_dict")6374 else self.__value6375 )6376 if self.__timestamp is not None:6377 d["timestamp"] = (6378 self.__timestamp.as_dict()6379 if hasattr(self.__timestamp, "as_dict")6380 else self.__timestamp6381 )6382 if self.__quality is not None:6383 d["quality"] = (6384 self.__quality.as_dict()6385 if hasattr(self.__quality, "as_dict")6386 else self.__quality6387 )6388 return d6389 def __repr__(self):6390 return (6391 "<Class AssetPropertyValue. value: {}, timestamp: {}, quality: {}>".format(6392 limitedRepr(6393 self.__value[:20]6394 if isinstance(self.__value, bytes)6395 else self.__value6396 ),6397 limitedRepr(6398 self.__timestamp[:20]6399 if isinstance(self.__timestamp, bytes)6400 else self.__timestamp6401 ),6402 limitedRepr(6403 self.__quality[:20]6404 if isinstance(self.__quality, bytes)6405 else self.__quality6406 ),6407 )6408 )6409class PutAssetPropertyValueEntry:6410 """6411 Contains a list of value updates for a IoTSiteWise asset property in the list of asset entries consumed by the BatchPutAssetPropertyValue API. See https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchPutAssetPropertyValue.html.6412 """6413 __slots__ = [6414 "__entry_id",6415 "__asset_id",6416 "__property_id",6417 "__property_alias",6418 "__property_values",6419 ]6420 _types_map = {6421 "entry_id": {"type": str, "subtype": None},6422 "asset_id": {"type": str, "subtype": None},6423 "property_id": {"type": str, "subtype": None},6424 "property_alias": {"type": str, "subtype": None},6425 "property_values": {"type": list, "subtype": AssetPropertyValue},6426 }6427 _formats_map = {}6428 _validations_map = {6429 "entry_id": {6430 "required": True,6431 "minLength": 1,6432 "maxLength": 64,6433 "pattern": "^[a-zA-Z0-9_-]+$",6434 },6435 "asset_id": {6436 "required": False,6437 },6438 "property_id": {6439 "required": False,6440 },6441 "property_alias": {6442 "required": False,6443 "minLength": 1,6444 "maxLength": 2048,6445 "pattern": "[^\u0000-\u001F\u007F]+",6446 },6447 "property_values": {6448 "required": True,6449 "maxItems": 10,6450 "minItems": 1,6451 },6452 }6453 def __init__(6454 self,6455 entry_id: str = None,6456 asset_id: str = None,6457 property_id: str = None,6458 property_alias: str = None,6459 property_values: List[AssetPropertyValue] = None,6460 ):6461 """6462 :param entry_id: The user specified ID for the entry. You can use this ID to identify which entries failed.6463 :param asset_id: The ID of the asset to update.6464 :param property_id: The ID of the asset property for this entry.6465 :param property_alias: The property alias that identifies the property, such as an OPC-UA server data stream path (for example, /company/windfarm/3/turbine/7/temperature). For more information, see https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html.6466 :param property_values: The list of property values to upload. You can specify up to 10 values.6467 """6468 pass6469 self.__entry_id = entry_id6470 self.__asset_id = asset_id6471 self.__property_id = property_id6472 self.__property_alias = property_alias6473 self.__property_values = property_values6474 def _get_entry_id(self):6475 return self.__entry_id6476 def _set_entry_id(self, value):6477 if not isinstance(value, str):6478 raise TypeError("entry_id must be str")6479 self.__entry_id = value6480 entry_id = property(_get_entry_id, _set_entry_id)6481 """6482 The user specified ID for the entry. You can use this ID to identify which entries failed.6483 """6484 def _get_asset_id(self):6485 return self.__asset_id6486 def _set_asset_id(self, value):6487 if value is not None and not isinstance(value, str):6488 raise TypeError("asset_id must be str")6489 self.__asset_id = value6490 asset_id = property(_get_asset_id, _set_asset_id)6491 """6492 The ID of the asset to update.6493 """6494 def _get_property_id(self):6495 return self.__property_id6496 def _set_property_id(self, value):6497 if value is not None and not isinstance(value, str):6498 raise TypeError("property_id must be str")6499 self.__property_id = value6500 property_id = property(_get_property_id, _set_property_id)6501 """6502 The ID of the asset property for this entry.6503 """6504 def _get_property_alias(self):6505 return self.__property_alias6506 def _set_property_alias(self, value):6507 if value is not None and not isinstance(value, str):6508 raise TypeError("property_alias must be str")6509 self.__property_alias = value6510 property_alias = property(_get_property_alias, _set_property_alias)6511 """6512 The property alias that identifies the property, such as an OPC-UA server data stream path (for example, /company/windfarm/3/turbine/7/temperature). For more information, see https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html.6513 """6514 def _get_property_values(self):6515 return self.__property_values6516 def _set_property_values(self, value):6517 if not isinstance(value, list):6518 raise TypeError("property_values must be list")6519 if not all(isinstance(i, AssetPropertyValue) for i in value):6520 raise TypeError("property_values list values must be AssetPropertyValue")6521 self.__property_values = value6522 property_values = property(_get_property_values, _set_property_values)6523 """6524 The list of property values to upload. You can specify up to 10 values.6525 """6526 @staticmethod6527 def from_dict(d):6528 v = {}6529 if "entryId" in d:6530 v["entry_id"] = (6531 str.from_dict(d["entryId"])6532 if hasattr(str, "from_dict")6533 else d["entryId"]6534 )6535 if "assetId" in d:6536 v["asset_id"] = (6537 str.from_dict(d["assetId"])6538 if hasattr(str, "from_dict")6539 else d["assetId"]6540 )6541 if "propertyId" in d:6542 v["property_id"] = (6543 str.from_dict(d["propertyId"])6544 if hasattr(str, "from_dict")6545 else d["propertyId"]6546 )6547 if "propertyAlias" in d:6548 v["property_alias"] = (6549 str.from_dict(d["propertyAlias"])6550 if hasattr(str, "from_dict")6551 else d["propertyAlias"]6552 )6553 if "propertyValues" in d:6554 v["property_values"] = [6555 AssetPropertyValue.from_dict(p)6556 if hasattr(AssetPropertyValue, "from_dict")6557 else p6558 for p in d["propertyValues"]6559 ]6560 return PutAssetPropertyValueEntry(**v)6561 def as_dict(self):6562 d = {}6563 if self.__entry_id is not None:6564 d["entryId"] = (6565 self.__entry_id.as_dict()6566 if hasattr(self.__entry_id, "as_dict")6567 else self.__entry_id6568 )6569 if self.__asset_id is not None:6570 d["assetId"] = (6571 self.__asset_id.as_dict()6572 if hasattr(self.__asset_id, "as_dict")6573 else self.__asset_id6574 )6575 if self.__property_id is not None:6576 d["propertyId"] = (6577 self.__property_id.as_dict()6578 if hasattr(self.__property_id, "as_dict")6579 else self.__property_id6580 )6581 if self.__property_alias is not None:6582 d["propertyAlias"] = (6583 self.__property_alias.as_dict()6584 if hasattr(self.__property_alias, "as_dict")6585 else self.__property_alias6586 )6587 if self.__property_values is not None:6588 d["propertyValues"] = [6589 p.as_dict() if hasattr(p, "as_dict") else p6590 for p in self.__property_values6591 ]6592 return d6593 def __repr__(self):6594 return "<Class PutAssetPropertyValueEntry. entry_id: {}, asset_id: {}, property_id: {}, property_alias: {}, property_values: {}>".format(6595 limitedRepr(6596 self.__entry_id[:20]6597 if isinstance(self.__entry_id, bytes)6598 else self.__entry_id6599 ),6600 limitedRepr(6601 self.__asset_id[:20]6602 if isinstance(self.__asset_id, bytes)6603 else self.__asset_id...

Full Screen

Full Screen

mysql.py

Source:mysql.py Github

copy

Full Screen

...24 return crsr.execute(sql, params) if params is not None else crsr.execute(sql)25 def get_cursor(self) -> cursor.CursorBase:26 return self._conn.cursor()27 @staticmethod28 def _results_as_dict(crsr: cursor.CursorBase, results: List[Tuple]) -> List[dict]:29 return [{k[0]: v for (k, v) in zip(crsr.description, res)} for res in results]30 def fetch_one(self, sql: str, params: Optional[Tuple] = None, crsr: Optional[cursor.CursorBase] = None,31 as_dict: bool = False):32 """Low level query33 :param sql: raw SQL34 :param params: params for the query35 :param crsr: Optional cursor. If not given, one will be created and closed at the end of the query36 :param as_dict: If True, every record will be returned as a dictionary where the key is the column's name37 :return: None if no record was found, single record otherwise (tuple if as_dict = False, dict if as_dict = True)38 """39 final_crsr = crsr or self._conn.cursor()40 self._execute(final_crsr, sql, params)41 res = final_crsr.fetchone()42 if final_crsr == crsr:43 crsr.close()44 return self._results_as_dict(final_crsr, res) if as_dict else res45 def fetch_limit(self, sql: str, params: Optional[Union[Tuple, Dict]] = None,46 crsr: Optional[cursor.CursorBase] = None,47 as_dict: bool = False, limit: Optional[int] = None):48 """Low level query49 :param sql: raw SQL50 :param params: params for the query51 :param crsr: Optional cursor. If not given, one will be created and closed at the end of the query52 :param as_dict: If True, every record will be returned as a dictionary where the key is the column's name53 :param limit: Maximum amount of records to return. If None, no limit is enforced54 :return: List of records (tuples if as_dict = False, dict if as_dict = True)55 """56 sql = f"""57 {sql}58 {"" if limit is None else f"limit {limit}"}59 """60 final_crsr = crsr or self._conn.cursor()61 self._execute(final_crsr, sql, params)62 res = final_crsr.fetchall()63 if final_crsr == crsr:64 crsr.close()65 return self._results_as_dict(final_crsr, res) if as_dict else res66 def fetch_all(self, sql: str, params: Optional[Union[Tuple, Dict]] = None,67 crsr: Optional[cursor.CursorBase] = None,68 as_dict: bool = False):69 return self.fetch_limit(sql, params, crsr, as_dict, None)70 def _generate_query(self, table: str, projection: List[str] = None, filters: Dict[str, Any] = None):71 projection = projection or ['*']72 filters = filters or dict()73 where_clauses = []74 where_values = []75 for column, value in filters.items():76 if isinstance(value, (list, tuple)):77 if len(value) > 0:78 where_clauses.append(f"{column} in ({', '.join(['%s'] * len(value))})")79 where_values.extend(value)...

Full Screen

Full Screen

auth_constraints.py

Source:auth_constraints.py Github

copy

Full Screen

...30class AbstractAuthConstraint(metaclass=ABCMeta):31 def __init__(self):32 self.constraint_id = ''33 @property34 def as_dict(self):35 raise NotImplementedError()36 def __str__(self):37 return str(self)38 def __eq__(self, other):39 if self.as_dict != other.as_dict:40 return False41 return True42 def set_metadata(self, metadata: dict):43 raise NotImplementedError()44 @staticmethod45 def from_dict(as_dict):46 raise NotImplementedError()47class AuthConstraintForbidden(AbstractAuthConstraint):48 def __init__(self):49 self.constraint_id = ConstraintsEnum.FORBIDDEN_CONSTRAINT_ID50 @property51 def as_dict(self):52 return {CONSTRAINT_ID: self.constraint_id}53 def __str__(self):54 return "The action is forbidden"55 def set_metadata(self, metadata: dict):56 pass57 @staticmethod58 def from_dict(as_dict):59 return AuthConstraintForbidden()60class AuthConstraint(AbstractAuthConstraint):61 def __init__(self, role, sig_count,62 need_to_be_owner=False,63 off_ledger_signature=None,64 metadata={}):65 self._role_validation(role, off_ledger_signature)66 self.role = role67 self.sig_count = sig_count68 self.need_to_be_owner = need_to_be_owner69 self.off_ledger_signature = off_ledger_signature70 self.metadata = metadata71 self.constraint_id = ConstraintsEnum.ROLE_CONSTRAINT_ID72 @property73 def as_dict(self):74 constraint = {75 CONSTRAINT_ID: self.constraint_id,76 ROLE: self.role,77 SIG_COUNT: self.sig_count,78 NEED_TO_BE_OWNER: self.need_to_be_owner,79 METADATA: self.metadata80 }81 if self.off_ledger_signature is not None:82 constraint[OFF_LEDGER_SIGNATURE] = self.off_ledger_signature83 return constraint84 @staticmethod85 def _role_validation(role, off_ledger_signature):86 if role not in accepted_roles:87 raise ValueError("Role {} is not acceptable".format(role))88 if off_ledger_signature and role != "*":89 raise ValueError("'off_ledger_signature' can be set to True only if any role is accepted (role='*'). "90 "Got {} role instead.".format(role))91 def __str__(self):92 role = get_named_role(self.role) if self.role != '*' else 'ALL'93 error_msg = ""94 if self.off_ledger_signature and self.sig_count > 1:95 error_msg = "{} signatures of any role (off-ledger included) are required".format(self.sig_count)96 elif self.off_ledger_signature and self.sig_count == 1:97 error_msg = "1 signature of any role (off-ledger included) is required"98 elif role != 'ALL' and self.need_to_be_owner and self.sig_count > 1:99 error_msg = "{} {} signatures are required and needs to be owner".format(self.sig_count, role)100 elif role != 'ALL' and not self.need_to_be_owner and self.sig_count > 1:101 error_msg = "{} {} signatures are required".format(self.sig_count, role)102 elif role != 'ALL' and not self.need_to_be_owner and self.sig_count == 1:103 error_msg = "1 {} signature is required".format(role)104 elif role != 'ALL' and self.need_to_be_owner and self.sig_count == 1:105 error_msg = "1 {} signature is required and needs to be owner".format(role)106 elif role == "ALL" and self.need_to_be_owner and self.sig_count == 1:107 error_msg = "1 signature of any role is required and needs to be owner"108 elif role == 'ALL' and not self.need_to_be_owner and self.sig_count == 1:109 error_msg = "1 signature of any role is required".format(role)110 elif role == 'ALL' and not self.need_to_be_owner and self.sig_count > 1:111 error_msg = "{} signatures of any role are required".format(self.sig_count)112 elif role == "ALL" and self.need_to_be_owner and self.sig_count > 1:113 error_msg = "{} signatures of any role are required and needs to be owner".format(self.sig_count)114 metadata_str = self._metadata_str()115 if metadata_str:116 return "{} {}".format(error_msg, metadata_str)117 return error_msg118 def _metadata_str(self):119 if not self.metadata:120 return ""121 res = " ".join([str(item) for values in self.metadata.items() for item in values])122 return "with additional metadata {}".format(res)123 @staticmethod124 def from_dict(as_dict):125 return AuthConstraint(role=as_dict[ROLE], sig_count=as_dict[SIG_COUNT],126 need_to_be_owner=as_dict.get(NEED_TO_BE_OWNER, False),127 off_ledger_signature=as_dict.get(OFF_LEDGER_SIGNATURE, None),128 metadata=as_dict.get(METADATA, {}))129 def set_metadata(self, metadata: dict):130 self.metadata = metadata131class AuthConstraintAnd(AbstractAuthConstraint):132 def __init__(self, auth_constraints: List[AbstractAuthConstraint]):133 self.auth_constraints = auth_constraints134 self.constraint_id = ConstraintsEnum.AND_CONSTRAINT_ID135 @property136 def as_dict(self):137 return {138 CONSTRAINT_ID: self.constraint_id,139 AUTH_CONSTRAINTS: [c.as_dict for c in self.auth_constraints]140 }141 def __str__(self):142 return " AND ".join([str(ac) for ac in self.auth_constraints])143 @staticmethod144 def from_dict(as_dict):145 auth_constraints = []146 for input_constraint in as_dict[AUTH_CONSTRAINTS]:147 dict_constraint = dict(input_constraint)148 constraint_id = dict_constraint.pop(CONSTRAINT_ID)149 constraint_cls = constraint_to_class_map.get(constraint_id)150 auth_constraints.append(constraint_cls.from_dict(dict_constraint))151 as_dict[AUTH_CONSTRAINTS] = auth_constraints152 return AuthConstraintAnd(**as_dict)153 def set_metadata(self, metadata: dict):154 for constraint in self.auth_constraints:155 constraint.set_metadata(metadata)156class AuthConstraintOr(AbstractAuthConstraint):157 def __init__(self, auth_constraints: List[AbstractAuthConstraint]):158 self.auth_constraints = auth_constraints159 self.constraint_id = ConstraintsEnum.OR_CONSTRAINT_ID160 @property161 def as_dict(self):162 return {163 CONSTRAINT_ID: self.constraint_id,164 AUTH_CONSTRAINTS: [c.as_dict for c in self.auth_constraints]165 }166 def __str__(self):167 return " OR ".join([str(ac) for ac in self.auth_constraints])168 @staticmethod169 def from_dict(as_dict):170 auth_constraints = []171 for input_constraint in as_dict[AUTH_CONSTRAINTS]:172 dict_constraint = dict(input_constraint)173 constraint_id = dict_constraint.pop(CONSTRAINT_ID)174 if constraint_id is None:175 raise KeyError('There is no "constraint_id" field in deserialised dict: {}'.format(as_dict))...

Full Screen

Full Screen

batch.py

Source:batch.py Github

copy

Full Screen

1import csv2import logging3from django.conf import settings4from apps.banner import models5logger = logging.getLogger('apps.banner')6class Batch:7 test = False8 def import_all(self, test=False):9 if test:10 self.test = True11 self.import_impressions(1)12 self.import_clicks(1)13 self.import_conversions(1)14 return15 for quarter in range(1, 5):16 self.import_impressions(quarter)17 self.import_clicks(quarter)18 self.import_conversions(quarter)19 def import_impressions(self, quarter):20 file = '%s/data/test/impressions.csv' % settings.BASE_DIR if self.test else '%s/data/%d/impressions_%d.csv' % (21 settings.BASE_DIR, quarter, quarter)22 with open(file) as csvfile:23 reader = csv.reader(csvfile)24 headers = next(reader)25 for row in reader:26 as_dict = dict(zip(headers, row))27 banner, _ = models.Banner.objects.get_or_create(28 banner_id=as_dict['banner_id']29 )30 campaign, _ = models.Campaign.objects.get_or_create(31 campaign_id=as_dict['campaign_id']32 )33 models.Impression.objects.create(34 quarter=quarter,35 banner=banner,36 campaign=campaign37 )38 def import_clicks(self, quarter):39 file = '%s/data/test/clicks.csv' % settings.BASE_DIR if self.test else '%s/data/%d/clicks_%d.csv' % (40 settings.BASE_DIR, quarter, quarter)41 num_exist = 042 with open(file) as csvfile:43 reader = csv.reader(csvfile)44 headers = next(reader)45 for row in reader:46 as_dict = dict(zip(headers, row))47 banner = models.Banner.objects.get(banner_id=as_dict['banner_id'])48 campaign = models.Campaign.objects.get(campaign_id=as_dict['campaign_id'])49 num_impressions = models.Impression.objects.filter(50 quarter=quarter,51 banner=banner,52 campaign=campaign53 ).count()54 try:55 click = models.Click.objects.get(click_id=as_dict['click_id'])56 click.quarter = quarter57 click.num_impressions = num_impressions58 click.banner = banner59 click.campaign = campaign60 click.save()61 num_exist += 162 logger.debug('duplicate click_id: %s' % as_dict['click_id'])63 except models.Click.DoesNotExist:64 models.Click.objects.create(65 click_id=as_dict['click_id'],66 quarter=quarter,67 num_impressions=num_impressions,68 banner=banner,69 campaign=campaign,70 )71 logger.info('%d duplicate clicks' % num_exist)72 def import_conversions(self, quarter):73 file = '%s/data/test/conversions.csv' % settings.BASE_DIR if self.test else '%s/data/%d/conversions_%d.csv' % (74 settings.BASE_DIR, quarter, quarter)75 num_exist = 076 with open(file) as csvfile:77 reader = csv.reader(csvfile)78 headers = next(reader)79 for row in reader:80 as_dict = dict(zip(headers, row))81 click = models.Click.objects.get(click_id=as_dict['click_id'])82 try:83 conversion = models.Conversion.objects.get(conversion_id=as_dict['conversion_id'])84 conversion.click = click85 conversion.revenue = float(as_dict['revenue'])86 conversion.save()87 num_exist += 188 logger.debug('duplicate conversion_id: %s' % as_dict['conversion_id'])89 except models.Conversion.DoesNotExist:90 models.Conversion.objects.create(91 conversion_id=as_dict['conversion_id'],92 click=click,93 revenue=float(as_dict['revenue'])94 )...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful