Skip to content

Commit

Permalink
[bot] Updated client based on openapi-32be7e9/clientgen (#251)
Browse files Browse the repository at this point in the history
Co-authored-by: API Engineering <[email protected]>
Co-authored-by: Andrew Starr-Bochicchio <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2023
1 parent 0043b0f commit bbe5d06
Show file tree
Hide file tree
Showing 3 changed files with 251 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DO_OPENAPI_COMMIT_SHA.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
13ed326
32be7e9
114 changes: 114 additions & 0 deletions src/pydo/aio/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -75110,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
Expand Down
136 changes: 136 additions & 0 deletions src/pydo/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -81983,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
Expand Down

0 comments on commit bbe5d06

Please sign in to comment.