From 4a934371d0c73c07ff0d6165ac4ccfc22b7a7159 Mon Sep 17 00:00:00 2001 From: API Engineering Date: Tue, 28 Nov 2023 15:45:24 +0000 Subject: [PATCH] [bot] Updated client based on openapi-32be7e9/clientgen --- DO_OPENAPI_COMMIT_SHA.txt | 2 +- src/pydo/aio/operations/_operations.py | 172 ++++++++++++++++------ src/pydo/operations/_operations.py | 194 +++++++++++++++++++------ 3 files changed, 277 insertions(+), 91 deletions(-) diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index fcda552c..ab612cfa 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -7a717b3 +32be7e9 diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index bce0eb26..f357dee8 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -102,6 +102,7 @@ build_databases_list_backups_request, build_databases_list_clusters_request, build_databases_list_connection_pools_request, + build_databases_list_events_logs_request, build_databases_list_firewall_rules_request, build_databases_list_kafka_topics_request, build_databases_list_options_request, @@ -72987,6 +72988,10 @@ async def update_online_migration( body = { "disable_ssl": bool, # Optional. Enables SSL encryption when connecting to the source database. + "ignore_dbs": [ + "str" # Optional. List of databases that should be ignored during + migration. + ], "source": { "dbname": "str", # Optional. The name of the default database. "host": "str", # Optional. The FQDN pointing to the database @@ -75106,6 +75111,119 @@ async def create_replica( return cast(JSON, deserialized) + @distributed_trace_async + async def list_events_logs(self, database_cluster_uuid: str, **kwargs: Any) -> JSON: + """List all Events Logs. + + To list all of the cluster events, send a GET request to + ``/v2/databases/$DATABASE_ID/events``. + + The result will be a JSON object with a ``events`` key. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "events": [ + { + "cluster_name": "str", # Optional. The name of cluster. + "create_time": "str", # Optional. The time of the generation + of a event. + "event_type": "str", # Optional. Type of the event. + "id": "str" # Optional. ID of the particular event. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 401: lambda response: ClientAuthenticationError(response=response), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls = kwargs.pop("cls", None) # type: ClsType[JSON] + + request = build_databases_list_events_logs_request( + database_cluster_uuid=database_cluster_uuid, + headers=_headers, + params=_params, + ) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error( + status_code=response.status_code, response=response, error_map=error_map + ) + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) + + return cast(JSON, deserialized) + @distributed_trace_async async def get_replica( self, database_cluster_uuid: str, replica_name: str, **kwargs: Any @@ -79423,14 +79541,10 @@ async def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is 604800000. The + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default value is - False. Whether unclean_leader_election_enable specifies whether to allow - replicas that are not insync to be elected as leaders as a last resort. This - may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partition_count": 0, # Optional. The number of partitions available for the @@ -79530,14 +79644,10 @@ async def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -79701,14 +79811,10 @@ async def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -79870,14 +79976,10 @@ async def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -80120,14 +80222,10 @@ async def get_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -80357,14 +80455,10 @@ async def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is 604800000. The + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default value is - False. Whether unclean_leader_election_enable specifies whether to allow - replicas that are not insync to be elected as leaders as a last resort. This - may result in data loss since those leaders are not insync. }, "partition_count": 0, # Optional. The number of partitions available for the topic. On update, this value can only be increased. @@ -80463,14 +80557,10 @@ async def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -80637,14 +80727,10 @@ async def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -80809,14 +80895,10 @@ async def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index 67ae6ee2..0a9b865c 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -1795,6 +1795,29 @@ def build_databases_create_replica_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) +def build_databases_list_events_logs_request( + database_cluster_uuid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/databases/{database_cluster_uuid}/events" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + def build_databases_get_replica_request( database_cluster_uuid: str, replica_name: str, **kwargs: Any ) -> HttpRequest: @@ -79862,6 +79885,10 @@ def update_online_migration( body = { "disable_ssl": bool, # Optional. Enables SSL encryption when connecting to the source database. + "ignore_dbs": [ + "str" # Optional. List of databases that should be ignored during + migration. + ], "source": { "dbname": "str", # Optional. The name of the default database. "host": "str", # Optional. The FQDN pointing to the database @@ -81979,6 +82006,119 @@ def create_replica( return cast(JSON, deserialized) + @distributed_trace + def list_events_logs(self, database_cluster_uuid: str, **kwargs: Any) -> JSON: + """List all Events Logs. + + To list all of the cluster events, send a GET request to + ``/v2/databases/$DATABASE_ID/events``. + + The result will be a JSON object with a ``events`` key. + + :param database_cluster_uuid: A unique identifier for a database cluster. Required. + :type database_cluster_uuid: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "events": [ + { + "cluster_name": "str", # Optional. The name of cluster. + "create_time": "str", # Optional. The time of the generation + of a event. + "event_type": "str", # Optional. Type of the event. + "id": "str" # Optional. ID of the particular event. + } + ] + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 401: lambda response: ClientAuthenticationError(response=response), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls = kwargs.pop("cls", None) # type: ClsType[JSON] + + request = build_databases_list_events_logs_request( + database_cluster_uuid=database_cluster_uuid, + headers=_headers, + params=_params, + ) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error( + status_code=response.status_code, response=response, error_map=error_map + ) + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) + + return cast(JSON, deserialized) + @distributed_trace def get_replica( self, database_cluster_uuid: str, replica_name: str, **kwargs: Any @@ -86290,14 +86430,10 @@ def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is 604800000. The + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default value is - False. Whether unclean_leader_election_enable specifies whether to allow - replicas that are not insync to be elected as leaders as a last resort. This - may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partition_count": 0, # Optional. The number of partitions available for the @@ -86397,14 +86533,10 @@ def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -86568,14 +86700,10 @@ def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -86737,14 +86865,10 @@ def create_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -86987,14 +87111,10 @@ def get_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -87224,14 +87344,10 @@ def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is 604800000. The + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default value is - False. Whether unclean_leader_election_enable specifies whether to allow - replicas that are not insync to be elected as leaders as a last resort. This - may result in data loss since those leaders are not insync. }, "partition_count": 0, # Optional. The number of partitions available for the topic. On update, this value can only be increased. @@ -87330,14 +87446,10 @@ def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -87504,14 +87616,10 @@ def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [ @@ -87676,14 +87784,10 @@ def update_kafka_topic( "segment_jitter_ms": 0, # Optional. Default value is 0. The segment_jitter_ms specifies the maximum random jitter subtracted from the scheduled segment roll time to avoid thundering herds of segment rolling. - "segment_ms": 604800000, # Optional. Default value is + "segment_ms": 604800000 # Optional. Default value is 604800000. The segment_ms specifies the period of time after which the log will be forced to roll if the segment file isn't full. This ensures that retention can delete or compact old data. - "unclean_leader_election_enable": False # Optional. Default - value is False. Whether unclean_leader_election_enable specifies whether - to allow replicas that are not insync to be elected as leaders as a last - resort. This may result in data loss since those leaders are not insync. }, "name": "str", # Optional. The name of the Kafka topic. "partitions": [