Skip to content

Commit

Permalink
[bot] Updated client based on openapi-2c75905/clientgen (#271)
Browse files Browse the repository at this point in the history
Co-authored-by: API Engineering <[email protected]>
  • Loading branch information
digitalocean-engineering and API Engineering authored Mar 18, 2024
1 parent e0adb47 commit bea00a9
Show file tree
Hide file tree
Showing 3 changed files with 845 additions and 206 deletions.
2 changes: 1 addition & 1 deletion DO_OPENAPI_COMMIT_SHA.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
479ee7b
2c75905
301 changes: 301 additions & 0 deletions src/pydo/aio/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
build_databases_destroy_cluster_request,
build_databases_destroy_replica_request,
build_databases_get_ca_request,
build_databases_get_cluster_metrics_credentials_request,
build_databases_get_cluster_request,
build_databases_get_config_request,
build_databases_get_connection_pool_request,
Expand All @@ -112,6 +113,7 @@
build_databases_patch_config_request,
build_databases_promote_replica_request,
build_databases_reset_auth_request,
build_databases_update_cluster_metrics_credentials_request,
build_databases_update_cluster_size_request,
build_databases_update_connection_pool_request,
build_databases_update_eviction_policy_request,
Expand Down Expand Up @@ -75519,6 +75521,14 @@ async def list_clusters(
indicating whether any maintenance is scheduled to be performed in
the next window.
},
"metrics_endpoints": [
{
"host": "str", # Optional. A FQDN pointing
to the database cluster's node(s).
"port": 0 # Optional. The port on which a
service is listening.
}
],
"name": "str", # A unique, human-readable name referring to
a database cluster. Required.
"num_nodes": 0, # The number of nodes in the database
Expand Down Expand Up @@ -75854,6 +75864,14 @@ async def create_cluster(
"pending": bool # Optional. A boolean value indicating whether any
maintenance is scheduled to be performed in the next window.
},
"metrics_endpoints": [
{
"host": "str", # Optional. A FQDN pointing to the database
cluster's node(s).
"port": 0 # Optional. The port on which a service is
listening.
}
],
"name": "str", # A unique, human-readable name referring to a database
cluster. Required.
"num_nodes": 0, # The number of nodes in the database cluster. Required.
Expand Down Expand Up @@ -76044,6 +76062,14 @@ async def create_cluster(
"pending": bool # Optional. A boolean value indicating
whether any maintenance is scheduled to be performed in the next window.
},
"metrics_endpoints": [
{
"host": "str", # Optional. A FQDN pointing to the
database cluster's node(s).
"port": 0 # Optional. The port on which a service is
listening.
}
],
"name": "str", # A unique, human-readable name referring to a
database cluster. Required.
"num_nodes": 0, # The number of nodes in the database cluster.
Expand Down Expand Up @@ -76293,6 +76319,14 @@ async def create_cluster(
"pending": bool # Optional. A boolean value indicating
whether any maintenance is scheduled to be performed in the next window.
},
"metrics_endpoints": [
{
"host": "str", # Optional. A FQDN pointing to the
database cluster's node(s).
"port": 0 # Optional. The port on which a service is
listening.
}
],
"name": "str", # A unique, human-readable name referring to a
database cluster. Required.
"num_nodes": 0, # The number of nodes in the database cluster.
Expand Down Expand Up @@ -76540,6 +76574,14 @@ async def create_cluster(self, body: Union[JSON, IO], **kwargs: Any) -> JSON:
"pending": bool # Optional. A boolean value indicating
whether any maintenance is scheduled to be performed in the next window.
},
"metrics_endpoints": [
{
"host": "str", # Optional. A FQDN pointing to the
database cluster's node(s).
"port": 0 # Optional. The port on which a service is
listening.
}
],
"name": "str", # A unique, human-readable name referring to a
database cluster. Required.
"num_nodes": 0, # The number of nodes in the database cluster.
Expand Down Expand Up @@ -76862,6 +76904,14 @@ async def get_cluster(self, database_cluster_uuid: str, **kwargs: Any) -> JSON:
"pending": bool # Optional. A boolean value indicating
whether any maintenance is scheduled to be performed in the next window.
},
"metrics_endpoints": [
{
"host": "str", # Optional. A FQDN pointing to the
database cluster's node(s).
"port": 0 # Optional. The port on which a service is
listening.
}
],
"name": "str", # A unique, human-readable name referring to a
database cluster. Required.
"num_nodes": 0, # The number of nodes in the database cluster.
Expand Down Expand Up @@ -86534,6 +86584,257 @@ async def delete_kafka_topic(

return deserialized

@distributed_trace_async
async def get_cluster_metrics_credentials(self, **kwargs: Any) -> JSON:
"""Retrieve Database Clusters' Metrics Endpoint Credentials.

To show the credentials for all database clusters' metrics endpoints, send a GET request to
``/v2/databases/metrics/credentials``. The result will be a JSON object with a ``credentials``
key.

:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# response body for status code(s): 200
response == {
"credentials": {
"credentials": {
"basic_auth_password": "str", # Optional. basic
authentication password for metrics HTTP endpoint.
"basic_auth_username": "str" # Optional. basic
authentication username for metrics HTTP endpoint.
}
}
}
# 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_get_cluster_metrics_credentials_request(
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)

@overload
async def update_cluster_metrics_credentials( # pylint: disable=inconsistent-return-statements
self,
body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> None:
"""Update Database Clusters' Metrics Endpoint Credentials.

To update the credentials for all database clusters' metrics endpoints, send a PUT request to
``/v2/databases/metrics/credentials``. A successful request will receive a 204 No Content
status code with no body in response.

:param body: Default value is None.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# JSON input template you can fill out and use as your body input.
body = {
"credentials": {
"basic_auth_password": "str", # Optional. basic authentication
password for metrics HTTP endpoint.
"basic_auth_username": "str" # Optional. basic authentication
username for metrics HTTP endpoint.
}
}
"""

@overload
async def update_cluster_metrics_credentials( # pylint: disable=inconsistent-return-statements
self,
body: Optional[IO] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> None:
"""Update Database Clusters' Metrics Endpoint Credentials.

To update the credentials for all database clusters' metrics endpoints, send a PUT request to
``/v2/databases/metrics/credentials``. A successful request will receive a 204 No Content
status code with no body in response.

:param body: Default value is None.
:type body: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""

@distributed_trace_async
async def update_cluster_metrics_credentials( # pylint: disable=inconsistent-return-statements
self, body: Optional[Union[JSON, IO]] = None, **kwargs: Any
) -> None:
"""Update Database Clusters' Metrics Endpoint Credentials.

To update the credentials for all database clusters' metrics endpoints, send a PUT request to
``/v2/databases/metrics/credentials``. A successful request will receive a 204 No Content
status code with no body in response.

:param body: Is either a model type or a IO type. Default value is None.
:type body: JSON or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}

content_type = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[None]

content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(body, (IO, bytes)):
_content = body
else:
if body is not None:
_json = body
else:
_json = None

request = build_databases_update_cluster_metrics_credentials_request(
content_type=content_type,
json=_json,
content=_content,
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 [204]:
map_error(
status_code=response.status_code, response=response, error_map=error_map
)
raise HttpResponseError(response=response)

response_headers = {}
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 cls:
return cls(pipeline_response, None, response_headers)


class DomainsOperations:
"""
Expand Down
Loading

0 comments on commit bea00a9

Please sign in to comment.