Skip to content

Commit

Permalink
[bot] Updated client based on openapi-352faf3/clientgen (#244)
Browse files Browse the repository at this point in the history
Co-authored-by: API Engineering <api-engineering@digitalocean.com>
  • Loading branch information
digitalocean-engineering and API Engineering authored Oct 20, 2023
1 parent 8f96a32 commit 5e666a8
Show file tree
Hide file tree
Showing 4 changed files with 752 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DO_OPENAPI_COMMIT_SHA.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b0a1e19
352faf3
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ requests-oauthlib==1.3.1 ; python_full_version >= "3.7.2" and python_full_versio
requests==2.31.0 ; python_full_version >= "3.7.2" and python_full_version < "4.0.0"
six==1.16.0 ; python_full_version >= "3.7.2" and python_full_version < "4.0.0"
typing-extensions==4.4.0 ; python_full_version >= "3.7.2" and python_full_version < "4.0.0"
urllib3==1.26.17 ; python_full_version >= "3.7.2" and python_full_version < "4.0.0"
urllib3==1.26.18 ; python_full_version >= "3.7.2" and python_full_version < "4.0.0"
yarl==1.8.1 ; python_full_version >= "3.7.2" and python_full_version < "4.0.0"
327 changes: 327 additions & 0 deletions src/pydo/aio/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@
build_monitoring_create_alert_policy_request,
build_monitoring_delete_alert_policy_request,
build_monitoring_get_alert_policy_request,
build_monitoring_get_app_cpu_percentage_metrics_request,
build_monitoring_get_app_memory_percentage_metrics_request,
build_monitoring_get_app_restart_count_metrics_yml_request,
build_monitoring_get_droplet_bandwidth_metrics_request,
build_monitoring_get_droplet_cpu_metrics_request,
build_monitoring_get_droplet_filesystem_free_metrics_request,
Expand Down Expand Up @@ -105243,6 +105246,330 @@ async def get_droplet_memory_available_metrics(

return cast(JSON, deserialized)

@distributed_trace_async
async def get_app_memory_percentage_metrics(
self,
*,
app_id: str,
start: str,
end: str,
app_component: Optional[str] = None,
**kwargs: Any
) -> JSON:
"""Get App Memory Percentage Metrics.

To retrieve memory percentage metrics for a given app, send a GET request to
``/v2/monitoring/metrics/apps/memory_percentage``.

:keyword app_id: The app UUID. Required.
:paramtype app_id: str
:keyword start: Timestamp to start metric window. Required.
:paramtype start: str
:keyword end: Timestamp to end metric window. Required.
:paramtype end: str
:keyword app_component: The app component name. Default value is None.
:paramtype app_component: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# response body for status code(s): 200
response == {
"data": {
"result": [
{
"metric": {
"str": "str" # An object containing the
metric labels. Required.
},
"values": [
[
{}
]
]
}
],
"resultType": "str" # Required. "matrix"
},
"status": "str" # Required. Known values are: "success" and "error".
}
"""
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_monitoring_get_app_memory_percentage_metrics_request(
app_id=app_id,
start=start,
end=end,
app_component=app_component,
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]:
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 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_app_cpu_percentage_metrics(
self,
*,
app_id: str,
start: str,
end: str,
app_component: Optional[str] = None,
**kwargs: Any
) -> JSON:
"""Get App CPU Percentage Metrics.

To retrieve cpu percentage metrics for a given app, send a GET request to
``/v2/monitoring/metrics/apps/cpu_percentage``.

:keyword app_id: The app UUID. Required.
:paramtype app_id: str
:keyword start: Timestamp to start metric window. Required.
:paramtype start: str
:keyword end: Timestamp to end metric window. Required.
:paramtype end: str
:keyword app_component: The app component name. Default value is None.
:paramtype app_component: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# response body for status code(s): 200
response == {
"data": {
"result": [
{
"metric": {
"str": "str" # An object containing the
metric labels. Required.
},
"values": [
[
{}
]
]
}
],
"resultType": "str" # Required. "matrix"
},
"status": "str" # Required. Known values are: "success" and "error".
}
"""
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_monitoring_get_app_cpu_percentage_metrics_request(
app_id=app_id,
start=start,
end=end,
app_component=app_component,
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]:
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 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_app_restart_count_metrics_yml(
self,
*,
app_id: str,
start: str,
end: str,
app_component: Optional[str] = None,
**kwargs: Any
) -> JSON:
"""Get App Restart Count Metrics.

To retrieve restart count metrics for a given app, send a GET request to
``/v2/monitoring/metrics/apps/restart_count``.

:keyword app_id: The app UUID. Required.
:paramtype app_id: str
:keyword start: Timestamp to start metric window. Required.
:paramtype start: str
:keyword end: Timestamp to end metric window. Required.
:paramtype end: str
:keyword app_component: The app component name. Default value is None.
:paramtype app_component: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# response body for status code(s): 200
response == {
"data": {
"result": [
{
"metric": {
"str": "str" # An object containing the
metric labels. Required.
},
"values": [
[
{}
]
]
}
],
"resultType": "str" # Required. "matrix"
},
"status": "str" # Required. Known values are: "success" and "error".
}
"""
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_monitoring_get_app_restart_count_metrics_yml_request(
app_id=app_id,
start=start,
end=end,
app_component=app_component,
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]:
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 response.content:
deserialized = response.json()
else:
deserialized = None

if cls:
return cls(pipeline_response, cast(JSON, deserialized), response_headers)

return cast(JSON, deserialized)


class ProjectsOperations:
"""
Expand Down
Loading

0 comments on commit 5e666a8

Please sign in to comment.