Skip to content

Commit 91dc581

Browse files
digitalocean-engineeringAPI Engineering
andauthored
[bot] Updated client based on openapi-3070398/clientgen (#446)
Co-authored-by: API Engineering <[email protected]>
1 parent 6d07314 commit 91dc581

File tree

3 files changed

+289
-1
lines changed

3 files changed

+289
-1
lines changed

DO_OPENAPI_COMMIT_SHA.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0fb7311
1+
3070398

src/pydo/aio/operations/_operations.py

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
build_apps_get_deployment_request,
5050
build_apps_get_exec_active_deployment_request,
5151
build_apps_get_exec_request,
52+
build_apps_get_health_request,
5253
build_apps_get_instance_size_request,
5354
build_apps_get_logs_active_deployment_aggregate_request,
5455
build_apps_get_logs_active_deployment_request,
@@ -94127,6 +94128,140 @@ async def list_metrics_bandwidth_daily(
9412794128

9412894129
return cast(JSON, deserialized) # type: ignore
9412994130

94131+
@distributed_trace_async
94132+
async def get_health(self, app_id: str, **kwargs: Any) -> JSON:
94133+
# pylint: disable=line-too-long
94134+
"""Retrieve App Health.
94135+
94136+
Retrieve information like health status, cpu and memory utilization of app components.
94137+
94138+
:param app_id: The app ID. Required.
94139+
:type app_id: str
94140+
:return: JSON object
94141+
:rtype: JSON
94142+
:raises ~azure.core.exceptions.HttpResponseError:
94143+
94144+
Example:
94145+
.. code-block:: python
94146+
94147+
# response body for status code(s): 200
94148+
response == {
94149+
"app_health": {
94150+
"components": [
94151+
{
94152+
"cpu_usage_percent": 0.0, # Optional.
94153+
"memory_usage_percent": 0.0, # Optional.
94154+
"name": "str", # Optional.
94155+
"replicas_desired": 0, # Optional.
94156+
"replicas_ready": 0, # Optional.
94157+
"state": "UNKNOWN" # Optional. Default value is
94158+
"UNKNOWN". Known values are: "UNKNOWN", "HEALTHY", and "UNHEALTHY".
94159+
}
94160+
],
94161+
"functions_components": [
94162+
{
94163+
"functions_component_health_metrics": [
94164+
{
94165+
"metric_label": "str", # Optional.
94166+
"metric_value": 0.0, # Optional.
94167+
"time_window": "str" # Optional.
94168+
}
94169+
],
94170+
"name": "str" # Optional.
94171+
}
94172+
]
94173+
}
94174+
}
94175+
# response body for status code(s): 404
94176+
response == {
94177+
"id": "str", # A short identifier corresponding to the HTTP status code
94178+
returned. For example, the ID for a response returning a 404 status code would
94179+
be "not_found.". Required.
94180+
"message": "str", # A message providing additional information about the
94181+
error, including details to help resolve it when possible. Required.
94182+
"request_id": "str" # Optional. Optionally, some endpoints may include a
94183+
request ID that should be provided when reporting bugs or opening support
94184+
tickets to help identify the issue.
94185+
}
94186+
"""
94187+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
94188+
404: ResourceNotFoundError,
94189+
409: ResourceExistsError,
94190+
304: ResourceNotModifiedError,
94191+
401: cast(
94192+
Type[HttpResponseError],
94193+
lambda response: ClientAuthenticationError(response=response),
94194+
),
94195+
429: HttpResponseError,
94196+
500: HttpResponseError,
94197+
}
94198+
error_map.update(kwargs.pop("error_map", {}) or {})
94199+
94200+
_headers = kwargs.pop("headers", {}) or {}
94201+
_params = kwargs.pop("params", {}) or {}
94202+
94203+
cls: ClsType[JSON] = kwargs.pop("cls", None)
94204+
94205+
_request = build_apps_get_health_request(
94206+
app_id=app_id,
94207+
headers=_headers,
94208+
params=_params,
94209+
)
94210+
_request.url = self._client.format_url(_request.url)
94211+
94212+
_stream = False
94213+
pipeline_response: PipelineResponse = (
94214+
await self._client._pipeline.run( # pylint: disable=protected-access
94215+
_request, stream=_stream, **kwargs
94216+
)
94217+
)
94218+
94219+
response = pipeline_response.http_response
94220+
94221+
if response.status_code not in [200, 404]:
94222+
if _stream:
94223+
await response.read() # Load the body in memory and close the socket
94224+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
94225+
raise HttpResponseError(response=response)
94226+
94227+
response_headers = {}
94228+
if response.status_code == 200:
94229+
response_headers["ratelimit-limit"] = self._deserialize(
94230+
"int", response.headers.get("ratelimit-limit")
94231+
)
94232+
response_headers["ratelimit-remaining"] = self._deserialize(
94233+
"int", response.headers.get("ratelimit-remaining")
94234+
)
94235+
response_headers["ratelimit-reset"] = self._deserialize(
94236+
"int", response.headers.get("ratelimit-reset")
94237+
)
94238+
94239+
if response.content:
94240+
deserialized = response.json()
94241+
else:
94242+
deserialized = None
94243+
94244+
if response.status_code == 404:
94245+
response_headers["ratelimit-limit"] = self._deserialize(
94246+
"int", response.headers.get("ratelimit-limit")
94247+
)
94248+
response_headers["ratelimit-remaining"] = self._deserialize(
94249+
"int", response.headers.get("ratelimit-remaining")
94250+
)
94251+
response_headers["ratelimit-reset"] = self._deserialize(
94252+
"int", response.headers.get("ratelimit-reset")
94253+
)
94254+
94255+
if response.content:
94256+
deserialized = response.json()
94257+
else:
94258+
deserialized = None
94259+
94260+
if cls:
94261+
return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
94262+
94263+
return cast(JSON, deserialized) # type: ignore
94264+
9413094265

9413194266
class CdnOperations:
9413294267
"""

src/pydo/operations/_operations.py

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,25 @@ def build_apps_list_metrics_bandwidth_daily_request(
10021002
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
10031003

10041004

1005+
def build_apps_get_health_request(app_id: str, **kwargs: Any) -> HttpRequest:
1006+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1007+
1008+
accept = _headers.pop("Accept", "application/json")
1009+
1010+
# Construct URL
1011+
_url = "/v2/apps/{app_id}/health"
1012+
path_format_arguments = {
1013+
"app_id": _SERIALIZER.url("app_id", app_id, "str"),
1014+
}
1015+
1016+
_url: str = _url.format(**path_format_arguments) # type: ignore
1017+
1018+
# Construct headers
1019+
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
1020+
1021+
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
1022+
1023+
10051024
def build_cdn_list_endpoints_request(
10061025
*, per_page: int = 20, page: int = 1, **kwargs: Any
10071026
) -> HttpRequest:
@@ -104485,6 +104504,140 @@ def list_metrics_bandwidth_daily(
104485104504

104486104505
return cast(JSON, deserialized) # type: ignore
104487104506

104507+
@distributed_trace
104508+
def get_health(self, app_id: str, **kwargs: Any) -> JSON:
104509+
# pylint: disable=line-too-long
104510+
"""Retrieve App Health.
104511+
104512+
Retrieve information like health status, cpu and memory utilization of app components.
104513+
104514+
:param app_id: The app ID. Required.
104515+
:type app_id: str
104516+
:return: JSON object
104517+
:rtype: JSON
104518+
:raises ~azure.core.exceptions.HttpResponseError:
104519+
104520+
Example:
104521+
.. code-block:: python
104522+
104523+
# response body for status code(s): 200
104524+
response == {
104525+
"app_health": {
104526+
"components": [
104527+
{
104528+
"cpu_usage_percent": 0.0, # Optional.
104529+
"memory_usage_percent": 0.0, # Optional.
104530+
"name": "str", # Optional.
104531+
"replicas_desired": 0, # Optional.
104532+
"replicas_ready": 0, # Optional.
104533+
"state": "UNKNOWN" # Optional. Default value is
104534+
"UNKNOWN". Known values are: "UNKNOWN", "HEALTHY", and "UNHEALTHY".
104535+
}
104536+
],
104537+
"functions_components": [
104538+
{
104539+
"functions_component_health_metrics": [
104540+
{
104541+
"metric_label": "str", # Optional.
104542+
"metric_value": 0.0, # Optional.
104543+
"time_window": "str" # Optional.
104544+
}
104545+
],
104546+
"name": "str" # Optional.
104547+
}
104548+
]
104549+
}
104550+
}
104551+
# response body for status code(s): 404
104552+
response == {
104553+
"id": "str", # A short identifier corresponding to the HTTP status code
104554+
returned. For example, the ID for a response returning a 404 status code would
104555+
be "not_found.". Required.
104556+
"message": "str", # A message providing additional information about the
104557+
error, including details to help resolve it when possible. Required.
104558+
"request_id": "str" # Optional. Optionally, some endpoints may include a
104559+
request ID that should be provided when reporting bugs or opening support
104560+
tickets to help identify the issue.
104561+
}
104562+
"""
104563+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
104564+
404: ResourceNotFoundError,
104565+
409: ResourceExistsError,
104566+
304: ResourceNotModifiedError,
104567+
401: cast(
104568+
Type[HttpResponseError],
104569+
lambda response: ClientAuthenticationError(response=response),
104570+
),
104571+
429: HttpResponseError,
104572+
500: HttpResponseError,
104573+
}
104574+
error_map.update(kwargs.pop("error_map", {}) or {})
104575+
104576+
_headers = kwargs.pop("headers", {}) or {}
104577+
_params = kwargs.pop("params", {}) or {}
104578+
104579+
cls: ClsType[JSON] = kwargs.pop("cls", None)
104580+
104581+
_request = build_apps_get_health_request(
104582+
app_id=app_id,
104583+
headers=_headers,
104584+
params=_params,
104585+
)
104586+
_request.url = self._client.format_url(_request.url)
104587+
104588+
_stream = False
104589+
pipeline_response: PipelineResponse = (
104590+
self._client._pipeline.run( # pylint: disable=protected-access
104591+
_request, stream=_stream, **kwargs
104592+
)
104593+
)
104594+
104595+
response = pipeline_response.http_response
104596+
104597+
if response.status_code not in [200, 404]:
104598+
if _stream:
104599+
response.read() # Load the body in memory and close the socket
104600+
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
104601+
raise HttpResponseError(response=response)
104602+
104603+
response_headers = {}
104604+
if response.status_code == 200:
104605+
response_headers["ratelimit-limit"] = self._deserialize(
104606+
"int", response.headers.get("ratelimit-limit")
104607+
)
104608+
response_headers["ratelimit-remaining"] = self._deserialize(
104609+
"int", response.headers.get("ratelimit-remaining")
104610+
)
104611+
response_headers["ratelimit-reset"] = self._deserialize(
104612+
"int", response.headers.get("ratelimit-reset")
104613+
)
104614+
104615+
if response.content:
104616+
deserialized = response.json()
104617+
else:
104618+
deserialized = None
104619+
104620+
if response.status_code == 404:
104621+
response_headers["ratelimit-limit"] = self._deserialize(
104622+
"int", response.headers.get("ratelimit-limit")
104623+
)
104624+
response_headers["ratelimit-remaining"] = self._deserialize(
104625+
"int", response.headers.get("ratelimit-remaining")
104626+
)
104627+
response_headers["ratelimit-reset"] = self._deserialize(
104628+
"int", response.headers.get("ratelimit-reset")
104629+
)
104630+
104631+
if response.content:
104632+
deserialized = response.json()
104633+
else:
104634+
deserialized = None
104635+
104636+
if cls:
104637+
return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
104638+
104639+
return cast(JSON, deserialized) # type: ignore
104640+
104488104641

104489104642
class CdnOperations:
104490104643
"""

0 commit comments

Comments
 (0)