diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt
index 076b2b5..01324a8 100644
--- a/DO_OPENAPI_COMMIT_SHA.txt
+++ b/DO_OPENAPI_COMMIT_SHA.txt
@@ -1 +1 @@
-6fddf79
+21e0351
diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py
index 27daecb..c271534 100644
--- a/src/pydo/aio/operations/_operations.py
+++ b/src/pydo/aio/operations/_operations.py
@@ -104,6 +104,7 @@
build_databases_get_request,
build_databases_get_sql_mode_request,
build_databases_get_user_request,
+ build_databases_install_update_request,
build_databases_list_backups_request,
build_databases_list_clusters_request,
build_databases_list_connection_pools_request,
@@ -152,9 +153,11 @@
build_droplets_destroy_retry_with_associated_resources_request,
build_droplets_destroy_with_associated_resources_dangerous_request,
build_droplets_destroy_with_associated_resources_selective_request,
+ build_droplets_get_backup_policy_request,
build_droplets_get_destroy_associated_resources_status_request,
build_droplets_get_request,
build_droplets_list_associated_resources_request,
+ build_droplets_list_backup_policies_request,
build_droplets_list_backups_request,
build_droplets_list_firewalls_request,
build_droplets_list_kernels_request,
@@ -162,6 +165,7 @@
build_droplets_list_neighbors_request,
build_droplets_list_request,
build_droplets_list_snapshots_request,
+ build_droplets_list_supported_backup_policies_request,
build_firewalls_add_rules_request,
build_firewalls_add_tags_request,
build_firewalls_assign_droplets_request,
@@ -94239,6 +94243,112 @@ async def update_maintenance_window(
return deserialized # type: ignore
+ @distributed_trace_async
+ async def install_update(
+ self, database_cluster_uuid: str, **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Start Database Maintenance.
+
+ To start the installation of updates for a database cluster, send a PUT request to
+ ``/v2/databases/$DATABASE_ID/install_update``.
+ A successful request will receive a 204 No Content status code with no body in response.
+
+ :param database_cluster_uuid: A unique identifier for a database cluster. Required.
+ :type database_cluster_uuid: 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_install_update_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 [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
+
@distributed_trace_async
async def list_backups(self, database_cluster_uuid: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
@@ -107211,6 +107321,419 @@ async def list_backups(
return cast(JSON, deserialized) # type: ignore
+ @distributed_trace_async
+ async def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve the Backup Policy for an Existing Droplet.
+
+ To show information about an individual Droplet's backup policy, send a GET
+ request to ``/v2/droplets/$DROPLET_ID/backups/policy``.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "policy": {
+ "backup_enabled": bool, # Optional. A boolean value indicating
+ whether backups are enabled for the Droplet.
+ "backup_policy": {
+ "hour": 0, # Optional. The hour of the day that the backup
+ window will start. Known values are: 0, 4, 8, 12, 16, and 20.
+ "plan": "str", # Optional. The backup plan used for the
+ Droplet. The plan can be either ``daily`` or ``weekly``. Known values
+ are: "daily" and "weekly".
+ "retention_period_days": 0, # Optional. The number of days
+ the backup will be retained.
+ "weekday": "str", # Optional. The day of the week on which
+ the backup will occur. Known values are: "SUN", "MON", "TUE", "WED",
+ "THU", "FRI", and "SAT".
+ "window_length_hours": 0 # Optional. The length of the
+ backup window starting from ``hour``.
+ },
+ "droplet_id": 0, # Optional. The unique identifier for the Droplet.
+ "next_backup_window": {
+ "end": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format specifying the end of the
+ Droplet's backup window.
+ "start": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format specifying the start of
+ the Droplet's backup window.
+ }
+ }
+ }
+ # 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_droplets_get_backup_policy_request(
+ droplet_id=droplet_id,
+ 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 list_backup_policies(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Backup Policies for All Existing Droplets.
+
+ To list information about the backup policies for all Droplets in the account,
+ send a GET request to ``/v2/droplets/backups/policies``.
+
+ :keyword per_page: Number of items returned per page. Default value is 20.
+ :paramtype per_page: int
+ :keyword page: Which 'page' of paginated results to return. Default value is 1.
+ :paramtype page: int
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "policies": {
+ "str": {
+ "backup_enabled": bool, # Optional. A boolean value
+ indicating whether backups are enabled for the Droplet.
+ "backup_policy": {
+ "hour": 0, # Optional. The hour of the day that the
+ backup window will start. Known values are: 0, 4, 8, 12, 16, and 20.
+ "plan": "str", # Optional. The backup plan used for
+ the Droplet. The plan can be either ``daily`` or ``weekly``. Known
+ values are: "daily" and "weekly".
+ "retention_period_days": 0, # Optional. The number
+ of days the backup will be retained.
+ "weekday": "str", # Optional. The day of the week on
+ which the backup will occur. Known values are: "SUN", "MON", "TUE",
+ "WED", "THU", "FRI", and "SAT".
+ "window_length_hours": 0 # Optional. The length of
+ the backup window starting from ``hour``.
+ },
+ "droplet_id": 0, # Optional. The unique identifier for the
+ Droplet.
+ "next_backup_window": {
+ "end": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format specifying the
+ end of the Droplet's backup window.
+ "start": "2020-02-20 00:00:00" # Optional. A time
+ value given in ISO8601 combined date and time format specifying the
+ start of the Droplet's backup window.
+ }
+ }
+ }
+ }
+ # 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_droplets_list_backup_policies_request(
+ per_page=per_page,
+ page=page,
+ 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 list_supported_backup_policies(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List Supported Droplet Backup Policies.
+
+ To retrieve a list of all supported Droplet backup policies, send a GET
+ request to ``/v2/droplets/backups/supported_policies``.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "supported_policies": [
+ {
+ "name": "str", # Optional. The name of the Droplet backup
+ plan.
+ "possible_days": [
+ "str" # Optional. The day of the week the backup
+ will occur.
+ ],
+ "possible_window_starts": [
+ 0 # Optional. An array of integers representing the
+ hours of the day that a backup can start.
+ ],
+ "retention_period_days": 0, # Optional. The number of days
+ that a backup will be kept.
+ "window_length_hours": 0 # Optional. The number of hours
+ that a backup window is open.
+ }
+ ]
+ }
+ # 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_droplets_list_supported_backup_policies_request(
+ 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 list_snapshots(
self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
@@ -109287,6 +109810,8 @@ async def post(
- Enables backups for a Droplet
* - :code:``disable_backups``
- Disables backups for a Droplet
+ * - :code:``change_backup_policy``
+ - Update the backup policy for a Droplet
* - :code:``reboot``
- Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful
way, similar to using the ``reboot`` command from the console.
@@ -109425,6 +109950,8 @@ async def post(
- Enables backups for a Droplet
* - :code:``disable_backups``
- Disables backups for a Droplet
+ * - :code:``change_backup_policy``
+ - Update the backup policy for a Droplet
* - :code:``reboot``
- Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful
way, similar to using the ``reboot`` command from the console.
@@ -109558,6 +110085,8 @@ async def post(
- Enables backups for a Droplet
* - :code:``disable_backups``
- Disables backups for a Droplet
+ * - :code:``change_backup_policy``
+ - Update the backup policy for a Droplet
* - :code:``reboot``
- Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful
way, similar to using the ``reboot`` command from the console.
diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py
index c025081..8197261 100644
--- a/src/pydo/operations/_operations.py
+++ b/src/pydo/operations/_operations.py
@@ -1693,6 +1693,29 @@ def build_databases_update_maintenance_window_request( # pylint: disable=name-t
return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
+def build_databases_install_update_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}/install_update"
+ path_format_arguments = {
+ "database_cluster_uuid": _SERIALIZER.url(
+ "database_cluster_uuid", database_cluster_uuid, "str"
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
+
+
def build_databases_list_backups_request(
database_cluster_uuid: str, **kwargs: Any
) -> HttpRequest:
@@ -3159,6 +3182,70 @@ def build_droplets_list_backups_request(
)
+def build_droplets_get_backup_policy_request(
+ droplet_id: int, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/droplets/{droplet_id}/backups/policy"
+ path_format_arguments = {
+ "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_droplets_list_backup_policies_request( # pylint: disable=name-too-long
+ *, per_page: int = 20, page: int = 1, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/droplets/backups/policies"
+
+ # Construct parameters
+ if per_page is not None:
+ _params["per_page"] = _SERIALIZER.query(
+ "per_page", per_page, "int", maximum=200, minimum=1
+ )
+ if page is not None:
+ _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_droplets_list_supported_backup_policies_request( # pylint: disable=name-too-long
+ **kwargs: Any,
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/droplets/backups/supported_policies"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
def build_droplets_list_snapshots_request(
droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
) -> HttpRequest:
@@ -101971,6 +102058,112 @@ def update_maintenance_window(
return deserialized # type: ignore
+ @distributed_trace
+ def install_update(
+ self, database_cluster_uuid: str, **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Start Database Maintenance.
+
+ To start the installation of updates for a database cluster, send a PUT request to
+ ``/v2/databases/$DATABASE_ID/install_update``.
+ A successful request will receive a 204 No Content status code with no body in response.
+
+ :param database_cluster_uuid: A unique identifier for a database cluster. Required.
+ :type database_cluster_uuid: 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_install_update_request(
+ database_cluster_uuid=database_cluster_uuid,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ 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:
+ 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
+
@distributed_trace
def list_backups(self, database_cluster_uuid: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
@@ -114937,6 +115130,419 @@ def list_backups(
return cast(JSON, deserialized) # type: ignore
+ @distributed_trace
+ def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve the Backup Policy for an Existing Droplet.
+
+ To show information about an individual Droplet's backup policy, send a GET
+ request to ``/v2/droplets/$DROPLET_ID/backups/policy``.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "policy": {
+ "backup_enabled": bool, # Optional. A boolean value indicating
+ whether backups are enabled for the Droplet.
+ "backup_policy": {
+ "hour": 0, # Optional. The hour of the day that the backup
+ window will start. Known values are: 0, 4, 8, 12, 16, and 20.
+ "plan": "str", # Optional. The backup plan used for the
+ Droplet. The plan can be either ``daily`` or ``weekly``. Known values
+ are: "daily" and "weekly".
+ "retention_period_days": 0, # Optional. The number of days
+ the backup will be retained.
+ "weekday": "str", # Optional. The day of the week on which
+ the backup will occur. Known values are: "SUN", "MON", "TUE", "WED",
+ "THU", "FRI", and "SAT".
+ "window_length_hours": 0 # Optional. The length of the
+ backup window starting from ``hour``.
+ },
+ "droplet_id": 0, # Optional. The unique identifier for the Droplet.
+ "next_backup_window": {
+ "end": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format specifying the end of the
+ Droplet's backup window.
+ "start": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format specifying the start of
+ the Droplet's backup window.
+ }
+ }
+ }
+ # 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_droplets_get_backup_policy_request(
+ droplet_id=droplet_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ 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:
+ 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
+ def list_backup_policies(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Backup Policies for All Existing Droplets.
+
+ To list information about the backup policies for all Droplets in the account,
+ send a GET request to ``/v2/droplets/backups/policies``.
+
+ :keyword per_page: Number of items returned per page. Default value is 20.
+ :paramtype per_page: int
+ :keyword page: Which 'page' of paginated results to return. Default value is 1.
+ :paramtype page: int
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "policies": {
+ "str": {
+ "backup_enabled": bool, # Optional. A boolean value
+ indicating whether backups are enabled for the Droplet.
+ "backup_policy": {
+ "hour": 0, # Optional. The hour of the day that the
+ backup window will start. Known values are: 0, 4, 8, 12, 16, and 20.
+ "plan": "str", # Optional. The backup plan used for
+ the Droplet. The plan can be either ``daily`` or ``weekly``. Known
+ values are: "daily" and "weekly".
+ "retention_period_days": 0, # Optional. The number
+ of days the backup will be retained.
+ "weekday": "str", # Optional. The day of the week on
+ which the backup will occur. Known values are: "SUN", "MON", "TUE",
+ "WED", "THU", "FRI", and "SAT".
+ "window_length_hours": 0 # Optional. The length of
+ the backup window starting from ``hour``.
+ },
+ "droplet_id": 0, # Optional. The unique identifier for the
+ Droplet.
+ "next_backup_window": {
+ "end": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format specifying the
+ end of the Droplet's backup window.
+ "start": "2020-02-20 00:00:00" # Optional. A time
+ value given in ISO8601 combined date and time format specifying the
+ start of the Droplet's backup window.
+ }
+ }
+ }
+ }
+ # 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_droplets_list_backup_policies_request(
+ per_page=per_page,
+ page=page,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ 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:
+ 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
+ def list_supported_backup_policies(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List Supported Droplet Backup Policies.
+
+ To retrieve a list of all supported Droplet backup policies, send a GET
+ request to ``/v2/droplets/backups/supported_policies``.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "supported_policies": [
+ {
+ "name": "str", # Optional. The name of the Droplet backup
+ plan.
+ "possible_days": [
+ "str" # Optional. The day of the week the backup
+ will occur.
+ ],
+ "possible_window_starts": [
+ 0 # Optional. An array of integers representing the
+ hours of the day that a backup can start.
+ ],
+ "retention_period_days": 0, # Optional. The number of days
+ that a backup will be kept.
+ "window_length_hours": 0 # Optional. The number of hours
+ that a backup window is open.
+ }
+ ]
+ }
+ # 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_droplets_list_supported_backup_policies_request(
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ 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:
+ 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
def list_snapshots(
self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
@@ -117013,6 +117619,8 @@ def post(
- Enables backups for a Droplet
* - :code:``disable_backups``
- Disables backups for a Droplet
+ * - :code:``change_backup_policy``
+ - Update the backup policy for a Droplet
* - :code:``reboot``
- Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful
way, similar to using the ``reboot`` command from the console.
@@ -117151,6 +117759,8 @@ def post(
- Enables backups for a Droplet
* - :code:``disable_backups``
- Disables backups for a Droplet
+ * - :code:``change_backup_policy``
+ - Update the backup policy for a Droplet
* - :code:``reboot``
- Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful
way, similar to using the ``reboot`` command from the console.
@@ -117284,6 +117894,8 @@ def post(
- Enables backups for a Droplet
* - :code:``disable_backups``
- Disables backups for a Droplet
+ * - :code:``change_backup_policy``
+ - Update the backup policy for a Droplet
* - :code:``reboot``
- Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful
way, similar to using the ``reboot`` command from the console.