Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bot] Update OpenAPI docs to include opensearch index crud changes: Re-Generated From digitalocean/openapi@47108d8 #321

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DO_OPENAPI_COMMIT_SHA.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12a6416
47108d8
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
aiohttp==3.9.5 ; python_version >= "3.8" and python_full_version < "4.0.0"
aiohappyeyeballs==2.3.5 ; python_version >= "3.8" and python_full_version < "4.0.0"
aiohttp==3.10.2 ; python_version >= "3.8" and python_full_version < "4.0.0"
aiosignal==1.3.1 ; python_version >= "3.8" and python_full_version < "4.0.0"
async-timeout==4.0.3 ; python_version >= "3.8" and python_version < "3.11"
attrs==23.2.0 ; python_version >= "3.8" and python_full_version < "4.0.0"
Expand Down
244 changes: 244 additions & 0 deletions src/pydo/aio/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
build_databases_delete_kafka_topic_request,
build_databases_delete_logsink_request,
build_databases_delete_online_migration_request,
build_databases_delete_opensearch_index_request,
build_databases_delete_request,
build_databases_delete_user_request,
build_databases_destroy_cluster_request,
Expand All @@ -112,6 +113,7 @@
build_databases_list_firewall_rules_request,
build_databases_list_kafka_topics_request,
build_databases_list_logsink_request,
build_databases_list_opeasearch_indexes_request,
build_databases_list_options_request,
build_databases_list_replicas_request,
build_databases_list_request,
Expand Down Expand Up @@ -102537,6 +102539,248 @@ async def update_cluster_metrics_credentials( # pylint: disable=inconsistent-re
if cls:
return cls(pipeline_response, None, response_headers) # type: ignore

@distributed_trace_async
async def list_opeasearch_indexes(
self, database_cluster_uuid: str, **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
"""List Indexes for a OpenSearch Cluster.

To list all of a OpenSearch cluster's indexes, send a GET request to
``/v2/databases/$DATABASE_ID/indexes``.

The result will be a JSON object with a ``indexes`` 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 == {
"indexes": [
{
"created_time": "2020-02-20 00:00:00", # Optional. The date
and time the index was created.
"health": "str", # Optional. The health of the OpenSearch
index. Known values are: "unknown", "green", "yellow", "red", and "red*".
"index_name": "str", # Optional. The name of the opensearch
index.
"number_of_replicas": 0, # Optional. The number of replicas
for the index.
"number_of_shards": 0, # Optional. The number of shards for
the index.
"size": 0, # Optional. The size of the index.
"status": "str" # Optional. The status of the OpenSearch
index. Known values are: "unknown", "open", "close", and "none".
}
]
}
# 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: MutableMapping[int, Type[HttpResponseError]] = {
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
401: cast(
Type[HttpResponseError],
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: ClsType[JSON] = kwargs.pop("cls", None)

_request = build_databases_list_opeasearch_indexes_request(
database_cluster_uuid=database_cluster_uuid,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

_stream = False
pipeline_response: PipelineResponse = (
await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
)

response = pipeline_response.http_response

if response.status_code not in [200, 404]:
if _stream:
await response.read() # Load the body in memory and close the socket
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
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) # type: ignore

return cast(JSON, deserialized) # type: ignore

@distributed_trace_async
async def delete_opensearch_index(
self, database_cluster_uuid: str, index_name: str, **kwargs: Any
) -> Optional[JSON]:
# pylint: disable=line-too-long
"""Delete Index for OpenSearch Cluster.

To delete a single index within OpenSearch cluster, send a DELETE request
to ``/v2/databases/$DATABASE_ID/indexes/$INDEX_NAME``.

A status of 204 will be given. This indicates that the request was
processed successfully, but that no response body is needed.

:param database_cluster_uuid: A unique identifier for a database cluster. Required.
:type database_cluster_uuid: str
:param index_name: The name of the OpenSearch index. Required.
:type index_name: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# 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: MutableMapping[int, Type[HttpResponseError]] = {
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
401: cast(
Type[HttpResponseError],
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: ClsType[Optional[JSON]] = kwargs.pop("cls", None)

_request = build_databases_delete_opensearch_index_request(
database_cluster_uuid=database_cluster_uuid,
index_name=index_name,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

_stream = False
pipeline_response: PipelineResponse = (
await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
)

response = pipeline_response.http_response

if response.status_code not in [204, 404]:
if _stream:
await response.read() # Load the body in memory and close the socket
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
raise HttpResponseError(response=response)

deserialized = None
response_headers = {}
if response.status_code == 204:
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.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, deserialized, response_headers) # type: ignore

return deserialized # type: ignore


class DomainsOperations:
"""
Expand Down
Loading
Loading