diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt
index 3e045b5c..5af407c3 100644
--- a/DO_OPENAPI_COMMIT_SHA.txt
+++ b/DO_OPENAPI_COMMIT_SHA.txt
@@ -1 +1 @@
-cf0a60a
+8ae887b
diff --git a/src/pydo/_client.py b/src/pydo/_client.py
index 0fe21400..fc082659 100644
--- a/src/pydo/_client.py
+++ b/src/pydo/_client.py
@@ -26,6 +26,7 @@
CdnOperations,
CertificatesOperations,
DatabasesOperations,
+ DedicatedInferencesOperations,
DomainsOperations,
DropletActionsOperations,
DropletsOperations,
@@ -49,6 +50,7 @@
ReservedIPsOperations,
ReservedIPv6ActionsOperations,
ReservedIPv6Operations,
+ SecurityOperations,
SizesOperations,
SnapshotsOperations,
SpacesKeyOperations,
@@ -597,6 +599,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype billing_insights: pydo.operations.BillingInsightsOperations
:ivar databases: DatabasesOperations operations
:vartype databases: pydo.operations.DatabasesOperations
+ :ivar dedicated_inferences: DedicatedInferencesOperations operations
+ :vartype dedicated_inferences: pydo.operations.DedicatedInferencesOperations
:ivar domains: DomainsOperations operations
:vartype domains: pydo.operations.DomainsOperations
:ivar droplets: DropletsOperations operations
@@ -641,6 +645,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype reserved_ipv6_actions: pydo.operations.ReservedIPv6ActionsOperations
:ivar byoip_prefixes: ByoipPrefixesOperations operations
:vartype byoip_prefixes: pydo.operations.ByoipPrefixesOperations
+ :ivar security: SecurityOperations operations
+ :vartype security: pydo.operations.SecurityOperations
:ivar sizes: SizesOperations operations
:vartype sizes: pydo.operations.SizesOperations
:ivar snapshots: SnapshotsOperations operations
@@ -746,6 +752,9 @@ def __init__(
self.databases = DatabasesOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.dedicated_inferences = DedicatedInferencesOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.domains = DomainsOperations(
self._client, self._config, self._serialize, self._deserialize
)
@@ -812,6 +821,9 @@ def __init__(
self.byoip_prefixes = ByoipPrefixesOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.security = SecurityOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.sizes = SizesOperations(
self._client, self._config, self._serialize, self._deserialize
)
diff --git a/src/pydo/aio/_client.py b/src/pydo/aio/_client.py
index 69354835..64b5a51b 100644
--- a/src/pydo/aio/_client.py
+++ b/src/pydo/aio/_client.py
@@ -26,6 +26,7 @@
CdnOperations,
CertificatesOperations,
DatabasesOperations,
+ DedicatedInferencesOperations,
DomainsOperations,
DropletActionsOperations,
DropletsOperations,
@@ -49,6 +50,7 @@
ReservedIPsOperations,
ReservedIPv6ActionsOperations,
ReservedIPv6Operations,
+ SecurityOperations,
SizesOperations,
SnapshotsOperations,
SpacesKeyOperations,
@@ -597,6 +599,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype billing_insights: pydo.aio.operations.BillingInsightsOperations
:ivar databases: DatabasesOperations operations
:vartype databases: pydo.aio.operations.DatabasesOperations
+ :ivar dedicated_inferences: DedicatedInferencesOperations operations
+ :vartype dedicated_inferences: pydo.aio.operations.DedicatedInferencesOperations
:ivar domains: DomainsOperations operations
:vartype domains: pydo.aio.operations.DomainsOperations
:ivar droplets: DropletsOperations operations
@@ -641,6 +645,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype reserved_ipv6_actions: pydo.aio.operations.ReservedIPv6ActionsOperations
:ivar byoip_prefixes: ByoipPrefixesOperations operations
:vartype byoip_prefixes: pydo.aio.operations.ByoipPrefixesOperations
+ :ivar security: SecurityOperations operations
+ :vartype security: pydo.aio.operations.SecurityOperations
:ivar sizes: SizesOperations operations
:vartype sizes: pydo.aio.operations.SizesOperations
:ivar snapshots: SnapshotsOperations operations
@@ -746,6 +752,9 @@ def __init__(
self.databases = DatabasesOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.dedicated_inferences = DedicatedInferencesOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.domains = DomainsOperations(
self._client, self._config, self._serialize, self._deserialize
)
@@ -812,6 +821,9 @@ def __init__(
self.byoip_prefixes = ByoipPrefixesOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.security = SecurityOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.sizes = SizesOperations(
self._client, self._config, self._serialize, self._deserialize
)
diff --git a/src/pydo/aio/operations/__init__.py b/src/pydo/aio/operations/__init__.py
index 4a74b7ce..7f1635b6 100644
--- a/src/pydo/aio/operations/__init__.py
+++ b/src/pydo/aio/operations/__init__.py
@@ -17,6 +17,7 @@
from ._operations import InvoicesOperations
from ._operations import BillingInsightsOperations
from ._operations import DatabasesOperations
+from ._operations import DedicatedInferencesOperations
from ._operations import DomainsOperations
from ._operations import DropletsOperations
from ._operations import DropletActionsOperations
@@ -39,6 +40,7 @@
from ._operations import ReservedIPv6Operations
from ._operations import ReservedIPv6ActionsOperations
from ._operations import ByoipPrefixesOperations
+from ._operations import SecurityOperations
from ._operations import SizesOperations
from ._operations import SnapshotsOperations
from ._operations import SpacesKeyOperations
@@ -70,6 +72,7 @@
"InvoicesOperations",
"BillingInsightsOperations",
"DatabasesOperations",
+ "DedicatedInferencesOperations",
"DomainsOperations",
"DropletsOperations",
"DropletActionsOperations",
@@ -92,6 +95,7 @@
"ReservedIPv6Operations",
"ReservedIPv6ActionsOperations",
"ByoipPrefixesOperations",
+ "SecurityOperations",
"SizesOperations",
"SnapshotsOperations",
"SpacesKeyOperations",
diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py
index e68d3123..57dd571d 100644
--- a/src/pydo/aio/operations/_operations.py
+++ b/src/pydo/aio/operations/_operations.py
@@ -177,6 +177,19 @@
build_databases_update_region_request,
build_databases_update_sql_mode_request,
build_databases_update_user_request,
+ build_dedicated_inferences_create_request,
+ build_dedicated_inferences_create_tokens_request,
+ build_dedicated_inferences_delete_request,
+ build_dedicated_inferences_delete_tokens_request,
+ build_dedicated_inferences_get_accelerator_request,
+ build_dedicated_inferences_get_ca_request,
+ build_dedicated_inferences_get_gpu_model_config_request,
+ build_dedicated_inferences_get_request,
+ build_dedicated_inferences_list_accelerators_request,
+ build_dedicated_inferences_list_request,
+ build_dedicated_inferences_list_sizes_request,
+ build_dedicated_inferences_list_tokens_request,
+ build_dedicated_inferences_patch_request,
build_domains_create_record_request,
build_domains_create_request,
build_domains_delete_record_request,
@@ -522,6 +535,16 @@
build_reserved_ipv6_delete_request,
build_reserved_ipv6_get_request,
build_reserved_ipv6_list_request,
+ build_security_create_scan_request,
+ build_security_create_scan_rule_request,
+ build_security_create_suppression_request,
+ build_security_delete_suppression_request,
+ build_security_get_latest_scan_request,
+ build_security_get_scan_request,
+ build_security_list_scan_finding_affected_resources_request,
+ build_security_list_scans_request,
+ build_security_list_settings_request,
+ build_security_update_settings_plan_request,
build_sizes_list_request,
build_snapshots_delete_request,
build_snapshots_get_request,
@@ -121819,14 +121842,14 @@ async def delete_opensearch_index(
return deserialized # type: ignore
-class DomainsOperations:
+class DedicatedInferencesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~pydo.aio.GeneratedClient`'s
- :attr:`domains` attribute.
+ :attr:`dedicated_inferences` attribute.
"""
def __init__(self, *args, **kwargs) -> None:
@@ -121839,17 +121862,17 @@ def __init__(self, *args, **kwargs) -> None:
)
@distributed_trace_async
- async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ async def get(self, dedicated_inference_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Domains.
+ """Get a Dedicated Inference.
- To retrieve a list of all of the domains in your account, send a GET request to
- ``/v2/domains``.
+ Retrieve an existing Dedicated Inference by ID. Send a GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}``. The status in the response
+ is one of active, new, provisioning, updating, deleting, or error.
- :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
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -121859,33 +121882,121 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
# response body for status code(s): 200
response == {
- "domains": [
- {
- "ip_address": "str", # Optional. This optional attribute may
- contain an IP address. When provided, an A record will be automatically
- created pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself.
- This should follow the standard domain format of domain.TLD. For
- instance, ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the
- records on this domain, in seconds. This defines the time frame that
- clients can cache queried information before a refresh should be
- requested.
- "zone_file": "str" # Optional. This attribute contains the
- complete contents of the zone file for the selected domain. Individual
- domain record resources should be used to get more granular control over
- records. However, this attribute can also be used to get information
- about the SOA record, which is created automatically and is not
- accessible as an individual record resource.
- }
- ],
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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,
@@ -121905,9 +122016,8 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_domains_list_request(
- per_page=per_page,
- page=page,
+ _request = build_dedicated_inferences_get_request(
+ dedicated_inference_id=dedicated_inference_id,
headers=_headers,
params=_params,
)
@@ -121922,27 +122032,44 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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
@@ -121950,22 +122077,25 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
return cast(JSON, deserialized) # type: ignore
@overload
- async def create(
+ async def patch(
self,
- body: Optional[JSON] = None,
+ dedicated_inference_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain.
+ """Update a Dedicated Inference.
- To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
- attribute to the domain name you are adding. Optionally, you may set the
- "ip_address" attribute, and an A record will be automatically created pointing
- to the apex domain.
+ Update an existing Dedicated Inference. Send a PATCH request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}`` with updated ``spec`` and/or
+ ``access_tokens``. Status will move to updating and return to active when done.
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@@ -121979,61 +122109,189 @@ async def create(
# JSON input template you can fill out and use as your body input.
body = {
- "ip_address": "str", # Optional. This optional attribute may contain an IP
- address. When provided, an A record will be automatically created pointing to the
- apex domain.
- "name": "str", # Optional. The name of the domain itself. This should follow
- the standard domain format of domain.TLD. For instance, ``example.com`` is a
- valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records on this
- domain, in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete contents
- of the zone file for the selected domain. Individual domain record resources
- should be used to get more granular control over records. However, this attribute
- can also be used to get information about the SOA record, which is created
- automatically and is not accessible as an individual record resource.
+ "access_tokens": {
+ "hugging_face_token": "str" # Optional. Hugging Face token required
+ for gated models.
+ },
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ }
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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.
+ }
"""
@overload
- async def create(
+ async def patch(
self,
- body: Optional[IO[bytes]] = None,
+ dedicated_inference_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain.
+ """Update a Dedicated Inference.
- To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
- attribute to the domain name you are adding. Optionally, you may set the
- "ip_address" attribute, and an A record will be automatically created pointing
- to the apex domain.
+ Update an existing Dedicated Inference. Send a PATCH request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}`` with updated ``spec`` and/or
+ ``access_tokens``. Status will move to updating and return to active when done.
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -122045,41 +122303,140 @@ async def create(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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.
+ }
"""
@distributed_trace_async
- async def create(
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ async def patch(
+ self, dedicated_inference_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain.
+ """Update a Dedicated Inference.
- To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
- attribute to the domain name you are adding. Optionally, you may set the
- "ip_address" attribute, and an A record will be automatically created pointing
- to the apex domain.
+ Update an existing Dedicated Inference. Send a PATCH request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}`` with updated ``spec`` and/or
+ ``access_tokens``. Status will move to updating and return to active when done.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -122090,42 +122447,167 @@ async def create(
# JSON input template you can fill out and use as your body input.
body = {
- "ip_address": "str", # Optional. This optional attribute may contain an IP
- address. When provided, an A record will be automatically created pointing to the
- apex domain.
- "name": "str", # Optional. The name of the domain itself. This should follow
- the standard domain format of domain.TLD. For instance, ``example.com`` is a
- valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records on this
- domain, in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete contents
- of the zone file for the selected domain. Individual domain record resources
- should be used to get more granular control over records. However, this attribute
- can also be used to get information about the SOA record, which is created
- automatically and is not accessible as an individual record resource.
+ "access_tokens": {
+ "hugging_face_token": "str" # Optional. Hugging Face token required
+ for gated models.
+ },
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ }
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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,
@@ -122154,12 +122636,10 @@ async def create(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_domains_create_request(
+ _request = build_dedicated_inferences_patch_request(
+ dedicated_inference_id=dedicated_inference_id,
content_type=content_type,
json=_json,
content=_content,
@@ -122177,123 +122657,14 @@ async def create(
response = pipeline_response.http_response
- if response.status_code not in [201]:
- 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 = {}
- 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 get(self, domain_name: str, **kwargs: Any) -> JSON:
- # pylint: disable=line-too-long
- """Retrieve an Existing Domain.
-
- To get details about a specific domain, send a GET request to ``/v2/domains/$DOMAIN_NAME``.
-
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :return: JSON object
- :rtype: JSON
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # response body for status code(s): 200
- response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
- }
- }
- # 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_domains_get_request(
- domain_name=domain_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 [200, 404]:
+ if response.status_code not in [202, 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:
+ if response.status_code == 202:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -122331,14 +122702,19 @@ async def get(self, domain_name: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
+ async def delete(
+ self, dedicated_inference_id: str, **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Delete a Domain.
+ """Delete a Dedicated Inference.
- To delete a domain, send a DELETE request to ``/v2/domains/$DOMAIN_NAME``.
+ Delete an existing Dedicated Inference. Send a DELETE request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}``. The response 202 Accepted
+ indicates the request was accepted for processing.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -122376,8 +122752,8 @@ async def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_domains_delete_request(
- domain_name=domain_name,
+ _request = build_dedicated_inferences_delete_request(
+ dedicated_inference_id=dedicated_inference_id,
headers=_headers,
params=_params,
)
@@ -122392,7 +122768,7 @@ async def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [202, 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
@@ -122400,7 +122776,7 @@ async def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
deserialized = None
response_headers = {}
- if response.status_code == 204:
+ if response.status_code == 202:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -122433,41 +122809,28 @@ async def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
return deserialized # type: ignore
@distributed_trace_async
- async def list_records(
+ async def list(
self,
- domain_name: str,
*,
- name: Optional[str] = None,
- type: Optional[str] = None,
per_page: int = 20,
page: int = 1,
+ region: Optional[str] = None,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List All Domain Records.
+ """List Dedicated Inferences.
- To get a listing of all records configured for a domain, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records``.
- The list of records returned can be filtered by using the ``name`` and ``type`` query
- parameters. For example, to only include A records for a domain, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records?type=A``. ``name`` must be a fully qualified record name.
- For example, to only include records matching ``sub.example.com``\\ , send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Both name and type may be used
- together.
+ List all Dedicated Inference instances for your team. Send a GET request to
+ ``/v2/dedicated-inferences``. You may filter by region and use page and per_page
+ for pagination.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :keyword name: A fully qualified record name. For example, to only include records matching
- sub.example.com, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Default value is None.
- :paramtype name: str
- :keyword type: The type of the DNS record. For example: A, CNAME, TXT, ... Known values are:
- "A", "AAAA", "CAA", "CNAME", "MX", "NS", "SOA", "SRV", and "TXT". Default value is None.
- :paramtype type: str
: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
+ :keyword region: Filter by region. Dedicated Inference is only available in nyc2, tor1, and
+ atl1. Known values are: "nyc2", "tor1", and "atl1". Default value is None.
+ :paramtype region: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -122477,50 +122840,123 @@ async def list_records(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "domain_records": [
+ "dedicated_inferences": [
{
- "type": "str", # The type of the DNS record. For example: A,
- CNAME, TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record
- type. For example, the "data" value for an A record would be the IPv4
- address to which the domain will be mapped. For a CAA record, it would
- contain the domain name of the CA being granted permission to issue
- certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255
- used for CAA records.
- "id": 0, # Optional. A unique identifier for each domain
- record.
- "name": "str", # Optional. The host name, alias, or service
- being defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX
- records.
- "tag": "str", # Optional. The parameter tag for CAA records.
- Valid values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the
- record, in seconds. This defines the time frame that clients can cache
- queried information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the
+ Dedicated Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private
+ VPC FQDN of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public
+ FQDN of the Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated
+ Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ Pending deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether
+ to expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug":
+ "str", # DigitalOcean GPU slug. Required.
+ "scale": 0, # Number
+ of accelerator instances. Required.
+ "type": "str", #
+ Accelerator type (e.g. prefill_decode). Required.
+ "status": "str" #
+ Optional. Current state of the Accelerator. Known
+ values are: "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used
+ to identify an existing deployment when updating; empty means
+ create new.
+ "model_provider": "str", # Optional.
+ Model provider. "hugging_face"
+ "model_slug": "str", # Optional.
+ Model identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated
+ Inference. Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional.
+ Pending deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the
+ Dedicated Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose
+ a public LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug":
+ "str", # DigitalOcean GPU slug. Required.
+ "scale": 0, # Number
+ of accelerator instances. Required.
+ "type": "str", #
+ Accelerator type (e.g. prefill_decode). Required.
+ "status": "str" #
+ Optional. Current state of the Accelerator. Known
+ values are: "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used
+ to identify an existing deployment when updating; empty means
+ create new.
+ "model_provider": "str", # Optional.
+ Model provider. "hugging_face"
+ "model_slug": "str", # Optional.
+ Model identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference.
+ Must be unique within the team. Required.
+ "region": "str", # DigitalOcean region where the
+ Dedicated Inference is hosted. Required. Known values are: "atl1",
+ "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the
+ Dedicated Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated
+ Inference.
}
],
"links": {
- "pages": {}
+ "pages": {
+ "str": "str" # Optional. Pagination links (first, prev,
+ next, last).
+ }
+ },
+ "meta": {
+ "total": 0 # Total number of results. Required.
}
}
- # 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,
@@ -122540,12 +122976,10 @@ async def list_records(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_domains_list_records_request(
- domain_name=domain_name,
- name=name,
- type=type,
+ _request = build_dedicated_inferences_list_request(
per_page=per_page,
page=page,
+ region=region,
headers=_headers,
params=_params,
)
@@ -122560,44 +122994,27 @@ async def list_records(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [200]:
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")
- )
+ 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
if cls:
return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
@@ -122605,29 +123022,20 @@ async def list_records(
return cast(JSON, deserialized) # type: ignore
@overload
- async def create_record(
- self,
- domain_name: str,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
+ async def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain Record.
-
- To create a new record to a domain, send a POST request to
- ``/v2/domains/$DOMAIN_NAME/records``.
-
- The request must include all of the required fields for the domain record type
- being added.
+ """Create a Dedicated Inference.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective required attributes.
+ Create a new Dedicated Inference for your team. Send a POST request to
+ ``/v2/dedicated-inferences`` with a ``spec`` object (version, name, region, vpc,
+ enable_public_endpoint, model_deployments) and optional ``access_tokens`` (e.g.
+ hugging_face_token for gated models). The response code 202 Accepted indicates
+ the request was accepted for processing; it does not indicate success or failure.
+ The token value is returned only on create; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param body: Default value is None.
+ :param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@@ -122640,69 +123048,182 @@ async def create_record(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 201
- response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ body = {
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ },
+ "access_tokens": {
+ "str": "str" # Optional. Key-value pairs for provider tokens (e.g.
+ Hugging Face).
}
}
- # response body for status code(s): 404
+
+ # response body for status code(s): 202
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.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
+ },
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
+ }
}
"""
@overload
- async def create_record(
- self,
- domain_name: str,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
+ async def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain Record.
-
- To create a new record to a domain, send a POST request to
- ``/v2/domains/$DOMAIN_NAME/records``.
-
- The request must include all of the required fields for the domain record type
- being added.
+ """Create a Dedicated Inference.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective required attributes.
+ Create a new Dedicated Inference for your team. Send a POST request to
+ ``/v2/dedicated-inferences`` with a ``spec`` object (version, name, region, vpc,
+ enable_public_endpoint, model_deployments) and optional ``access_tokens`` (e.g.
+ hugging_face_token for gated models). The response code 202 Accepted indicates
+ the request was accepted for processing; it does not indicate success or failure.
+ The token value is returned only on create; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param body: Default value is None.
+ :param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -122714,65 +123235,135 @@ async def create_record(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
+ },
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
}
}
- # 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.
- }
"""
@distributed_trace_async
- async def create_record(
- self,
- domain_name: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any
- ) -> JSON:
+ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain Record.
-
- To create a new record to a domain, send a POST request to
- ``/v2/domains/$DOMAIN_NAME/records``.
-
- The request must include all of the required fields for the domain record type
- being added.
+ """Create a Dedicated Inference.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective required attributes.
+ Create a new Dedicated Inference for your team. Send a POST request to
+ ``/v2/dedicated-inferences`` with a ``spec`` object (version, name, region, vpc,
+ enable_public_endpoint, model_deployments) and optional ``access_tokens`` (e.g.
+ hugging_face_token for gated models). The response code 202 Accepted indicates
+ the request was accepted for processing; it does not indicate success or failure.
+ The token value is returned only on create; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -122782,42 +123373,164 @@ async def create_record(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 201
- response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ body = {
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ },
+ "access_tokens": {
+ "str": "str" # Optional. Key-value pairs for provider tokens (e.g.
+ Hugging Face).
}
}
- # response body for status code(s): 404
+
+ # response body for status code(s): 202
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.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
+ },
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
+ }
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -122847,13 +123560,9 @@ async def create_record(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_domains_create_record_request(
- domain_name=domain_name,
+ _request = build_dedicated_inferences_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -122871,14 +123580,143 @@ async def create_record(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ if response.status_code not in [202]:
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 == 201:
+ 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_accelerators(
+ self,
+ dedicated_inference_id: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ slug: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Dedicated Inference Accelerators.
+
+ List all accelerators (GPUs) in use by a Dedicated Inference instance. Send a
+ GET request to ``/v2/dedicated-inferences/{dedicated_inference_id}/accelerators``.
+ Optionally filter by slug and use page/per_page for pagination.
+
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :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
+ :keyword slug: Filter accelerators by GPU slug. Default value is None.
+ :paramtype slug: str
+ :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.
+ },
+ "accelerators": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ "id": "str", # Optional. Unique ID of the accelerator.
+ "name": "str", # Optional. Name of the accelerator.
+ "role": "str", # Optional. Role of the accelerator (e.g.
+ prefill_decode).
+ "slug": "str", # Optional. DigitalOcean GPU slug.
+ "status": "str" # Optional. Status of the accelerator.
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
+ }
+ # 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_dedicated_inferences_list_accelerators_request(
+ dedicated_inference_id=dedicated_inference_id,
+ per_page=per_page,
+ page=page,
+ slug=slug,
+ 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")
)
@@ -122916,19 +123754,21 @@ async def create_record(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get_record(
- self, domain_name: str, domain_record_id: int, **kwargs: Any
+ async def get_accelerator(
+ self, dedicated_inference_id: str, accelerator_id: str, **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Domain Record.
+ """Get a Dedicated Inference Accelerator.
- To retrieve a specific domain record, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records/$RECORD_ID``.
+ Retrieve a single accelerator by ID for a Dedicated Inference instance. Send a
+ GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}/accelerators/{accelerator_id}``.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param accelerator_id: A unique identifier for a Dedicated Inference accelerator. Required.
+ :type accelerator_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -122938,27 +123778,12 @@ async def get_record(
# response body for status code(s): 200
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ "id": "str", # Optional. Unique ID of the accelerator.
+ "name": "str", # Optional. Name of the accelerator.
+ "role": "str", # Optional. Role of the accelerator (e.g. prefill_decode).
+ "slug": "str", # Optional. DigitalOcean GPU slug.
+ "status": "str" # Optional. Status of the accelerator.
}
# response body for status code(s): 404
response == {
@@ -122990,9 +123815,9 @@ async def get_record(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_domains_get_record_request(
- domain_name=domain_name,
- domain_record_id=domain_record_id,
+ _request = build_dedicated_inferences_get_accelerator_request(
+ dedicated_inference_id=dedicated_inference_id,
+ accelerator_id=accelerator_id,
headers=_headers,
params=_params,
)
@@ -123051,35 +123876,18 @@ async def get_record(
return cast(JSON, deserialized) # type: ignore
- @overload
- async def patch_record(
- self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> JSON:
+ @distributed_trace_async
+ async def get_ca(self, dedicated_inference_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PATCH request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Get Dedicated Inference CA Certificate.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Get the CA certificate for a Dedicated Inference instance (base64-encoded).
+ Required for private endpoint connectivity. Send a GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}/ca``.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :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
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -123087,52 +123895,9 @@ async def patch_record(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
- Required.
- "data": "str", # Optional. Variable data depending on record type. For
- example, the "data" value for an A record would be the IPv4 address to which the
- domain will be mapped. For a CAA record, it would contain the domain name of the
- CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
- records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being defined by
- the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid values
- are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record, in
- seconds. This defines the time frame that clients can cache queried information
- before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
-
# response body for status code(s): 200
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
+ "cert": "str" # Base64-encoded CA certificate. Required.
}
# response body for status code(s): 404
response == {
@@ -123146,104 +123911,107 @@ async def patch_record(
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 {})
- @overload
- async def patch_record(
- self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Update a Domain Record.
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
- To update an existing record, send a PATCH request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ _request = build_dedicated_inferences_get_ca_request(
+ dedicated_inference_id=dedicated_inference_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
- :return: JSON object
- :rtype: JSON
- :raises ~azure.core.exceptions.HttpResponseError:
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
- Example:
- .. code-block:: python
+ response = pipeline_response.http_response
- # response body for status code(s): 200
- response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
- }
- # 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.
- }
- """
+ 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 patch_record(
+ async def list_tokens(
self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[Union[JSON, IO[bytes]]] = None,
+ dedicated_inference_id: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PATCH request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """List Dedicated Inference Tokens.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ List all access tokens for a Dedicated Inference instance. Token values are
+ not returned; only id, name, and created_at. Send a GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens``.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :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:
@@ -123251,52 +124019,23 @@ async def patch_record(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
- Required.
- "data": "str", # Optional. Variable data depending on record type. For
- example, the "data" value for an A record would be the IPv4 address to which the
- domain will be mapped. For a CAA record, it would contain the domain name of the
- CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
- records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being defined by
- the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid values
- are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record, in
- seconds. This defines the time frame that clients can cache queried information
- before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
-
# response body for status code(s): 200
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "tokens": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once
+ on create. Store securely.
+ }
+ ]
}
# response body for status code(s): 404
response == {
@@ -123323,31 +124062,15 @@ async def patch_record(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- content_type: Optional[str] = kwargs.pop(
- "content_type", _headers.pop("Content-Type", None)
- )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- content_type = content_type or "application/json"
- _json = None
- _content = None
- if isinstance(body, (IOBase, bytes)):
- _content = body
- else:
- if body is not None:
- _json = body
- else:
- _json = None
-
- _request = build_domains_patch_record_request(
- domain_name=domain_name,
- domain_record_id=domain_record_id,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_dedicated_inferences_list_tokens_request(
+ dedicated_inference_id=dedicated_inference_id,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -123407,30 +124130,25 @@ async def patch_record(
return cast(JSON, deserialized) # type: ignore
@overload
- async def update_record(
+ async def create_tokens(
self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[JSON] = None,
+ dedicated_inference_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PUT request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Create a Dedicated Inference Token.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Create a new access token for a Dedicated Inference instance. Send a POST
+ request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens`` with a
+ ``name``. The token value is returned only once in the response; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@@ -123444,49 +124162,18 @@ async def update_record(
# JSON input template you can fill out and use as your body input.
body = {
- "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
- Required.
- "data": "str", # Optional. Variable data depending on record type. For
- example, the "data" value for an A record would be the IPv4 address to which the
- domain will be mapped. For a CAA record, it would contain the domain name of the
- CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
- records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being defined by
- the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid values
- are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record, in
- seconds. This defines the time frame that clients can cache queried information
- before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "name": "str" # Name for the new token. Required.
}
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
}
}
# response body for status code(s): 404
@@ -123503,30 +124190,25 @@ async def update_record(
"""
@overload
- async def update_record(
+ async def create_tokens(
self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[IO[bytes]] = None,
+ dedicated_inference_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PUT request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Create a Dedicated Inference Token.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Create a new access token for a Dedicated Inference instance. Send a POST
+ request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens`` with a
+ ``name``. The token value is returned only once in the response; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -123538,28 +124220,15 @@ async def update_record(
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
}
}
# response body for status code(s): 404
@@ -123576,28 +124245,20 @@ async def update_record(
"""
@distributed_trace_async
- async def update_record(
- self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any
+ async def create_tokens(
+ self, dedicated_inference_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PUT request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Create a Dedicated Inference Token.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Create a new access token for a Dedicated Inference instance. Send a POST
+ request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens`` with a
+ ``name``. The token value is returned only once in the response; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -123608,49 +124269,18 @@ async def update_record(
# JSON input template you can fill out and use as your body input.
body = {
- "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
- Required.
- "data": "str", # Optional. Variable data depending on record type. For
- example, the "data" value for an A record would be the IPv4 address to which the
- domain will be mapped. For a CAA record, it would contain the domain name of the
- CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
- records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being defined by
- the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid values
- are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record, in
- seconds. This defines the time frame that clients can cache queried information
- before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "name": "str" # Name for the new token. Required.
}
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
}
}
# response body for status code(s): 404
@@ -123692,14 +124322,10 @@ async def update_record(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_domains_update_record_request(
- domain_name=domain_name,
- domain_record_id=domain_record_id,
+ _request = build_dedicated_inferences_create_tokens_request(
+ dedicated_inference_id=dedicated_inference_id,
content_type=content_type,
json=_json,
content=_content,
@@ -123717,14 +124343,14 @@ async def update_record(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [202, 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:
+ if response.status_code == 202:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -123762,22 +124388,20 @@ async def update_record(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def delete_record(
- self, domain_name: str, domain_record_id: int, **kwargs: Any
+ async def delete_tokens(
+ self, dedicated_inference_id: str, token_id: str, **kwargs: Any
) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Delete a Domain Record.
-
- To delete a record for a domain, send a DELETE request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``.
+ """Revoke a Dedicated Inference Token.
- The record will be deleted and the response status will be a 204. This
- indicates a successful request with no body returned.
+ Revoke (delete) an access token for a Dedicated Inference instance. Send a
+ DELETE request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens/{token_id}``.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param token_id: A unique identifier for a Dedicated Inference access token. Required.
+ :type token_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -123815,9 +124439,9 @@ async def delete_record(
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_domains_delete_record_request(
- domain_name=domain_name,
- domain_record_id=domain_record_id,
+ _request = build_dedicated_inferences_delete_tokens_request(
+ dedicated_inference_id=dedicated_inference_id,
+ token_id=token_id,
headers=_headers,
params=_params,
)
@@ -123872,74 +124496,13 @@ async def delete_record(
return deserialized # type: ignore
-
-class DropletsOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.aio.GeneratedClient`'s
- :attr:`droplets` attribute.
- """
-
- def __init__(self, *args, **kwargs) -> None:
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
-
@distributed_trace_async
- async def list(
- self,
- *,
- per_page: int = 20,
- page: int = 1,
- tag_name: Optional[str] = None,
- name: Optional[str] = None,
- type: Optional[str] = None,
- **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """List All Droplets.
-
- To list all Droplets in your account, send a GET request to ``/v2/droplets``.
-
- The response body will be a JSON object with a key of ``droplets``. This will be
- set to an array containing objects each representing a Droplet. These will
- contain the standard Droplet attributes.
-
- Filtering Results by Tag
- ^^^^^^^^^^^^^^^^^^^^^^^^
+ async def list_sizes(self, **kwargs: Any) -> JSON:
+ """List Dedicated Inference Sizes.
- It's possible to request filtered results by including certain query parameters.
- To only list Droplets assigned to a specific tag, include the ``tag_name`` query
- parameter set to the name of the tag in your GET request. For example,
- ``/v2/droplets?tag_name=$TAG_NAME``.
-
- GPU Droplets
- ^^^^^^^^^^^^
-
- By default, only non-GPU Droplets are returned. To list only GPU Droplets, set
- the ``type`` query parameter to ``gpus``. For example, ``/v2/droplets?type=gpus``.
+ Get available Dedicated Inference sizes and pricing for supported GPUs. Send a
+ GET request to ``/v2/dedicated-inferences/sizes``.
- :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
- :keyword tag_name: Used to filter Droplets by a specific tag. Can not be combined with ``name``
- or ``type``.:code:`
`Requires ``tag:read`` scope. Default value is None.
- :paramtype tag_name: str
- :keyword name: Used to filter list response by Droplet name returning only exact matches. It is
- case-insensitive and can not be combined with ``tag_name``. Default value is None.
- :paramtype name: str
- :keyword type: When ``type`` is set to ``gpus``\\ , only GPU Droplets will be returned. By
- default, only non-GPU Droplets are returned. Can not be combined with ``tag_name``. Known
- values are: "droplets" and "gpus". Default value is None.
- :paramtype type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -123949,273 +124512,17 @@ async def list(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "droplets": [
+ "enabled_regions": [
+ "str" # Optional. Regions where Dedicated Inference is available.
+ ],
+ "sizes": [
{
- "backup_ids": [
- 0 # An array of backup IDs of any backups that have
- been taken of the Droplet instance. Droplet backups are enabled at
- the time of the instance creation.:code:`
`Requires ``image:read``
- scope. Required.
- ],
- "created_at": "2020-02-20 00:00:00", # A time value given in
- ISO8601 combined date and time format that represents when the Droplet
- was created. Required.
- "disk": 0, # The size of the Droplet's disk in gigabytes.
- Required.
- "features": [
- "str" # An array of features enabled on this
- Droplet. Required.
- ],
- "id": 0, # A unique identifier for each Droplet instance.
- This is automatically generated upon Droplet creation. Required.
- "image": {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the image was created.
- "description": "str", # Optional. An optional
- free-form text field to describe an image.
- "distribution": "str", # Optional. The name of a
- custom image's distribution. Currently, the valid values are ``Arch
- Linux``"" , ``CentOS``"" , ``CoreOS``"" , ``Debian``"" , ``Fedora``""
- , ``Fedora Atomic``"" , ``FreeBSD``"" , ``Gentoo``"" ,
- ``openSUSE``"" , ``RancherOS``"" , ``Rocky Linux``"" , ``Ubuntu``"" ,
- and ``Unknown``. Any other value will be accepted but ignored, and
- ``Unknown`` will be used in its place. Known values are: "Arch
- Linux", "CentOS", "CoreOS", "Debian", "Fedora", "Fedora Atomic",
- "FreeBSD", "Gentoo", "openSUSE", "RancherOS", "Rocky Linux",
- "Ubuntu", and "Unknown".
- "error_message": "str", # Optional. A string
- containing information about errors that may occur when importing a
- custom image.
- "id": 0, # Optional. A unique number that can be
- used to identify and reference a specific image.
- "min_disk_size": 0, # Optional. The minimum disk
- size in GB required for a Droplet to use this image.
- "name": "str", # Optional. The display name that has
- been given to an image. This is what is shown in the control panel
- and is generally a descriptive title for the image in question.
- "public": bool, # Optional. This is a boolean value
- that indicates whether the image in question is public or not. An
- image that is public is available to all accounts. A non-public image
- is only accessible from your account.
- "regions": [
- "str" # Optional. This attribute is an array
- of the regions that the image is available in. The regions are
- represented by their identifying slug values.
- ],
- "size_gigabytes": 0.0, # Optional. The size of the
- image in gigabytes.
- "slug": "str", # Optional. A uniquely identifying
- string that is associated with each of the DigitalOcean-provided
- public images. These can be used to reference a public image as an
- alternative to the numeric id.
- "status": "str", # Optional. A status string
- indicating the state of a custom image. This may be ``NEW``"" ,
- ``available``"" , ``pending``"" , ``deleted``"" , or ``retired``.
- Known values are: "NEW", "available", "pending", "deleted", and
- "retired".
- "tags": [
- "str" # Optional. A flat array of tag names
- as strings to be applied to the resource. Tag names may be for
- either existing or new tags. :code:`
`:code:`
`Requires
- ``tag:create`` scope.
- ],
- "type": "str" # Optional. Describes the kind of
- image. It may be one of ``base``"" , ``snapshot``"" , ``backup``"" ,
- ``custom``"" , or ``admin``. Respectively, this specifies whether an
- image is a DigitalOcean base OS image, user-generated Droplet
- snapshot, automatically created Droplet backup, user-provided virtual
- machine image, or an image used for DigitalOcean managed resources
- (e.g. DOKS worker nodes). Known values are: "base", "snapshot",
- "backup", "custom", and "admin".
- },
- "locked": bool, # A boolean value indicating whether the
- Droplet has been locked, preventing actions by users. Required.
- "memory": 0, # Memory of the Droplet in megabytes. Required.
- "name": "str", # The human-readable name set for the Droplet
- instance. Required.
- "networks": {
- "v4": [
- {
- "gateway": "str", # Optional. The
- gateway of the specified IPv4 network interface. For private
- interfaces, a gateway is not provided. This is denoted by
- returning ``nil`` as its value.
- "ip_address": "str", # Optional. The
- IP address of the IPv4 network interface.
- "netmask": "str", # Optional. The
- netmask of the IPv4 network interface.
- "type": "str" # Optional. The type
- of the IPv4 network interface. Known values are: "public" and
- "private".
- }
- ],
- "v6": [
- {
- "gateway": "str", # Optional. The
- gateway of the specified IPv6 network interface.
- "ip_address": "str", # Optional. The
- IP address of the IPv6 network interface.
- "netmask": 0, # Optional. The
- netmask of the IPv6 network interface.
- "type": "str" # Optional. The type
- of the IPv6 network interface. **Note**"" : IPv6 private
- networking is not currently supported. "public"
- }
- ]
- },
- "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.
- },
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
- Required.
- "features": [
- "str" # This attribute is set to an array
- which contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region.
- This will be a full name that is used in the control panel and other
- interfaces. Required.
- "sizes": [
- "str" # This attribute is set to an array
- which contains the identifying slugs for the sizes available in
- this region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used
- as a unique identifier for each region. Required.
- },
- "size": {
- "available": True, # Default value is True. This is
- a boolean value that represents whether new Droplets can be created
- with this size.
- "description": "str", # A string describing the
- class of Droplets created from this size. For example: Basic, General
- Purpose, CPU-Optimized, Memory-Optimized, or Storage-Optimized.
- Required.
- "disk": 0, # The amount of disk space set aside for
- Droplets of this size. The value is represented in gigabytes.
- Required.
- "memory": 0, # The amount of RAM allocated to
- Droplets created of this size. The value is represented in megabytes.
- Required.
- "price_hourly": 0.0, # This describes the price of
- the Droplet size as measured hourly. The value is measured in US
- dollars. Required.
- "price_monthly": 0.0, # This attribute describes the
- monthly cost of this Droplet size if the Droplet is kept for an
- entire month. The value is measured in US dollars. Required.
- "regions": [
- "str" # An array containing the region slugs
- where this size is available for Droplet creates. Required.
- ],
- "slug": "str", # A human-readable string that is
- used to uniquely identify each size. Required.
- "transfer": 0.0, # The amount of transfer bandwidth
- that is available for Droplets created in this size. This only counts
- traffic on the public interface. The value is given in terabytes.
- Required.
- "vcpus": 0, # The number of CPUs allocated to
- Droplets of this size. Required.
- "disk_info": [
- {
- "size": {
- "amount": 0, # Optional. The
- amount of space allocated to the disk.
- "unit": "str" # Optional.
- The unit of measure for the disk size.
- },
- "type": "str" # Optional. The type
- of disk. All Droplets contain a ``local`` disk. Additionally,
- GPU Droplets can also have a ``scratch`` disk for
- non-persistent data. Known values are: "local" and "scratch".
- }
- ],
- "gpu_info": {
- "count": 0, # Optional. The number of GPUs
- allocated to the Droplet.
- "model": "str", # Optional. The model of the
- GPU.
- "vram": {
- "amount": 0, # Optional. The amount
- of VRAM allocated to the GPU.
- "unit": "str" # Optional. The unit
- of measure for the VRAM.
- }
- }
- },
- "size_slug": "str", # The unique slug identifier for the
- size of this Droplet. Required.
- "snapshot_ids": [
- 0 # An array of snapshot IDs of any snapshots
- created from the Droplet instance.:code:`
`Requires ``image:read``
- scope. Required.
- ],
- "status": "str", # A status string indicating the state of
- the Droplet instance. This may be "new", "active", "off", or "archive".
- Required. Known values are: "new", "active", "off", and "archive".
- "tags": [
- "str" # An array of Tags the Droplet has been tagged
- with.:code:`
`Requires ``tag:read`` scope. Required.
- ],
- "vcpus": 0, # The number of virtual CPUs. Required.
- "volume_ids": [
- "str" # A flat array including the unique identifier
- for each Block Storage volume attached to the
- Droplet.:code:`
`Requires ``block_storage:read`` scope. Required.
- ],
- "disk_info": [
- {
- "size": {
- "amount": 0, # Optional. The amount
- of space allocated to the disk.
- "unit": "str" # Optional. The unit
- of measure for the disk size.
- },
- "type": "str" # Optional. The type of disk.
- All Droplets contain a ``local`` disk. Additionally, GPU Droplets
- can also have a ``scratch`` disk for non-persistent data. Known
- values are: "local" and "scratch".
- }
- ],
- "gpu_info": {
- "count": 0, # Optional. The number of GPUs allocated
- to the Droplet.
- "model": "str", # Optional. The model of the GPU.
- "vram": {
- "amount": 0, # Optional. The amount of VRAM
- allocated to the GPU.
- "unit": "str" # Optional. The unit of
- measure for the VRAM.
- }
- },
- "kernel": {
- "id": 0, # Optional. A unique number used to
- identify and reference a specific kernel.
- "name": "str", # Optional. The display name of the
- kernel. This is shown in the web UI and is generally a descriptive
- title for the kernel in question.
- "version": "str" # Optional. A standard kernel
- version string representing the version, patch, and release
- information.
- },
- "vpc_uuid": "str" # Optional. A string specifying the UUID
- of the VPC to which the Droplet is assigned.:code:`
`Requires
- ``vpc:read`` scope.
+ "currency": "str", # Optional.
+ "gpu_slug": "str", # Optional.
+ "price_per_hour": "str", # Optional.
+ "region": "str" # Optional.
}
- ],
- "links": {
- "pages": {}
- }
+ ]
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -124236,12 +124543,7 @@ class of Droplets created from this size. For example: Basic, General
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_list_request(
- per_page=per_page,
- page=page,
- tag_name=tag_name,
- name=name,
- type=type,
+ _request = build_dedicated_inferences_list_sizes_request(
headers=_headers,
params=_params,
)
@@ -124283,141 +124585,14 @@ class of Droplets created from this size. For example: Basic, General
return cast(JSON, deserialized) # type: ignore
- @overload
- async def create(
- self,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> JSON:
- """Create a New Droplet.
-
- To create a new Droplet, send a POST request to ``/v2/droplets`` setting the
- required attributes.
-
- A Droplet will be created using the provided information. The response body
- will contain a JSON object with a key called ``droplet``. The value will be an
- object containing the standard attributes for your new Droplet. The response
- code, 202 Accepted, does not indicate the success or failure of the operation,
- just that the request has been accepted for processing. The ``actions`` returned
- as part of the response's ``links`` object can be used to check the status
- of the Droplet create event.
-
- Create Multiple Droplets
- ^^^^^^^^^^^^^^^^^^^^^^^^
-
- Creating multiple Droplets is very similar to creating a single Droplet.
- Instead of sending ``name`` as a string, send ``names`` as an array of strings. A
- Droplet will be created for each name you send using the associated
- information. Up to ten Droplets may be created this way at a time.
-
- Rather than returning a single Droplet, the response body will contain a JSON
- array with a key called ``droplets``. This will be set to an array of JSON
- objects, each of which will contain the standard Droplet attributes. The
- response code, 202 Accepted, does not indicate the success or failure of any
- operation, just that the request has been accepted for processing. The array
- of ``actions`` returned as part of the response's ``links`` object can be used to
- check the status of each individual Droplet create event.
-
- :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: JSON object
- :rtype: JSON
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {}
- """
-
- @overload
- async def create(
- self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> JSON:
- """Create a New Droplet.
-
- To create a new Droplet, send a POST request to ``/v2/droplets`` setting the
- required attributes.
-
- A Droplet will be created using the provided information. The response body
- will contain a JSON object with a key called ``droplet``. The value will be an
- object containing the standard attributes for your new Droplet. The response
- code, 202 Accepted, does not indicate the success or failure of the operation,
- just that the request has been accepted for processing. The ``actions`` returned
- as part of the response's ``links`` object can be used to check the status
- of the Droplet create event.
-
- Create Multiple Droplets
- ^^^^^^^^^^^^^^^^^^^^^^^^
-
- Creating multiple Droplets is very similar to creating a single Droplet.
- Instead of sending ``name`` as a string, send ``names`` as an array of strings. A
- Droplet will be created for each name you send using the associated
- information. Up to ten Droplets may be created this way at a time.
-
- Rather than returning a single Droplet, the response body will contain a JSON
- array with a key called ``droplets``. This will be set to an array of JSON
- objects, each of which will contain the standard Droplet attributes. The
- response code, 202 Accepted, does not indicate the success or failure of any
- operation, just that the request has been accepted for processing. The array
- of ``actions`` returned as part of the response's ``links`` object can be used to
- check the status of each individual Droplet create event.
-
- :param body: Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
- :return: JSON object
- :rtype: JSON
- :raises ~azure.core.exceptions.HttpResponseError:
- """
-
@distributed_trace_async
- async def create(
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> JSON:
- """Create a New Droplet.
-
- To create a new Droplet, send a POST request to ``/v2/droplets`` setting the
- required attributes.
-
- A Droplet will be created using the provided information. The response body
- will contain a JSON object with a key called ``droplet``. The value will be an
- object containing the standard attributes for your new Droplet. The response
- code, 202 Accepted, does not indicate the success or failure of the operation,
- just that the request has been accepted for processing. The ``actions`` returned
- as part of the response's ``links`` object can be used to check the status
- of the Droplet create event.
-
- Create Multiple Droplets
- ^^^^^^^^^^^^^^^^^^^^^^^^
+ async def get_gpu_model_config(self, **kwargs: Any) -> JSON:
+ """Get Dedicated Inference GPU Model Config.
- Creating multiple Droplets is very similar to creating a single Droplet.
- Instead of sending ``name`` as a string, send ``names`` as an array of strings. A
- Droplet will be created for each name you send using the associated
- information. Up to ten Droplets may be created this way at a time.
-
- Rather than returning a single Droplet, the response body will contain a JSON
- array with a key called ``droplets``. This will be set to an array of JSON
- objects, each of which will contain the standard Droplet attributes. The
- response code, 202 Accepted, does not indicate the success or failure of any
- operation, just that the request has been accepted for processing. The array
- of ``actions`` returned as part of the response's ``links`` object can be used to
- check the status of each individual Droplet create event.
+ Get supported GPU and model configurations for Dedicated Inference. Use this to
+ discover supported GPU slugs and model slugs (e.g. Hugging Face). Send a GET
+ request to ``/v2/dedicated-inferences/gpu-model-config``.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -124425,8 +124600,20 @@ async def create(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
+ # response body for status code(s): 200
+ response == {
+ "gpu_model_configs": [
+ {
+ "gpu_slugs": [
+ "str" # Optional.
+ ],
+ "is_gated_model": bool, # Optional. Whether the model
+ requires gated access (e.g. Hugging Face token).
+ "model_name": "str", # Optional.
+ "model_slug": "str" # Optional.
+ }
+ ]
+ }
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
404: ResourceNotFoundError,
@@ -124441,29 +124628,12 @@ async def create(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- content_type: Optional[str] = kwargs.pop(
- "content_type", _headers.pop("Content-Type", None)
- )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- content_type = content_type or "application/json"
- _json = None
- _content = None
- if isinstance(body, (IOBase, bytes)):
- _content = body
- else:
- if body is not None:
- _json = body
- else:
- _json = None
-
- _request = build_droplets_create_request(
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_dedicated_inferences_get_gpu_model_config_request(
headers=_headers,
params=_params,
)
@@ -124478,7 +124648,7 @@ async def create(
response = pipeline_response.http_response
- if response.status_code not in [202]:
+ if response.status_code not in [200]:
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
@@ -124505,39 +124675,73 @@ async def create(
return cast(JSON, deserialized) # type: ignore
- @distributed_trace_async
- async def destroy_by_tag(self, *, tag_name: str, **kwargs: Any) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Deleting Droplets by Tag.
- To delete **all** Droplets assigned to a specific tag, include the ``tag_name``
- query parameter set to the name of the tag in your DELETE request. For
- example, ``/v2/droplets?tag_name=$TAG_NAME``.
+class DomainsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
- This endpoint requires ``tag:read`` scope.
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`domains` attribute.
+ """
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
- :keyword tag_name: Specifies Droplets to be deleted by tag. Required.
- :paramtype tag_name: str
- :return: JSON object or None
- :rtype: JSON or None
+ @distributed_trace_async
+ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Domains.
+
+ To retrieve a list of all of the domains in your account, send a GET request to
+ ``/v2/domains``.
+
+ :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): 404
+ # response body for status code(s): 200
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.
+ "domains": [
+ {
+ "ip_address": "str", # Optional. This optional attribute may
+ contain an IP address. When provided, an A record will be automatically
+ created pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself.
+ This should follow the standard domain format of domain.TLD. For
+ instance, ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the
+ records on this domain, in seconds. This defines the time frame that
+ clients can cache queried information before a refresh should be
+ requested.
+ "zone_file": "str" # Optional. This attribute contains the
+ complete contents of the zone file for the selected domain. Individual
+ domain record resources should be used to get more granular control over
+ records. However, this attribute can also be used to get information
+ about the SOA record, which is created automatically and is not
+ accessible as an individual record resource.
+ }
+ ],
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ }
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -124556,10 +124760,11 @@ async def destroy_by_tag(self, *, tag_name: str, **kwargs: Any) -> Optional[JSON
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_destroy_by_tag_request(
- tag_name=tag_name,
+ _request = build_domains_list_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -124574,59 +124779,297 @@ async def destroy_by_tag(self, *, tag_name: str, **kwargs: Any) -> Optional[JSON
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [200]:
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")
- )
- response_headers["content-type"] = self._deserialize(
- "str", response.headers.get("content-type")
- )
+ 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 response.content:
- deserialized = response.json()
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ async def create(
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain.
+
+ To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
+ attribute to the domain name you are adding. Optionally, you may set the
+ "ip_address" attribute, and an A record will be automatically created pointing
+ to the apex domain.
+
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "ip_address": "str", # Optional. This optional attribute may contain an IP
+ address. When provided, an A record will be automatically created pointing to the
+ apex domain.
+ "name": "str", # Optional. The name of the domain itself. This should follow
+ the standard domain format of domain.TLD. For instance, ``example.com`` is a
+ valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records on this
+ domain, in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete contents
+ of the zone file for the selected domain. Individual domain record resources
+ should be used to get more granular control over records. However, this attribute
+ can also be used to get information about the SOA record, which is created
+ automatically and is not accessible as an individual record resource.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
+ }
+ }
+ """
+
+ @overload
+ async def create(
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain.
+
+ To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
+ attribute to the domain name you are adding. Optionally, you may set the
+ "ip_address" attribute, and an A record will be automatically created pointing
+ to the apex domain.
+
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
+ }
+ }
+ """
+
+ @distributed_trace_async
+ async def create(
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain.
+
+ To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
+ attribute to the domain name you are adding. Optionally, you may set the
+ "ip_address" attribute, and an A record will be automatically created pointing
+ to the apex domain.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "ip_address": "str", # Optional. This optional attribute may contain an IP
+ address. When provided, an A record will be automatically created pointing to the
+ apex domain.
+ "name": "str", # Optional. The name of the domain itself. This should follow
+ the standard domain format of domain.TLD. For instance, ``example.com`` is a
+ valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records on this
+ domain, in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete contents
+ of the zone file for the selected domain. Individual domain record resources
+ should be used to get more granular control over records. However, this attribute
+ can also be used to get information about the SOA record, which is created
+ automatically and is not accessible as an individual record resource.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
+ }
+ }
+ """
+ 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
else:
- deserialized = None
+ _json = None
+
+ _request = build_domains_create_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [201]:
+ 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 = {}
+ 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 cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get(self, droplet_id: int, **kwargs: Any) -> JSON:
+ async def get(self, domain_name: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Droplet.
+ """Retrieve an Existing Domain.
- To show information about an individual Droplet, send a GET request to
- ``/v2/droplets/$DROPLET_ID``.
+ To get details about a specific domain, send a GET request to ``/v2/domains/$DOMAIN_NAME``.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -124636,250 +125079,22 @@ async def get(self, droplet_id: int, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "droplet": {
- "backup_ids": [
- 0 # An array of backup IDs of any backups that have been
- taken of the Droplet instance. Droplet backups are enabled at the time
- of the instance creation.:code:`
`Requires ``image:read`` scope.
- Required.
- ],
- "created_at": "2020-02-20 00:00:00", # A time value given in ISO8601
- combined date and time format that represents when the Droplet was created.
- Required.
- "disk": 0, # The size of the Droplet's disk in gigabytes. Required.
- "features": [
- "str" # An array of features enabled on this Droplet.
- Required.
- ],
- "id": 0, # A unique identifier for each Droplet instance. This is
- automatically generated upon Droplet creation. Required.
- "image": {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the image was created.
- "description": "str", # Optional. An optional free-form text
- field to describe an image.
- "distribution": "str", # Optional. The name of a custom
- image's distribution. Currently, the valid values are ``Arch Linux``"" ,
- ``CentOS``"" , ``CoreOS``"" , ``Debian``"" , ``Fedora``"" , ``Fedora
- Atomic``"" , ``FreeBSD``"" , ``Gentoo``"" , ``openSUSE``"" ,
- ``RancherOS``"" , ``Rocky Linux``"" , ``Ubuntu``"" , and ``Unknown``.
- Any other value will be accepted but ignored, and ``Unknown`` will be
- used in its place. Known values are: "Arch Linux", "CentOS", "CoreOS",
- "Debian", "Fedora", "Fedora Atomic", "FreeBSD", "Gentoo", "openSUSE",
- "RancherOS", "Rocky Linux", "Ubuntu", and "Unknown".
- "error_message": "str", # Optional. A string containing
- information about errors that may occur when importing a custom image.
- "id": 0, # Optional. A unique number that can be used to
- identify and reference a specific image.
- "min_disk_size": 0, # Optional. The minimum disk size in GB
- required for a Droplet to use this image.
- "name": "str", # Optional. The display name that has been
- given to an image. This is what is shown in the control panel and is
- generally a descriptive title for the image in question.
- "public": bool, # Optional. This is a boolean value that
- indicates whether the image in question is public or not. An image that
- is public is available to all accounts. A non-public image is only
- accessible from your account.
- "regions": [
- "str" # Optional. This attribute is an array of the
- regions that the image is available in. The regions are represented
- by their identifying slug values.
- ],
- "size_gigabytes": 0.0, # Optional. The size of the image in
- gigabytes.
- "slug": "str", # Optional. A uniquely identifying string
- that is associated with each of the DigitalOcean-provided public images.
- These can be used to reference a public image as an alternative to the
- numeric id.
- "status": "str", # Optional. A status string indicating the
- state of a custom image. This may be ``NEW``"" , ``available``"" ,
- ``pending``"" , ``deleted``"" , or ``retired``. Known values are: "NEW",
- "available", "pending", "deleted", and "retired".
- "tags": [
- "str" # Optional. A flat array of tag names as
- strings to be applied to the resource. Tag names may be for either
- existing or new tags. :code:`
`:code:`
`Requires ``tag:create``
- scope.
- ],
- "type": "str" # Optional. Describes the kind of image. It
- may be one of ``base``"" , ``snapshot``"" , ``backup``"" , ``custom``"" ,
- or ``admin``. Respectively, this specifies whether an image is a
- DigitalOcean base OS image, user-generated Droplet snapshot,
- automatically created Droplet backup, user-provided virtual machine
- image, or an image used for DigitalOcean managed resources (e.g. DOKS
- worker nodes). Known values are: "base", "snapshot", "backup", "custom",
- and "admin".
- },
- "locked": bool, # A boolean value indicating whether the Droplet has
- been locked, preventing actions by users. Required.
- "memory": 0, # Memory of the Droplet in megabytes. Required.
- "name": "str", # The human-readable name set for the Droplet
- instance. Required.
- "networks": {
- "v4": [
- {
- "gateway": "str", # Optional. The gateway of
- the specified IPv4 network interface. For private interfaces, a
- gateway is not provided. This is denoted by returning ``nil`` as
- its value.
- "ip_address": "str", # Optional. The IP
- address of the IPv4 network interface.
- "netmask": "str", # Optional. The netmask of
- the IPv4 network interface.
- "type": "str" # Optional. The type of the
- IPv4 network interface. Known values are: "public" and "private".
- }
- ],
- "v6": [
- {
- "gateway": "str", # Optional. The gateway of
- the specified IPv6 network interface.
- "ip_address": "str", # Optional. The IP
- address of the IPv6 network interface.
- "netmask": 0, # Optional. The netmask of the
- IPv6 network interface.
- "type": "str" # Optional. The type of the
- IPv6 network interface. **Note**"" : IPv6 private networking is
- not currently supported. "public"
- }
- ]
- },
- "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.
- },
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "size": {
- "available": True, # Default value is True. This is a
- boolean value that represents whether new Droplets can be created with
- this size.
- "description": "str", # A string describing the class of
- Droplets created from this size. For example: Basic, General Purpose,
- CPU-Optimized, Memory-Optimized, or Storage-Optimized. Required.
- "disk": 0, # The amount of disk space set aside for Droplets
- of this size. The value is represented in gigabytes. Required.
- "memory": 0, # The amount of RAM allocated to Droplets
- created of this size. The value is represented in megabytes. Required.
- "price_hourly": 0.0, # This describes the price of the
- Droplet size as measured hourly. The value is measured in US dollars.
- Required.
- "price_monthly": 0.0, # This attribute describes the monthly
- cost of this Droplet size if the Droplet is kept for an entire month. The
- value is measured in US dollars. Required.
- "regions": [
- "str" # An array containing the region slugs where
- this size is available for Droplet creates. Required.
- ],
- "slug": "str", # A human-readable string that is used to
- uniquely identify each size. Required.
- "transfer": 0.0, # The amount of transfer bandwidth that is
- available for Droplets created in this size. This only counts traffic on
- the public interface. The value is given in terabytes. Required.
- "vcpus": 0, # The number of CPUs allocated to Droplets of
- this size. Required.
- "disk_info": [
- {
- "size": {
- "amount": 0, # Optional. The amount
- of space allocated to the disk.
- "unit": "str" # Optional. The unit
- of measure for the disk size.
- },
- "type": "str" # Optional. The type of disk.
- All Droplets contain a ``local`` disk. Additionally, GPU Droplets
- can also have a ``scratch`` disk for non-persistent data. Known
- values are: "local" and "scratch".
- }
- ],
- "gpu_info": {
- "count": 0, # Optional. The number of GPUs allocated
- to the Droplet.
- "model": "str", # Optional. The model of the GPU.
- "vram": {
- "amount": 0, # Optional. The amount of VRAM
- allocated to the GPU.
- "unit": "str" # Optional. The unit of
- measure for the VRAM.
- }
- }
- },
- "size_slug": "str", # The unique slug identifier for the size of
- this Droplet. Required.
- "snapshot_ids": [
- 0 # An array of snapshot IDs of any snapshots created from
- the Droplet instance.:code:`
`Requires ``image:read`` scope. Required.
- ],
- "status": "str", # A status string indicating the state of the
- Droplet instance. This may be "new", "active", "off", or "archive". Required.
- Known values are: "new", "active", "off", and "archive".
- "tags": [
- "str" # An array of Tags the Droplet has been tagged
- with.:code:`
`Requires ``tag:read`` scope. Required.
- ],
- "vcpus": 0, # The number of virtual CPUs. Required.
- "volume_ids": [
- "str" # A flat array including the unique identifier for
- each Block Storage volume attached to the Droplet.:code:`
`Requires
- ``block_storage:read`` scope. Required.
- ],
- "disk_info": [
- {
- "size": {
- "amount": 0, # Optional. The amount of space
- allocated to the disk.
- "unit": "str" # Optional. The unit of
- measure for the disk size.
- },
- "type": "str" # Optional. The type of disk. All
- Droplets contain a ``local`` disk. Additionally, GPU Droplets can
- also have a ``scratch`` disk for non-persistent data. Known values
- are: "local" and "scratch".
- }
- ],
- "gpu_info": {
- "count": 0, # Optional. The number of GPUs allocated to the
- Droplet.
- "model": "str", # Optional. The model of the GPU.
- "vram": {
- "amount": 0, # Optional. The amount of VRAM
- allocated to the GPU.
- "unit": "str" # Optional. The unit of measure for
- the VRAM.
- }
- },
- "kernel": {
- "id": 0, # Optional. A unique number used to identify and
- reference a specific kernel.
- "name": "str", # Optional. The display name of the kernel.
- This is shown in the web UI and is generally a descriptive title for the
- kernel in question.
- "version": "str" # Optional. A standard kernel version
- string representing the version, patch, and release information.
- },
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the Droplet is assigned.:code:`
`Requires ``vpc:read`` scope.
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
}
}
# response body for status code(s): 404
@@ -124912,8 +125127,8 @@ async def get(self, droplet_id: int, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_get_request(
- droplet_id=droplet_id,
+ _request = build_domains_get_request(
+ domain_name=domain_name,
headers=_headers,
params=_params,
)
@@ -124973,17 +125188,14 @@ async def get(self, droplet_id: int, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def destroy(self, droplet_id: int, **kwargs: Any) -> Optional[JSON]:
+ async def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Delete an Existing Droplet.
-
- To delete a Droplet, send a DELETE request to ``/v2/droplets/$DROPLET_ID``.
+ """Delete a Domain.
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ To delete a domain, send a DELETE request to ``/v2/domains/$DOMAIN_NAME``.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -125021,8 +125233,8 @@ async def destroy(self, droplet_id: int, **kwargs: Any) -> Optional[JSON]:
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_droplets_destroy_request(
- droplet_id=droplet_id,
+ _request = build_domains_delete_request(
+ domain_name=domain_name,
headers=_headers,
params=_params,
)
@@ -125055,9 +125267,6 @@ async def destroy(self, droplet_id: int, **kwargs: Any) -> Optional[JSON]:
response_headers["ratelimit-reset"] = self._deserialize(
"int", response.headers.get("ratelimit-reset")
)
- response_headers["content-type"] = self._deserialize(
- "str", response.headers.get("content-type")
- )
if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
@@ -125081,21 +125290,37 @@ async def destroy(self, droplet_id: int, **kwargs: Any) -> Optional[JSON]:
return deserialized # type: ignore
@distributed_trace_async
- async def list_backups(
- self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ async def list_records(
+ self,
+ domain_name: str,
+ *,
+ name: Optional[str] = None,
+ type: Optional[str] = None,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List Backups for a Droplet.
-
- To retrieve any backups associated with a Droplet, send a GET request to
- ``/v2/droplets/$DROPLET_ID/backups``.
+ """List All Domain Records.
- You will get back a JSON object that has a ``backups`` key. This will be set to
- an array of backup objects, each of which contain the standard
- Droplet backup attributes.
+ To get a listing of all records configured for a domain, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
+ The list of records returned can be filtered by using the ``name`` and ``type`` query
+ parameters. For example, to only include A records for a domain, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records?type=A``. ``name`` must be a fully qualified record name.
+ For example, to only include records matching ``sub.example.com``\\ , send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Both name and type may be used
+ together.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :keyword name: A fully qualified record name. For example, to only include records matching
+ sub.example.com, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Default value is None.
+ :paramtype name: str
+ :keyword type: The type of the DNS record. For example: A, CNAME, TXT, ... Known values are:
+ "A", "AAAA", "CAA", "CNAME", "MX", "NS", "SOA", "SRV", and "TXT". Default value is None.
+ :paramtype type: str
: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.
@@ -125112,26 +125337,30 @@ async def list_backups(
"meta": {
"total": 0 # Optional. Number of objects returned by the request.
},
- "backups": [
+ "domain_records": [
{
- "created_at": "2020-02-20 00:00:00", # A time value given in
- ISO8601 combined date and time format that represents when the snapshot
- was created. Required.
- "min_disk_size": 0, # The minimum size in GB required for a
- volume or Droplet to use this snapshot. Required.
- "name": "str", # A human-readable name for the snapshot.
- Required.
- "regions": [
- "str" # An array of the regions that the snapshot is
- available in. The regions are represented by their identifying slug
- values. Required.
- ],
- "size_gigabytes": 0.0, # The billable size of the snapshot
- in gigabytes. Required.
- "type": "str" # Describes the kind of image. It may be one
- of ``snapshot`` or ``backup``. This specifies whether an image is a
- user-generated Droplet snapshot or automatically created Droplet backup.
- Required. Known values are: "snapshot" and "backup".
+ "type": "str", # The type of the DNS record. For example: A,
+ CNAME, TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record
+ type. For example, the "data" value for an A record would be the IPv4
+ address to which the domain will be mapped. For a CAA record, it would
+ contain the domain name of the CA being granted permission to issue
+ certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255
+ used for CAA records.
+ "id": 0, # Optional. A unique identifier for each domain
+ record.
+ "name": "str", # Optional. The host name, alias, or service
+ being defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX
+ records.
+ "tag": "str", # Optional. The parameter tag for CAA records.
+ Valid values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the
+ record, in seconds. This defines the time frame that clients can cache
+ queried information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
}
],
"links": {
@@ -125168,8 +125397,10 @@ async def list_backups(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_list_backups_request(
- droplet_id=droplet_id,
+ _request = build_domains_list_records_request(
+ domain_name=domain_name,
+ name=name,
+ type=type,
per_page=per_page,
page=page,
headers=_headers,
@@ -125230,16 +125461,176 @@ async def list_backups(
return cast(JSON, deserialized) # type: ignore
+ @overload
+ async def create_record(
+ self,
+ domain_name: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain Record.
+
+ To create a new record to a domain, send a POST request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
+
+ The request must include all of the required fields for the domain record type
+ being added.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective required attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
+ # response body for status code(s): 201
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
+ @overload
+ async def create_record(
+ self,
+ domain_name: str,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain Record.
+
+ To create a new record to a domain, send a POST request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
+
+ The request must include all of the required fields for the domain record type
+ being added.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective required attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
@distributed_trace_async
- async def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
+ async def create_record(
+ self,
+ domain_name: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve the Backup Policy for an Existing Droplet.
+ """Create a New Domain Record.
- To show information about an individual Droplet's backup policy, send a GET
- request to ``/v2/droplets/$DROPLET_ID/backups/policy``.
+ To create a new record to a domain, send a POST request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
+ The request must include all of the required fields for the domain record type
+ being added.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective required attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -125247,34 +125638,31 @@ async def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
+ # response body for status code(s): 201
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.
- }
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
}
}
# response body for status code(s): 404
@@ -125302,13 +125690,30 @@ async def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_get_backup_policy_request(
- droplet_id=droplet_id,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_domains_create_record_request(
+ domain_name=domain_name,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -125323,14 +125728,14 @@ async def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [201, 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:
+ if response.status_code == 201:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -125368,19 +125773,19 @@ async def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def list_backup_policies(
- self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ async def get_record(
+ self, domain_name: str, domain_record_id: int, **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List Backup Policies for All Existing Droplets.
+ """Retrieve an Existing Domain Record.
- To list information about the backup policies for all Droplets in the account,
- send a GET request to ``/v2/droplets/backups/policies``.
+ To retrieve a specific domain record, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records/$RECORD_ID``.
- :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
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -125390,41 +125795,26 @@ async def list_backup_policies(
# 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.
- }
- }
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
}
}
# response body for status code(s): 404
@@ -125457,9 +125847,9 @@ async def list_backup_policies(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_list_backup_policies_request(
- per_page=per_page,
- page=page,
+ _request = build_domains_get_record_request(
+ domain_name=domain_name,
+ domain_record_id=domain_record_id,
headers=_headers,
params=_params,
)
@@ -125518,14 +125908,35 @@ async def list_backup_policies(
return cast(JSON, deserialized) # type: ignore
- @distributed_trace_async
- async def list_supported_backup_policies(self, **kwargs: Any) -> JSON:
+ @overload
+ async def patch_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """List Supported Droplet Backup Policies.
+ """Update a Domain Record.
- To retrieve a list of all supported Droplet backup policies, send a GET
- request to ``/v2/droplets/backups/supported_policies``.
+ To update an existing record, send a PATCH request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -125533,26 +125944,52 @@ async def list_supported_backup_policies(self, **kwargs: Any) -> JSON:
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.
- }
- ]
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
+ Required.
+ "data": "str", # Optional. Variable data depending on record type. For
+ example, the "data" value for an A record would be the IPv4 address to which the
+ domain will be mapped. For a CAA record, it would contain the domain name of the
+ CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
+ records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being defined by
+ the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid values
+ are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record, in
+ seconds. This defines the time frame that clients can cache queried information
+ before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
}
# response body for status code(s): 404
response == {
@@ -125566,103 +126003,104 @@ async def list_supported_backup_policies(self, **kwargs: Any) -> JSON:
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")
- )
+ @overload
+ async def patch_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Domain Record.
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ To update an existing record, send a PATCH request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
- 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")
- )
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
- if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ Example:
+ .. code-block:: python
- return cast(JSON, deserialized) # type: ignore
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
@distributed_trace_async
- async def list_snapshots(
- self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ async def patch_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List Snapshots for a Droplet.
+ """Update a Domain Record.
- To retrieve the snapshots that have been created from a Droplet, send a GET
- request to ``/v2/droplets/$DROPLET_ID/snapshots``.
+ To update an existing record, send a PATCH request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
- You will get back a JSON object that has a ``snapshots`` key. This will be set
- to an array of snapshot objects, each of which contain the standard Droplet
- snapshot attributes.
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
- :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
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -125670,36 +126108,52 @@ async def list_snapshots(
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
+ Required.
+ "data": "str", # Optional. Variable data depending on record type. For
+ example, the "data" value for an A record would be the IPv4 address to which the
+ domain will be mapped. For a CAA record, it would contain the domain name of the
+ CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
+ records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being defined by
+ the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid values
+ are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record, in
+ seconds. This defines the time frame that clients can cache queried information
+ before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "snapshots": [
- {
- "created_at": "2020-02-20 00:00:00", # A time value given in
- ISO8601 combined date and time format that represents when the snapshot
- was created. Required.
- "min_disk_size": 0, # The minimum size in GB required for a
- volume or Droplet to use this snapshot. Required.
- "name": "str", # A human-readable name for the snapshot.
- Required.
- "regions": [
- "str" # An array of the regions that the snapshot is
- available in. The regions are represented by their identifying slug
- values. Required.
- ],
- "size_gigabytes": 0.0, # The billable size of the snapshot
- in gigabytes. Required.
- "type": "str" # Describes the kind of image. It may be one
- of ``snapshot`` or ``backup``. This specifies whether an image is a
- user-generated Droplet snapshot or automatically created Droplet backup.
- Required. Known values are: "snapshot" and "backup".
- }
- ]
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
}
# response body for status code(s): 404
response == {
@@ -125726,15 +126180,31 @@ async def list_snapshots(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_list_snapshots_request(
- droplet_id=droplet_id,
- per_page=per_page,
- page=page,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_domains_patch_record_request(
+ domain_name=domain_name,
+ domain_record_id=domain_record_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -125793,26 +126263,199 @@ async def list_snapshots(
return cast(JSON, deserialized) # type: ignore
+ @overload
+ async def update_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Domain Record.
+
+ To update an existing record, send a PUT request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
+ Required.
+ "data": "str", # Optional. Variable data depending on record type. For
+ example, the "data" value for an A record would be the IPv4 address to which the
+ domain will be mapped. For a CAA record, it would contain the domain name of the
+ CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
+ records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being defined by
+ the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid values
+ are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record, in
+ seconds. This defines the time frame that clients can cache queried information
+ before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
+ @overload
+ async def update_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Domain Record.
+
+ To update an existing record, send a PUT request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
@distributed_trace_async
- async def list_kernels(
- self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ async def update_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List All Available Kernels for a Droplet.
+ """Update a Domain Record.
- To retrieve a list of all kernels available to a Droplet, send a GET request
- to ``/v2/droplets/$DROPLET_ID/kernels``
+ To update an existing record, send a PUT request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
- The response will be a JSON object that has a key called ``kernels``. This will
- be set to an array of ``kernel`` objects, each of which contain the standard
- ``kernel`` attributes.
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
- :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
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -125820,24 +126463,51 @@ async def list_kernels(
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
+ Required.
+ "data": "str", # Optional. Variable data depending on record type. For
+ example, the "data" value for an A record would be the IPv4 address to which the
+ domain will be mapped. For a CAA record, it would contain the domain name of the
+ CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
+ records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being defined by
+ the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid values
+ are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record, in
+ seconds. This defines the time frame that clients can cache queried information
+ before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "kernels": [
- {
- "id": 0, # Optional. A unique number used to identify and
- reference a specific kernel.
- "name": "str", # Optional. The display name of the kernel.
- This is shown in the web UI and is generally a descriptive title for the
- kernel in question.
- "version": "str" # Optional. A standard kernel version
- string representing the version, patch, and release information.
- }
- ],
- "links": {
- "pages": {}
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
}
}
# response body for status code(s): 404
@@ -125865,15 +126535,31 @@ async def list_kernels(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_list_kernels_request(
- droplet_id=droplet_id,
- per_page=per_page,
- page=page,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_domains_update_record_request(
+ domain_name=domain_name,
+ domain_record_id=domain_record_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -125933,154 +126619,29 @@ async def list_kernels(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def list_firewalls(
- self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ async def delete_record(
+ self, domain_name: str, domain_record_id: int, **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List all Firewalls Applied to a Droplet.
+ """Delete a Domain Record.
- To retrieve a list of all firewalls available to a Droplet, send a GET request
- to ``/v2/droplets/$DROPLET_ID/firewalls``
+ To delete a record for a domain, send a DELETE request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``.
- The response will be a JSON object that has a key called ``firewalls``. This will
- be set to an array of ``firewall`` objects, each of which contain the standard
- ``firewall`` attributes.
+ The record will be deleted and the response status will be a 204. This
+ indicates a successful request with no body returned.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
- :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
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :return: JSON object or None
+ :rtype: JSON or None
: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.
- },
- "firewalls": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the firewall was created.
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the
- Droplets assigned to the firewall. :code:`
`:code:`
`Requires
- ``droplet:read`` scope.
- ],
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a firewall.
- "inbound_rules": [
- {
- "ports": "str", # The ports on which traffic
- will be allowed specified as a string containing a single port, a
- range (e.g. "8000-9000"), or "0" when all ports are open for a
- protocol. For ICMP rules this parameter will always return "0".
- Required.
- "protocol": "str", # The type of traffic to
- be allowed. This may be one of ``tcp``"" , ``udp``"" , or
- ``icmp``. Required. Known values are: "tcp", "udp", and "icmp".
- "sources": {
- "addresses": [
- "str" # Optional. An array
- of strings containing the IPv4 addresses, IPv6 addresses,
- IPv4 CIDRs, and/or IPv6 CIDRs to which the firewall will
- allow traffic.
- ],
- "droplet_ids": [
- 0 # Optional. An array
- containing the IDs of the Droplets to which the firewall
- will allow traffic.
- ],
- "kubernetes_ids": [
- "str" # Optional. An array
- containing the IDs of the Kubernetes clusters to which
- the firewall will allow traffic.
- ],
- "load_balancer_uids": [
- "str" # Optional. An array
- containing the IDs of the load balancers to which the
- firewall will allow traffic.
- ],
- "tags": {} # Optional. Any object.
- }
- }
- ],
- "name": "str", # Optional. A human-readable name for a
- firewall. The name must begin with an alphanumeric character. Subsequent
- characters must either be alphanumeric characters, a period (.), or a
- dash (-).
- "outbound_rules": [
- {
- "destinations": {
- "addresses": [
- "str" # Optional. An array
- of strings containing the IPv4 addresses, IPv6 addresses,
- IPv4 CIDRs, and/or IPv6 CIDRs to which the firewall will
- allow traffic.
- ],
- "droplet_ids": [
- 0 # Optional. An array
- containing the IDs of the Droplets to which the firewall
- will allow traffic.
- ],
- "kubernetes_ids": [
- "str" # Optional. An array
- containing the IDs of the Kubernetes clusters to which
- the firewall will allow traffic.
- ],
- "load_balancer_uids": [
- "str" # Optional. An array
- containing the IDs of the load balancers to which the
- firewall will allow traffic.
- ],
- "tags": {} # Optional. Any object.
- },
- "ports": "str", # The ports on which traffic
- will be allowed specified as a string containing a single port, a
- range (e.g. "8000-9000"), or "0" when all ports are open for a
- protocol. For ICMP rules this parameter will always return "0".
- Required.
- "protocol": "str" # The type of traffic to
- be allowed. This may be one of ``tcp``"" , ``udp``"" , or
- ``icmp``. Required. Known values are: "tcp", "udp", and "icmp".
- }
- ],
- "pending_changes": [
- {
- "droplet_id": 0, # Optional. An array of
- objects each containing the fields "droplet_id", "removing", and
- "status". It is provided to detail exactly which Droplets are
- having their security policies updated. When empty, all changes
- have been successfully applied.
- "removing": bool, # Optional. An array of
- objects each containing the fields "droplet_id", "removing", and
- "status". It is provided to detail exactly which Droplets are
- having their security policies updated. When empty, all changes
- have been successfully applied.
- "status": "str" # Optional. An array of
- objects each containing the fields "droplet_id", "removing", and
- "status". It is provided to detail exactly which Droplets are
- having their security policies updated. When empty, all changes
- have been successfully applied.
- }
- ],
- "status": "str", # Optional. A status string indicating the
- current state of the firewall. This can be "waiting", "succeeded", or
- "failed". Known values are: "waiting", "succeeded", and "failed".
- "tags": {} # Optional. Any object.
- }
- ],
- "links": {
- "pages": {}
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -126109,12 +126670,11 @@ async def list_firewalls(
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_droplets_list_firewalls_request(
- droplet_id=droplet_id,
- per_page=per_page,
- page=page,
+ _request = build_domains_delete_record_request(
+ domain_name=domain_name,
+ domain_record_id=domain_record_id,
headers=_headers,
params=_params,
)
@@ -126129,14 +126689,15 @@ async def list_firewalls(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ 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 == 200:
+ if response.status_code == 204:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -126147,11 +126708,6 @@ async def list_firewalls(
"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")
@@ -126169,26 +126725,78 @@ async def list_firewalls(
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
+
+
+class DropletsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`droplets` attribute.
+ """
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
@distributed_trace_async
- async def list_neighbors(self, droplet_id: int, **kwargs: Any) -> JSON:
+ async def list(
+ self,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ tag_name: Optional[str] = None,
+ name: Optional[str] = None,
+ type: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """List Neighbors for a Droplet.
+ """List All Droplets.
- To retrieve a list of any "neighbors" (i.e. Droplets that are co-located on
- the same physical hardware) for a specific Droplet, send a GET request to
- ``/v2/droplets/$DROPLET_ID/neighbors``.
+ To list all Droplets in your account, send a GET request to ``/v2/droplets``.
- The results will be returned as a JSON object with a key of ``droplets``. This
- will be set to an array containing objects representing any other Droplets
- that share the same physical hardware. An empty array indicates that the
- Droplet is not co-located any other Droplets associated with your account.
+ The response body will be a JSON object with a key of ``droplets``. This will be
+ set to an array containing objects each representing a Droplet. These will
+ contain the standard Droplet attributes.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
+ Filtering Results by Tag
+ ^^^^^^^^^^^^^^^^^^^^^^^^
+
+ It's possible to request filtered results by including certain query parameters.
+ To only list Droplets assigned to a specific tag, include the ``tag_name`` query
+ parameter set to the name of the tag in your GET request. For example,
+ ``/v2/droplets?tag_name=$TAG_NAME``.
+
+ GPU Droplets
+ ^^^^^^^^^^^^
+
+ By default, only non-GPU Droplets are returned. To list only GPU Droplets, set
+ the ``type`` query parameter to ``gpus``. For example, ``/v2/droplets?type=gpus``.
+
+ :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
+ :keyword tag_name: Used to filter Droplets by a specific tag. Can not be combined with ``name``
+ or ``type``.:code:`
`Requires ``tag:read`` scope. Default value is None.
+ :paramtype tag_name: str
+ :keyword name: Used to filter list response by Droplet name returning only exact matches. It is
+ case-insensitive and can not be combined with ``tag_name``. Default value is None.
+ :paramtype name: str
+ :keyword type: When ``type`` is set to ``gpus``\\ , only GPU Droplets will be returned. By
+ default, only non-GPU Droplets are returned. Can not be combined with ``tag_name``. Known
+ values are: "droplets" and "gpus". Default value is None.
+ :paramtype type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -126198,6 +126806,9 @@ async def list_neighbors(self, droplet_id: int, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
"droplets": [
{
"backup_ids": [
@@ -126458,18 +127069,10 @@ class of Droplets created from this size. For example: Basic, General
of the VPC to which the Droplet is assigned.:code:`
`Requires
``vpc:read`` scope.
}
- ]
- }
- # 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.
+ ],
+ "links": {
+ "pages": {}
+ }
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -126490,8 +127093,12 @@ class of Droplets created from this size. For example: Basic, General
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_list_neighbors_request(
- droplet_id=droplet_id,
+ _request = build_droplets_list_request(
+ per_page=per_page,
+ page=page,
+ tag_name=tag_name,
+ name=name,
+ type=type,
headers=_headers,
params=_params,
)
@@ -126506,68 +127113,75 @@ class of Droplets created from this size. For example: Basic, General
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [200]:
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")
- )
+ 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.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_associated_resources(self, droplet_id: int, **kwargs: Any) -> JSON:
- # pylint: disable=line-too-long
- """List Associated Resources for a Droplet.
+ @overload
+ async def create(
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ """Create a New Droplet.
- To list the associated billable resources that can be destroyed along with a
- Droplet, send a GET request to the
- ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources`` endpoint.
+ To create a new Droplet, send a POST request to ``/v2/droplets`` setting the
+ required attributes.
- This endpoint will only return resources that you are authorized to see. For
- example, to see associated Reserved IPs, include the ``reserved_ip:read`` scope.
+ A Droplet will be created using the provided information. The response body
+ will contain a JSON object with a key called ``droplet``. The value will be an
+ object containing the standard attributes for your new Droplet. The response
+ code, 202 Accepted, does not indicate the success or failure of the operation,
+ just that the request has been accepted for processing. The ``actions`` returned
+ as part of the response's ``links`` object can be used to check the status
+ of the Droplet create event.
- The response will be a JSON object containing ``snapshots``\\ , ``volumes``\\ , and
- ``volume_snapshots`` keys. Each will be set to an array of objects containing
- information about the associated resources.
+ Create Multiple Droplets
+ ^^^^^^^^^^^^^^^^^^^^^^^^
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
+ Creating multiple Droplets is very similar to creating a single Droplet.
+ Instead of sending ``name`` as a string, send ``names`` as an array of strings. A
+ Droplet will be created for each name you send using the associated
+ information. Up to ten Droplets may be created this way at a time.
+
+ Rather than returning a single Droplet, the response body will contain a JSON
+ array with a key called ``droplets``. This will be set to an array of JSON
+ objects, each of which will contain the standard Droplet attributes. The
+ response code, 202 Accepted, does not indicate the success or failure of any
+ operation, just that the request has been accepted for processing. The array
+ of ``actions`` returned as part of the response's ``links`` object can be used to
+ check the status of each individual Droplet create event.
+
+ :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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -126575,346 +127189,101 @@ async def list_associated_resources(self, droplet_id: int, **kwargs: Any) -> JSO
Example:
.. code-block:: python
- # response body for status code(s): 200
- response == {
- "floating_ips": [
- {
- "cost": "str", # Optional. The cost of the resource in USD
- per month if the resource is retained after the Droplet is destroyed.
- "id": "str", # Optional. The unique identifier for the
- resource associated with the Droplet.
- "name": "str" # Optional. The name of the resource
- associated with the Droplet.
- }
- ],
- "reserved_ips": [
- {
- "cost": "str", # Optional. The cost of the resource in USD
- per month if the resource is retained after the Droplet is destroyed.
- "id": "str", # Optional. The unique identifier for the
- resource associated with the Droplet.
- "name": "str" # Optional. The name of the resource
- associated with the Droplet.
- }
- ],
- "snapshots": [
- {
- "cost": "str", # Optional. The cost of the resource in USD
- per month if the resource is retained after the Droplet is destroyed.
- "id": "str", # Optional. The unique identifier for the
- resource associated with the Droplet.
- "name": "str" # Optional. The name of the resource
- associated with the Droplet.
- }
- ],
- "volume_snapshots": [
- {
- "cost": "str", # Optional. The cost of the resource in USD
- per month if the resource is retained after the Droplet is destroyed.
- "id": "str", # Optional. The unique identifier for the
- resource associated with the Droplet.
- "name": "str" # Optional. The name of the resource
- associated with the Droplet.
- }
- ],
- "volumes": [
- {
- "cost": "str", # Optional. The cost of the resource in USD
- per month if the resource is retained after the Droplet is destroyed.
- "id": "str", # Optional. The unique identifier for the
- resource associated with the Droplet.
- "name": "str" # Optional. The name of the resource
- associated with the Droplet.
- }
- ]
- }
- # 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.
- }
+ # JSON input template you can fill out and use as your body input.
+ body = {}
"""
- 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_associated_resources_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
@overload
- async def destroy_with_associated_resources_selective( # pylint: disable=name-too-long
+ async def create(
self,
- droplet_id: int,
- body: Optional[JSON] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Selectively Destroy a Droplet and its Associated Resources.
-
- To destroy a Droplet along with a sub-set of its associated resources, send a
- DELETE request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/selective``
- endpoint. The JSON body of the request should include ``reserved_ips``\\ , ``snapshots``\\ ,
- ``volumes``\\ ,
- or ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed. The IDs can be found by querying the Droplet's
- associated resources. Any associated resource not included in the request
- will remain and continue to accrue changes on your account.
-
- A successful response will include a 202 response code and no content. Use
- the status endpoint to check on the success or failure of the destruction of
- the individual resources.
-
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
- :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: JSON object or None
- :rtype: JSON or None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
+ ) -> JSON:
+ """Create a New Droplet.
- # JSON input template you can fill out and use as your body input.
- body = {
- "floating_ips": [
- "str" # Optional. An array of unique identifiers for the floating
- IPs to be scheduled for deletion.
- ],
- "reserved_ips": [
- "str" # Optional. An array of unique identifiers for the reserved
- IPs to be scheduled for deletion.
- ],
- "snapshots": [
- "str" # Optional. An array of unique identifiers for the snapshots
- to be scheduled for deletion.
- ],
- "volume_snapshots": [
- "str" # Optional. An array of unique identifiers for the volume
- snapshots to be scheduled for deletion.
- ],
- "volumes": [
- "str" # Optional. An array of unique identifiers for the volumes to
- be scheduled for deletion.
- ]
- }
+ To create a new Droplet, send a POST request to ``/v2/droplets`` setting the
+ required attributes.
- # 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.
- }
- """
+ A Droplet will be created using the provided information. The response body
+ will contain a JSON object with a key called ``droplet``. The value will be an
+ object containing the standard attributes for your new Droplet. The response
+ code, 202 Accepted, does not indicate the success or failure of the operation,
+ just that the request has been accepted for processing. The ``actions`` returned
+ as part of the response's ``links`` object can be used to check the status
+ of the Droplet create event.
- @overload
- async def destroy_with_associated_resources_selective( # pylint: disable=name-too-long
- self,
- droplet_id: int,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Selectively Destroy a Droplet and its Associated Resources.
+ Create Multiple Droplets
+ ^^^^^^^^^^^^^^^^^^^^^^^^
- To destroy a Droplet along with a sub-set of its associated resources, send a
- DELETE request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/selective``
- endpoint. The JSON body of the request should include ``reserved_ips``\\ , ``snapshots``\\ ,
- ``volumes``\\ ,
- or ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed. The IDs can be found by querying the Droplet's
- associated resources. Any associated resource not included in the request
- will remain and continue to accrue changes on your account.
+ Creating multiple Droplets is very similar to creating a single Droplet.
+ Instead of sending ``name`` as a string, send ``names`` as an array of strings. A
+ Droplet will be created for each name you send using the associated
+ information. Up to ten Droplets may be created this way at a time.
- A successful response will include a 202 response code and no content. Use
- the status endpoint to check on the success or failure of the destruction of
- the individual resources.
+ Rather than returning a single Droplet, the response body will contain a JSON
+ array with a key called ``droplets``. This will be set to an array of JSON
+ objects, each of which will contain the standard Droplet attributes. The
+ response code, 202 Accepted, does not indicate the success or failure of any
+ operation, just that the request has been accepted for processing. The array
+ of ``actions`` returned as part of the response's ``links`` object can be used to
+ check the status of each individual Droplet create event.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
:param body: Default value is None.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
: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.
- }
"""
@distributed_trace_async
- async def destroy_with_associated_resources_selective( # pylint: disable=name-too-long
- self,
- droplet_id: int,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Selectively Destroy a Droplet and its Associated Resources.
+ async def create(
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> JSON:
+ """Create a New Droplet.
- To destroy a Droplet along with a sub-set of its associated resources, send a
- DELETE request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/selective``
- endpoint. The JSON body of the request should include ``reserved_ips``\\ , ``snapshots``\\ ,
- ``volumes``\\ ,
- or ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed. The IDs can be found by querying the Droplet's
- associated resources. Any associated resource not included in the request
- will remain and continue to accrue changes on your account.
+ To create a new Droplet, send a POST request to ``/v2/droplets`` setting the
+ required attributes.
- A successful response will include a 202 response code and no content. Use
- the status endpoint to check on the success or failure of the destruction of
- the individual resources.
+ A Droplet will be created using the provided information. The response body
+ will contain a JSON object with a key called ``droplet``. The value will be an
+ object containing the standard attributes for your new Droplet. The response
+ code, 202 Accepted, does not indicate the success or failure of the operation,
+ just that the request has been accepted for processing. The ``actions`` returned
+ as part of the response's ``links`` object can be used to check the status
+ of the Droplet create event.
+
+ Create Multiple Droplets
+ ^^^^^^^^^^^^^^^^^^^^^^^^
+
+ Creating multiple Droplets is very similar to creating a single Droplet.
+ Instead of sending ``name`` as a string, send ``names`` as an array of strings. A
+ Droplet will be created for each name you send using the associated
+ information. Up to ten Droplets may be created this way at a time.
+
+ Rather than returning a single Droplet, the response body will contain a JSON
+ array with a key called ``droplets``. This will be set to an array of JSON
+ objects, each of which will contain the standard Droplet attributes. The
+ response code, 202 Accepted, does not indicate the success or failure of any
+ operation, just that the request has been accepted for processing. The array
+ of ``actions`` returned as part of the response's ``links`` object can be used to
+ check the status of each individual Droplet create event.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
:param body: Is either a JSON type or a IO[bytes] type. Default value is None.
:type body: JSON or IO[bytes]
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "floating_ips": [
- "str" # Optional. An array of unique identifiers for the floating
- IPs to be scheduled for deletion.
- ],
- "reserved_ips": [
- "str" # Optional. An array of unique identifiers for the reserved
- IPs to be scheduled for deletion.
- ],
- "snapshots": [
- "str" # Optional. An array of unique identifiers for the snapshots
- to be scheduled for deletion.
- ],
- "volume_snapshots": [
- "str" # Optional. An array of unique identifiers for the volume
- snapshots to be scheduled for deletion.
- ],
- "volumes": [
- "str" # Optional. An array of unique identifiers for the volumes to
- be scheduled for deletion.
- ]
- }
-
- # 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.
- }
+ body = {}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
404: ResourceNotFoundError,
@@ -126935,7 +127304,7 @@ async def destroy_with_associated_resources_selective( # pylint: disable=name-t
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -126948,8 +127317,7 @@ async def destroy_with_associated_resources_selective( # pylint: disable=name-t
else:
_json = None
- _request = build_droplets_destroy_with_associated_resources_selective_request(
- droplet_id=droplet_id,
+ _request = build_droplets_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -126967,69 +127335,49 @@ async def destroy_with_associated_resources_selective( # pylint: disable=name-t
response = pipeline_response.http_response
- if response.status_code not in [202, 404]:
+ if response.status_code not in [202]:
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 == 202:
- 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")
- )
+ 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def destroy_with_associated_resources_dangerous( # pylint: disable=name-too-long
- self, droplet_id: int, *, x_dangerous: bool, **kwargs: Any
- ) -> Optional[JSON]:
+ async def destroy_by_tag(self, *, tag_name: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Destroy a Droplet and All of its Associated Resources (Dangerous).
+ """Deleting Droplets by Tag.
- To destroy a Droplet along with all of its associated resources, send a DELETE
- request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/dangerous``
- endpoint. The headers of this request must include an ``X-Dangerous`` key set to
- ``true``. To preview which resources will be destroyed, first query the
- Droplet's associated resources. This operation *can not* be reverse and should
- be used with caution.
+ To delete **all** Droplets assigned to a specific tag, include the ``tag_name``
+ query parameter set to the name of the tag in your DELETE request. For
+ example, ``/v2/droplets?tag_name=$TAG_NAME``.
- A successful response will include a 202 response code and no content. Use the
- status endpoint to check on the success or failure of the destruction of the
- individual resources.
+ This endpoint requires ``tag:read`` scope.
- :param droplet_id: A unique identifier for a Droplet instance. Required.
- :type droplet_id: int
- :keyword x_dangerous: Acknowledge this action will destroy the Droplet and all associated
- resources and *can not* be reversed. Required.
- :paramtype x_dangerous: bool
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
+
+ :keyword tag_name: Specifies Droplets to be deleted by tag. Required.
+ :paramtype tag_name: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -127067,9 +127415,8 @@ async def destroy_with_associated_resources_dangerous( # pylint: disable=name-t
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_droplets_destroy_with_associated_resources_dangerous_request(
- droplet_id=droplet_id,
- x_dangerous=x_dangerous,
+ _request = build_droplets_destroy_by_tag_request(
+ tag_name=tag_name,
headers=_headers,
params=_params,
)
@@ -127084,7 +127431,7 @@ async def destroy_with_associated_resources_dangerous( # pylint: disable=name-t
response = pipeline_response.http_response
- if response.status_code not in [202, 404]:
+ 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
@@ -127092,7 +127439,7 @@ async def destroy_with_associated_resources_dangerous( # pylint: disable=name-t
deserialized = None
response_headers = {}
- if response.status_code == 202:
+ if response.status_code == 204:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -127102,6 +127449,9 @@ async def destroy_with_associated_resources_dangerous( # pylint: disable=name-t
response_headers["ratelimit-reset"] = self._deserialize(
"int", response.headers.get("ratelimit-reset")
)
+ response_headers["content-type"] = self._deserialize(
+ "str", response.headers.get("content-type")
+ )
if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
@@ -127125,15 +127475,12 @@ async def destroy_with_associated_resources_dangerous( # pylint: disable=name-t
return deserialized # type: ignore
@distributed_trace_async
- async def get_destroy_associated_resources_status(
- self, droplet_id: int, **kwargs: Any
- ) -> JSON:
+ async def get(self, droplet_id: int, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Check Status of a Droplet Destroy with Associated Resources Request.
+ """Retrieve an Existing Droplet.
- To check on the status of a request to destroy a Droplet with its associated
- resources, send a GET request to the
- ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/status`` endpoint.
+ To show information about an individual Droplet, send a GET request to
+ ``/v2/droplets/$DROPLET_ID``.
:param droplet_id: A unique identifier for a Droplet instance. Required.
:type droplet_id: int
@@ -127146,93 +127493,250 @@ async def get_destroy_associated_resources_status(
# response body for status code(s): 200
response == {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format indicating when the requested action was
- completed.
"droplet": {
- "destroyed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format indicating when the resource
- was destroyed if the request was successful.
- "error_message": "str", # Optional. A string indicating that the
- resource was not successfully destroyed and providing additional information.
- "id": "str", # Optional. The unique identifier for the resource
- scheduled for deletion.
- "name": "str" # Optional. The name of the resource scheduled for
- deletion.
- },
- "failures": 0, # Optional. A count of the associated resources that failed
- to be destroyed, if any.
- "resources": {
- "floating_ips": [
- {
- "destroyed_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format indicating
- when the resource was destroyed if the request was successful.
- "error_message": "str", # Optional. A string
- indicating that the resource was not successfully destroyed and
- providing additional information.
- "id": "str", # Optional. The unique identifier for
- the resource scheduled for deletion.
- "name": "str" # Optional. The name of the resource
- scheduled for deletion.
- }
+ "backup_ids": [
+ 0 # An array of backup IDs of any backups that have been
+ taken of the Droplet instance. Droplet backups are enabled at the time
+ of the instance creation.:code:`
`Requires ``image:read`` scope.
+ Required.
],
- "reserved_ips": [
- {
- "destroyed_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format indicating
- when the resource was destroyed if the request was successful.
- "error_message": "str", # Optional. A string
- indicating that the resource was not successfully destroyed and
- providing additional information.
- "id": "str", # Optional. The unique identifier for
- the resource scheduled for deletion.
- "name": "str" # Optional. The name of the resource
- scheduled for deletion.
- }
+ "created_at": "2020-02-20 00:00:00", # A time value given in ISO8601
+ combined date and time format that represents when the Droplet was created.
+ Required.
+ "disk": 0, # The size of the Droplet's disk in gigabytes. Required.
+ "features": [
+ "str" # An array of features enabled on this Droplet.
+ Required.
],
- "snapshots": [
- {
- "destroyed_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format indicating
- when the resource was destroyed if the request was successful.
- "error_message": "str", # Optional. A string
- indicating that the resource was not successfully destroyed and
- providing additional information.
- "id": "str", # Optional. The unique identifier for
- the resource scheduled for deletion.
- "name": "str" # Optional. The name of the resource
- scheduled for deletion.
+ "id": 0, # A unique identifier for each Droplet instance. This is
+ automatically generated upon Droplet creation. Required.
+ "image": {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the image was created.
+ "description": "str", # Optional. An optional free-form text
+ field to describe an image.
+ "distribution": "str", # Optional. The name of a custom
+ image's distribution. Currently, the valid values are ``Arch Linux``"" ,
+ ``CentOS``"" , ``CoreOS``"" , ``Debian``"" , ``Fedora``"" , ``Fedora
+ Atomic``"" , ``FreeBSD``"" , ``Gentoo``"" , ``openSUSE``"" ,
+ ``RancherOS``"" , ``Rocky Linux``"" , ``Ubuntu``"" , and ``Unknown``.
+ Any other value will be accepted but ignored, and ``Unknown`` will be
+ used in its place. Known values are: "Arch Linux", "CentOS", "CoreOS",
+ "Debian", "Fedora", "Fedora Atomic", "FreeBSD", "Gentoo", "openSUSE",
+ "RancherOS", "Rocky Linux", "Ubuntu", and "Unknown".
+ "error_message": "str", # Optional. A string containing
+ information about errors that may occur when importing a custom image.
+ "id": 0, # Optional. A unique number that can be used to
+ identify and reference a specific image.
+ "min_disk_size": 0, # Optional. The minimum disk size in GB
+ required for a Droplet to use this image.
+ "name": "str", # Optional. The display name that has been
+ given to an image. This is what is shown in the control panel and is
+ generally a descriptive title for the image in question.
+ "public": bool, # Optional. This is a boolean value that
+ indicates whether the image in question is public or not. An image that
+ is public is available to all accounts. A non-public image is only
+ accessible from your account.
+ "regions": [
+ "str" # Optional. This attribute is an array of the
+ regions that the image is available in. The regions are represented
+ by their identifying slug values.
+ ],
+ "size_gigabytes": 0.0, # Optional. The size of the image in
+ gigabytes.
+ "slug": "str", # Optional. A uniquely identifying string
+ that is associated with each of the DigitalOcean-provided public images.
+ These can be used to reference a public image as an alternative to the
+ numeric id.
+ "status": "str", # Optional. A status string indicating the
+ state of a custom image. This may be ``NEW``"" , ``available``"" ,
+ ``pending``"" , ``deleted``"" , or ``retired``. Known values are: "NEW",
+ "available", "pending", "deleted", and "retired".
+ "tags": [
+ "str" # Optional. A flat array of tag names as
+ strings to be applied to the resource. Tag names may be for either
+ existing or new tags. :code:`
`:code:`
`Requires ``tag:create``
+ scope.
+ ],
+ "type": "str" # Optional. Describes the kind of image. It
+ may be one of ``base``"" , ``snapshot``"" , ``backup``"" , ``custom``"" ,
+ or ``admin``. Respectively, this specifies whether an image is a
+ DigitalOcean base OS image, user-generated Droplet snapshot,
+ automatically created Droplet backup, user-provided virtual machine
+ image, or an image used for DigitalOcean managed resources (e.g. DOKS
+ worker nodes). Known values are: "base", "snapshot", "backup", "custom",
+ and "admin".
+ },
+ "locked": bool, # A boolean value indicating whether the Droplet has
+ been locked, preventing actions by users. Required.
+ "memory": 0, # Memory of the Droplet in megabytes. Required.
+ "name": "str", # The human-readable name set for the Droplet
+ instance. Required.
+ "networks": {
+ "v4": [
+ {
+ "gateway": "str", # Optional. The gateway of
+ the specified IPv4 network interface. For private interfaces, a
+ gateway is not provided. This is denoted by returning ``nil`` as
+ its value.
+ "ip_address": "str", # Optional. The IP
+ address of the IPv4 network interface.
+ "netmask": "str", # Optional. The netmask of
+ the IPv4 network interface.
+ "type": "str" # Optional. The type of the
+ IPv4 network interface. Known values are: "public" and "private".
+ }
+ ],
+ "v6": [
+ {
+ "gateway": "str", # Optional. The gateway of
+ the specified IPv6 network interface.
+ "ip_address": "str", # Optional. The IP
+ address of the IPv6 network interface.
+ "netmask": 0, # Optional. The netmask of the
+ IPv6 network interface.
+ "type": "str" # Optional. The type of the
+ IPv6 network interface. **Note**"" : IPv6 private networking is
+ not currently supported. "public"
+ }
+ ]
+ },
+ "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.
+ },
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "size": {
+ "available": True, # Default value is True. This is a
+ boolean value that represents whether new Droplets can be created with
+ this size.
+ "description": "str", # A string describing the class of
+ Droplets created from this size. For example: Basic, General Purpose,
+ CPU-Optimized, Memory-Optimized, or Storage-Optimized. Required.
+ "disk": 0, # The amount of disk space set aside for Droplets
+ of this size. The value is represented in gigabytes. Required.
+ "memory": 0, # The amount of RAM allocated to Droplets
+ created of this size. The value is represented in megabytes. Required.
+ "price_hourly": 0.0, # This describes the price of the
+ Droplet size as measured hourly. The value is measured in US dollars.
+ Required.
+ "price_monthly": 0.0, # This attribute describes the monthly
+ cost of this Droplet size if the Droplet is kept for an entire month. The
+ value is measured in US dollars. Required.
+ "regions": [
+ "str" # An array containing the region slugs where
+ this size is available for Droplet creates. Required.
+ ],
+ "slug": "str", # A human-readable string that is used to
+ uniquely identify each size. Required.
+ "transfer": 0.0, # The amount of transfer bandwidth that is
+ available for Droplets created in this size. This only counts traffic on
+ the public interface. The value is given in terabytes. Required.
+ "vcpus": 0, # The number of CPUs allocated to Droplets of
+ this size. Required.
+ "disk_info": [
+ {
+ "size": {
+ "amount": 0, # Optional. The amount
+ of space allocated to the disk.
+ "unit": "str" # Optional. The unit
+ of measure for the disk size.
+ },
+ "type": "str" # Optional. The type of disk.
+ All Droplets contain a ``local`` disk. Additionally, GPU Droplets
+ can also have a ``scratch`` disk for non-persistent data. Known
+ values are: "local" and "scratch".
+ }
+ ],
+ "gpu_info": {
+ "count": 0, # Optional. The number of GPUs allocated
+ to the Droplet.
+ "model": "str", # Optional. The model of the GPU.
+ "vram": {
+ "amount": 0, # Optional. The amount of VRAM
+ allocated to the GPU.
+ "unit": "str" # Optional. The unit of
+ measure for the VRAM.
+ }
}
+ },
+ "size_slug": "str", # The unique slug identifier for the size of
+ this Droplet. Required.
+ "snapshot_ids": [
+ 0 # An array of snapshot IDs of any snapshots created from
+ the Droplet instance.:code:`
`Requires ``image:read`` scope. Required.
],
- "volume_snapshots": [
+ "status": "str", # A status string indicating the state of the
+ Droplet instance. This may be "new", "active", "off", or "archive". Required.
+ Known values are: "new", "active", "off", and "archive".
+ "tags": [
+ "str" # An array of Tags the Droplet has been tagged
+ with.:code:`
`Requires ``tag:read`` scope. Required.
+ ],
+ "vcpus": 0, # The number of virtual CPUs. Required.
+ "volume_ids": [
+ "str" # A flat array including the unique identifier for
+ each Block Storage volume attached to the Droplet.:code:`
`Requires
+ ``block_storage:read`` scope. Required.
+ ],
+ "disk_info": [
{
- "destroyed_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format indicating
- when the resource was destroyed if the request was successful.
- "error_message": "str", # Optional. A string
- indicating that the resource was not successfully destroyed and
- providing additional information.
- "id": "str", # Optional. The unique identifier for
- the resource scheduled for deletion.
- "name": "str" # Optional. The name of the resource
- scheduled for deletion.
+ "size": {
+ "amount": 0, # Optional. The amount of space
+ allocated to the disk.
+ "unit": "str" # Optional. The unit of
+ measure for the disk size.
+ },
+ "type": "str" # Optional. The type of disk. All
+ Droplets contain a ``local`` disk. Additionally, GPU Droplets can
+ also have a ``scratch`` disk for non-persistent data. Known values
+ are: "local" and "scratch".
}
],
- "volumes": [
- {
- "destroyed_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format indicating
- when the resource was destroyed if the request was successful.
- "error_message": "str", # Optional. A string
- indicating that the resource was not successfully destroyed and
- providing additional information.
- "id": "str", # Optional. The unique identifier for
- the resource scheduled for deletion.
- "name": "str" # Optional. The name of the resource
- scheduled for deletion.
+ "gpu_info": {
+ "count": 0, # Optional. The number of GPUs allocated to the
+ Droplet.
+ "model": "str", # Optional. The model of the GPU.
+ "vram": {
+ "amount": 0, # Optional. The amount of VRAM
+ allocated to the GPU.
+ "unit": "str" # Optional. The unit of measure for
+ the VRAM.
}
- ]
+ },
+ "kernel": {
+ "id": 0, # Optional. A unique number used to identify and
+ reference a specific kernel.
+ "name": "str", # Optional. The display name of the kernel.
+ This is shown in the web UI and is generally a descriptive title for the
+ kernel in question.
+ "version": "str" # Optional. A standard kernel version
+ string representing the version, patch, and release information.
+ },
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the Droplet is assigned.:code:`
`Requires ``vpc:read`` scope.
}
}
# response body for status code(s): 404
@@ -127265,7 +127769,7 @@ async def get_destroy_associated_resources_status(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_get_destroy_associated_resources_status_request(
+ _request = build_droplets_get_request(
droplet_id=droplet_id,
headers=_headers,
params=_params,
@@ -127326,20 +127830,14 @@ async def get_destroy_associated_resources_status(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def destroy_retry_with_associated_resources(
- self, droplet_id: int, **kwargs: Any
- ) -> Optional[JSON]:
+ async def destroy(self, droplet_id: int, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Retry a Droplet Destroy with Associated Resources Request.
+ """Delete an Existing Droplet.
- If the status of a request to destroy a Droplet with its associated resources
- reported any errors, it can be retried by sending a POST request to the
- ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/retry`` endpoint.
+ To delete a Droplet, send a DELETE request to ``/v2/droplets/$DROPLET_ID``.
- Only one destroy can be active at a time per Droplet. If a retry is issued
- while another destroy is in progress for the Droplet a 409 status code will
- be returned. A successful response will include a 202 response code and no
- content.
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
:param droplet_id: A unique identifier for a Droplet instance. Required.
:type droplet_id: int
@@ -127350,7 +127848,7 @@ async def destroy_retry_with_associated_resources(
Example:
.. code-block:: python
- # response body for status code(s): 404, 409
+ # 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
@@ -127380,7 +127878,7 @@ async def destroy_retry_with_associated_resources(
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_droplets_destroy_retry_with_associated_resources_request(
+ _request = build_droplets_destroy_request(
droplet_id=droplet_id,
headers=_headers,
params=_params,
@@ -127396,7 +127894,7 @@ async def destroy_retry_with_associated_resources(
response = pipeline_response.http_response
- if response.status_code not in [202, 404, 409]:
+ 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
@@ -127404,7 +127902,7 @@ async def destroy_retry_with_associated_resources(
deserialized = None
response_headers = {}
- if response.status_code == 202:
+ if response.status_code == 204:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -127414,24 +127912,11 @@ async def destroy_retry_with_associated_resources(
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")
+ response_headers["content-type"] = self._deserialize(
+ "str", response.headers.get("content-type")
)
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
-
- if response.status_code == 409:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -127453,19 +127938,25 @@ async def destroy_retry_with_associated_resources(
return deserialized # type: ignore
@distributed_trace_async
- async def list_neighbors_ids(self, **kwargs: Any) -> JSON:
+ async def list_backups(
+ self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """List All Droplet Neighbors.
+ """List Backups for a Droplet.
- To retrieve a list of all Droplets that are co-located on the same physical
- hardware, send a GET request to ``/v2/reports/droplet_neighbors_ids``.
+ To retrieve any backups associated with a Droplet, send a GET request to
+ ``/v2/droplets/$DROPLET_ID/backups``.
- The results will be returned as a JSON object with a key of ``neighbor_ids``.
- This will be set to an array of arrays. Each array will contain a set of
- Droplet IDs for Droplets that share a physical server. An empty array
- indicates that all Droplets associated with your account are located on
- separate physical hardware.
+ You will get back a JSON object that has a ``backups`` key. This will be set to
+ an array of backup objects, each of which contain the standard
+ Droplet backup attributes.
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :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:
@@ -127475,12 +127966,34 @@ async def list_neighbors_ids(self, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "neighbor_ids": [
- [
- 0 # Optional. An array of arrays. Each array will contain a
- set of Droplet IDs for Droplets that share a physical server.
- ]
- ]
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "backups": [
+ {
+ "created_at": "2020-02-20 00:00:00", # A time value given in
+ ISO8601 combined date and time format that represents when the snapshot
+ was created. Required.
+ "min_disk_size": 0, # The minimum size in GB required for a
+ volume or Droplet to use this snapshot. Required.
+ "name": "str", # A human-readable name for the snapshot.
+ Required.
+ "regions": [
+ "str" # An array of the regions that the snapshot is
+ available in. The regions are represented by their identifying slug
+ values. Required.
+ ],
+ "size_gigabytes": 0.0, # The billable size of the snapshot
+ in gigabytes. Required.
+ "type": "str" # Describes the kind of image. It may be one
+ of ``snapshot`` or ``backup``. This specifies whether an image is a
+ user-generated Droplet snapshot or automatically created Droplet backup.
+ Required. Known values are: "snapshot" and "backup".
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
}
# response body for status code(s): 404
response == {
@@ -127512,7 +128025,10 @@ async def list_neighbors_ids(self, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplets_list_neighbors_ids_request(
+ _request = build_droplets_list_backups_request(
+ droplet_id=droplet_id,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -127571,46 +128087,16 @@ async def list_neighbors_ids(self, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
-
-class DropletActionsOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.aio.GeneratedClient`'s
- :attr:`droplet_actions` attribute.
- """
-
- def __init__(self, *args, **kwargs) -> None:
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
-
@distributed_trace_async
- async def list(
- self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ async def get_backup_policy(self, droplet_id: int, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List Actions for a Droplet.
-
- To retrieve a list of all actions that have been executed for a Droplet, send
- a GET request to ``/v2/droplets/$DROPLET_ID/actions``.
+ """Retrieve the Backup Policy for an Existing Droplet.
- The results will be returned as a JSON object with an ``actions`` key. This will
- be set to an array filled with ``action`` objects containing the standard
- ``action`` attributes.
+ 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
- :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:
@@ -127620,55 +128106,32 @@ async def list(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "actions": [
- {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
- Required.
- "features": [
- "str" # This attribute is set to an array
- which contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region.
- This will be a full name that is used in the control panel and other
- interfaces. Required.
- "sizes": [
- "str" # This attribute is set to an array
- which contains the identifying slugs for the sizes available in
- this region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used
- as a unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string
- that is used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the
- resource that the action is associated with.
- "resource_type": "str", # Optional. The type of resource
- that the action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the action was initiated.
- "status": "in-progress", # Optional. Default value is
- "in-progress". The current status of the action. This can be
- "in-progress", "completed", or "errored". Known values are:
- "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that
- the object represents. For example, this could be "transfer" to represent
- the state of an image transfer action.
+ "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.
}
- ],
- "links": {
- "pages": {}
}
}
# response body for status code(s): 404
@@ -127701,10 +128164,8 @@ async def list(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_droplet_actions_list_request(
+ _request = build_droplets_get_backup_policy_request(
droplet_id=droplet_id,
- per_page=per_page,
- page=page,
headers=_headers,
params=_params,
)
@@ -127763,58 +128224,2454 @@ async def list(
return cast(JSON, deserialized) # type: ignore
- @overload
- async def post(
- self,
- droplet_id: int,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
+ @distributed_trace_async
+ async def list_backup_policies(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Droplet Action.
+ """List Backup Policies for All Existing Droplets.
- To initiate an action on a Droplet send a POST request to
- ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
+ To list information about the backup policies for all Droplets in the account,
+ send a GET request to ``/v2/droplets/backups/policies``.
- .. list-table::
- :header-rows: 1
+ :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:
- * - Action
- - Details
- - Additionally Required Permission
- * - :code:``enable_backups``
- - 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.
- -
- * - :code:``power_cycle``
- - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button
- on a physical machine, it's similar to booting from scratch.
- -
- * - :code:``shutdown``
- - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a
- graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown``
- command can fail, this action guarantees that the command is issued, not that it succeeds. The
- preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout,
- followed by a ``power_off`` action to ensure the Droplet is off.
- -
- * - :code:``power_off``
- - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used
- if the ``shutdown`` action is not successful. It is similar to cutting the power on a server
- and could lead to complications.
- -
- * - :code:``power_on``
+ 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
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Snapshots for a Droplet.
+
+ To retrieve the snapshots that have been created from a Droplet, send a GET
+ request to ``/v2/droplets/$DROPLET_ID/snapshots``.
+
+ You will get back a JSON object that has a ``snapshots`` key. This will be set
+ to an array of snapshot objects, each of which contain the standard Droplet
+ snapshot attributes.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :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": {}
+ },
+ "snapshots": [
+ {
+ "created_at": "2020-02-20 00:00:00", # A time value given in
+ ISO8601 combined date and time format that represents when the snapshot
+ was created. Required.
+ "min_disk_size": 0, # The minimum size in GB required for a
+ volume or Droplet to use this snapshot. Required.
+ "name": "str", # A human-readable name for the snapshot.
+ Required.
+ "regions": [
+ "str" # An array of the regions that the snapshot is
+ available in. The regions are represented by their identifying slug
+ values. Required.
+ ],
+ "size_gigabytes": 0.0, # The billable size of the snapshot
+ in gigabytes. Required.
+ "type": "str" # Describes the kind of image. It may be one
+ of ``snapshot`` or ``backup``. This specifies whether an image is a
+ user-generated Droplet snapshot or automatically created Droplet backup.
+ Required. Known values are: "snapshot" and "backup".
+ }
+ ]
+ }
+ # 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_snapshots_request(
+ droplet_id=droplet_id,
+ 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_kernels(
+ self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Available Kernels for a Droplet.
+
+ To retrieve a list of all kernels available to a Droplet, send a GET request
+ to ``/v2/droplets/$DROPLET_ID/kernels``
+
+ The response will be a JSON object that has a key called ``kernels``. This will
+ be set to an array of ``kernel`` objects, each of which contain the standard
+ ``kernel`` attributes.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :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.
+ },
+ "kernels": [
+ {
+ "id": 0, # Optional. A unique number used to identify and
+ reference a specific kernel.
+ "name": "str", # Optional. The display name of the kernel.
+ This is shown in the web UI and is generally a descriptive title for the
+ kernel in question.
+ "version": "str" # Optional. A standard kernel version
+ string representing the version, patch, and release information.
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
+ }
+ # 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_kernels_request(
+ droplet_id=droplet_id,
+ 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_firewalls(
+ self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List all Firewalls Applied to a Droplet.
+
+ To retrieve a list of all firewalls available to a Droplet, send a GET request
+ to ``/v2/droplets/$DROPLET_ID/firewalls``
+
+ The response will be a JSON object that has a key called ``firewalls``. This will
+ be set to an array of ``firewall`` objects, each of which contain the standard
+ ``firewall`` attributes.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :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.
+ },
+ "firewalls": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the firewall was created.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the
+ Droplets assigned to the firewall. :code:`
`:code:`
`Requires
+ ``droplet:read`` scope.
+ ],
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a firewall.
+ "inbound_rules": [
+ {
+ "ports": "str", # The ports on which traffic
+ will be allowed specified as a string containing a single port, a
+ range (e.g. "8000-9000"), or "0" when all ports are open for a
+ protocol. For ICMP rules this parameter will always return "0".
+ Required.
+ "protocol": "str", # The type of traffic to
+ be allowed. This may be one of ``tcp``"" , ``udp``"" , or
+ ``icmp``. Required. Known values are: "tcp", "udp", and "icmp".
+ "sources": {
+ "addresses": [
+ "str" # Optional. An array
+ of strings containing the IPv4 addresses, IPv6 addresses,
+ IPv4 CIDRs, and/or IPv6 CIDRs to which the firewall will
+ allow traffic.
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array
+ containing the IDs of the Droplets to which the firewall
+ will allow traffic.
+ ],
+ "kubernetes_ids": [
+ "str" # Optional. An array
+ containing the IDs of the Kubernetes clusters to which
+ the firewall will allow traffic.
+ ],
+ "load_balancer_uids": [
+ "str" # Optional. An array
+ containing the IDs of the load balancers to which the
+ firewall will allow traffic.
+ ],
+ "tags": {} # Optional. Any object.
+ }
+ }
+ ],
+ "name": "str", # Optional. A human-readable name for a
+ firewall. The name must begin with an alphanumeric character. Subsequent
+ characters must either be alphanumeric characters, a period (.), or a
+ dash (-).
+ "outbound_rules": [
+ {
+ "destinations": {
+ "addresses": [
+ "str" # Optional. An array
+ of strings containing the IPv4 addresses, IPv6 addresses,
+ IPv4 CIDRs, and/or IPv6 CIDRs to which the firewall will
+ allow traffic.
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array
+ containing the IDs of the Droplets to which the firewall
+ will allow traffic.
+ ],
+ "kubernetes_ids": [
+ "str" # Optional. An array
+ containing the IDs of the Kubernetes clusters to which
+ the firewall will allow traffic.
+ ],
+ "load_balancer_uids": [
+ "str" # Optional. An array
+ containing the IDs of the load balancers to which the
+ firewall will allow traffic.
+ ],
+ "tags": {} # Optional. Any object.
+ },
+ "ports": "str", # The ports on which traffic
+ will be allowed specified as a string containing a single port, a
+ range (e.g. "8000-9000"), or "0" when all ports are open for a
+ protocol. For ICMP rules this parameter will always return "0".
+ Required.
+ "protocol": "str" # The type of traffic to
+ be allowed. This may be one of ``tcp``"" , ``udp``"" , or
+ ``icmp``. Required. Known values are: "tcp", "udp", and "icmp".
+ }
+ ],
+ "pending_changes": [
+ {
+ "droplet_id": 0, # Optional. An array of
+ objects each containing the fields "droplet_id", "removing", and
+ "status". It is provided to detail exactly which Droplets are
+ having their security policies updated. When empty, all changes
+ have been successfully applied.
+ "removing": bool, # Optional. An array of
+ objects each containing the fields "droplet_id", "removing", and
+ "status". It is provided to detail exactly which Droplets are
+ having their security policies updated. When empty, all changes
+ have been successfully applied.
+ "status": "str" # Optional. An array of
+ objects each containing the fields "droplet_id", "removing", and
+ "status". It is provided to detail exactly which Droplets are
+ having their security policies updated. When empty, all changes
+ have been successfully applied.
+ }
+ ],
+ "status": "str", # Optional. A status string indicating the
+ current state of the firewall. This can be "waiting", "succeeded", or
+ "failed". Known values are: "waiting", "succeeded", and "failed".
+ "tags": {} # Optional. Any object.
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
+ }
+ # 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_firewalls_request(
+ droplet_id=droplet_id,
+ 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_neighbors(self, droplet_id: int, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List Neighbors for a Droplet.
+
+ To retrieve a list of any "neighbors" (i.e. Droplets that are co-located on
+ the same physical hardware) for a specific Droplet, send a GET request to
+ ``/v2/droplets/$DROPLET_ID/neighbors``.
+
+ The results will be returned as a JSON object with a key of ``droplets``. This
+ will be set to an array containing objects representing any other Droplets
+ that share the same physical hardware. An empty array indicates that the
+ Droplet is not co-located any other Droplets associated with your account.
+
+ :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 == {
+ "droplets": [
+ {
+ "backup_ids": [
+ 0 # An array of backup IDs of any backups that have
+ been taken of the Droplet instance. Droplet backups are enabled at
+ the time of the instance creation.:code:`
`Requires ``image:read``
+ scope. Required.
+ ],
+ "created_at": "2020-02-20 00:00:00", # A time value given in
+ ISO8601 combined date and time format that represents when the Droplet
+ was created. Required.
+ "disk": 0, # The size of the Droplet's disk in gigabytes.
+ Required.
+ "features": [
+ "str" # An array of features enabled on this
+ Droplet. Required.
+ ],
+ "id": 0, # A unique identifier for each Droplet instance.
+ This is automatically generated upon Droplet creation. Required.
+ "image": {
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the image was created.
+ "description": "str", # Optional. An optional
+ free-form text field to describe an image.
+ "distribution": "str", # Optional. The name of a
+ custom image's distribution. Currently, the valid values are ``Arch
+ Linux``"" , ``CentOS``"" , ``CoreOS``"" , ``Debian``"" , ``Fedora``""
+ , ``Fedora Atomic``"" , ``FreeBSD``"" , ``Gentoo``"" ,
+ ``openSUSE``"" , ``RancherOS``"" , ``Rocky Linux``"" , ``Ubuntu``"" ,
+ and ``Unknown``. Any other value will be accepted but ignored, and
+ ``Unknown`` will be used in its place. Known values are: "Arch
+ Linux", "CentOS", "CoreOS", "Debian", "Fedora", "Fedora Atomic",
+ "FreeBSD", "Gentoo", "openSUSE", "RancherOS", "Rocky Linux",
+ "Ubuntu", and "Unknown".
+ "error_message": "str", # Optional. A string
+ containing information about errors that may occur when importing a
+ custom image.
+ "id": 0, # Optional. A unique number that can be
+ used to identify and reference a specific image.
+ "min_disk_size": 0, # Optional. The minimum disk
+ size in GB required for a Droplet to use this image.
+ "name": "str", # Optional. The display name that has
+ been given to an image. This is what is shown in the control panel
+ and is generally a descriptive title for the image in question.
+ "public": bool, # Optional. This is a boolean value
+ that indicates whether the image in question is public or not. An
+ image that is public is available to all accounts. A non-public image
+ is only accessible from your account.
+ "regions": [
+ "str" # Optional. This attribute is an array
+ of the regions that the image is available in. The regions are
+ represented by their identifying slug values.
+ ],
+ "size_gigabytes": 0.0, # Optional. The size of the
+ image in gigabytes.
+ "slug": "str", # Optional. A uniquely identifying
+ string that is associated with each of the DigitalOcean-provided
+ public images. These can be used to reference a public image as an
+ alternative to the numeric id.
+ "status": "str", # Optional. A status string
+ indicating the state of a custom image. This may be ``NEW``"" ,
+ ``available``"" , ``pending``"" , ``deleted``"" , or ``retired``.
+ Known values are: "NEW", "available", "pending", "deleted", and
+ "retired".
+ "tags": [
+ "str" # Optional. A flat array of tag names
+ as strings to be applied to the resource. Tag names may be for
+ either existing or new tags. :code:`
`:code:`
`Requires
+ ``tag:create`` scope.
+ ],
+ "type": "str" # Optional. Describes the kind of
+ image. It may be one of ``base``"" , ``snapshot``"" , ``backup``"" ,
+ ``custom``"" , or ``admin``. Respectively, this specifies whether an
+ image is a DigitalOcean base OS image, user-generated Droplet
+ snapshot, automatically created Droplet backup, user-provided virtual
+ machine image, or an image used for DigitalOcean managed resources
+ (e.g. DOKS worker nodes). Known values are: "base", "snapshot",
+ "backup", "custom", and "admin".
+ },
+ "locked": bool, # A boolean value indicating whether the
+ Droplet has been locked, preventing actions by users. Required.
+ "memory": 0, # Memory of the Droplet in megabytes. Required.
+ "name": "str", # The human-readable name set for the Droplet
+ instance. Required.
+ "networks": {
+ "v4": [
+ {
+ "gateway": "str", # Optional. The
+ gateway of the specified IPv4 network interface. For private
+ interfaces, a gateway is not provided. This is denoted by
+ returning ``nil`` as its value.
+ "ip_address": "str", # Optional. The
+ IP address of the IPv4 network interface.
+ "netmask": "str", # Optional. The
+ netmask of the IPv4 network interface.
+ "type": "str" # Optional. The type
+ of the IPv4 network interface. Known values are: "public" and
+ "private".
+ }
+ ],
+ "v6": [
+ {
+ "gateway": "str", # Optional. The
+ gateway of the specified IPv6 network interface.
+ "ip_address": "str", # Optional. The
+ IP address of the IPv6 network interface.
+ "netmask": 0, # Optional. The
+ netmask of the IPv6 network interface.
+ "type": "str" # Optional. The type
+ of the IPv6 network interface. **Note**"" : IPv6 private
+ networking is not currently supported. "public"
+ }
+ ]
+ },
+ "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.
+ },
+ "region": {
+ "available": bool, # This is a boolean value that
+ represents whether new Droplets can be created in this region.
+ Required.
+ "features": [
+ "str" # This attribute is set to an array
+ which contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region.
+ This will be a full name that is used in the control panel and other
+ interfaces. Required.
+ "sizes": [
+ "str" # This attribute is set to an array
+ which contains the identifying slugs for the sizes available in
+ this region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used
+ as a unique identifier for each region. Required.
+ },
+ "size": {
+ "available": True, # Default value is True. This is
+ a boolean value that represents whether new Droplets can be created
+ with this size.
+ "description": "str", # A string describing the
+ class of Droplets created from this size. For example: Basic, General
+ Purpose, CPU-Optimized, Memory-Optimized, or Storage-Optimized.
+ Required.
+ "disk": 0, # The amount of disk space set aside for
+ Droplets of this size. The value is represented in gigabytes.
+ Required.
+ "memory": 0, # The amount of RAM allocated to
+ Droplets created of this size. The value is represented in megabytes.
+ Required.
+ "price_hourly": 0.0, # This describes the price of
+ the Droplet size as measured hourly. The value is measured in US
+ dollars. Required.
+ "price_monthly": 0.0, # This attribute describes the
+ monthly cost of this Droplet size if the Droplet is kept for an
+ entire month. The value is measured in US dollars. Required.
+ "regions": [
+ "str" # An array containing the region slugs
+ where this size is available for Droplet creates. Required.
+ ],
+ "slug": "str", # A human-readable string that is
+ used to uniquely identify each size. Required.
+ "transfer": 0.0, # The amount of transfer bandwidth
+ that is available for Droplets created in this size. This only counts
+ traffic on the public interface. The value is given in terabytes.
+ Required.
+ "vcpus": 0, # The number of CPUs allocated to
+ Droplets of this size. Required.
+ "disk_info": [
+ {
+ "size": {
+ "amount": 0, # Optional. The
+ amount of space allocated to the disk.
+ "unit": "str" # Optional.
+ The unit of measure for the disk size.
+ },
+ "type": "str" # Optional. The type
+ of disk. All Droplets contain a ``local`` disk. Additionally,
+ GPU Droplets can also have a ``scratch`` disk for
+ non-persistent data. Known values are: "local" and "scratch".
+ }
+ ],
+ "gpu_info": {
+ "count": 0, # Optional. The number of GPUs
+ allocated to the Droplet.
+ "model": "str", # Optional. The model of the
+ GPU.
+ "vram": {
+ "amount": 0, # Optional. The amount
+ of VRAM allocated to the GPU.
+ "unit": "str" # Optional. The unit
+ of measure for the VRAM.
+ }
+ }
+ },
+ "size_slug": "str", # The unique slug identifier for the
+ size of this Droplet. Required.
+ "snapshot_ids": [
+ 0 # An array of snapshot IDs of any snapshots
+ created from the Droplet instance.:code:`
`Requires ``image:read``
+ scope. Required.
+ ],
+ "status": "str", # A status string indicating the state of
+ the Droplet instance. This may be "new", "active", "off", or "archive".
+ Required. Known values are: "new", "active", "off", and "archive".
+ "tags": [
+ "str" # An array of Tags the Droplet has been tagged
+ with.:code:`
`Requires ``tag:read`` scope. Required.
+ ],
+ "vcpus": 0, # The number of virtual CPUs. Required.
+ "volume_ids": [
+ "str" # A flat array including the unique identifier
+ for each Block Storage volume attached to the
+ Droplet.:code:`
`Requires ``block_storage:read`` scope. Required.
+ ],
+ "disk_info": [
+ {
+ "size": {
+ "amount": 0, # Optional. The amount
+ of space allocated to the disk.
+ "unit": "str" # Optional. The unit
+ of measure for the disk size.
+ },
+ "type": "str" # Optional. The type of disk.
+ All Droplets contain a ``local`` disk. Additionally, GPU Droplets
+ can also have a ``scratch`` disk for non-persistent data. Known
+ values are: "local" and "scratch".
+ }
+ ],
+ "gpu_info": {
+ "count": 0, # Optional. The number of GPUs allocated
+ to the Droplet.
+ "model": "str", # Optional. The model of the GPU.
+ "vram": {
+ "amount": 0, # Optional. The amount of VRAM
+ allocated to the GPU.
+ "unit": "str" # Optional. The unit of
+ measure for the VRAM.
+ }
+ },
+ "kernel": {
+ "id": 0, # Optional. A unique number used to
+ identify and reference a specific kernel.
+ "name": "str", # Optional. The display name of the
+ kernel. This is shown in the web UI and is generally a descriptive
+ title for the kernel in question.
+ "version": "str" # Optional. A standard kernel
+ version string representing the version, patch, and release
+ information.
+ },
+ "vpc_uuid": "str" # Optional. A string specifying the UUID
+ of the VPC to which the Droplet is assigned.:code:`
`Requires
+ ``vpc:read`` scope.
+ }
+ ]
+ }
+ # 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_neighbors_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_associated_resources(self, droplet_id: int, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List Associated Resources for a Droplet.
+
+ To list the associated billable resources that can be destroyed along with a
+ Droplet, send a GET request to the
+ ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources`` endpoint.
+
+ This endpoint will only return resources that you are authorized to see. For
+ example, to see associated Reserved IPs, include the ``reserved_ip:read`` scope.
+
+ The response will be a JSON object containing ``snapshots``\\ , ``volumes``\\ , and
+ ``volume_snapshots`` keys. Each will be set to an array of objects containing
+ information about the associated resources.
+
+ :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 == {
+ "floating_ips": [
+ {
+ "cost": "str", # Optional. The cost of the resource in USD
+ per month if the resource is retained after the Droplet is destroyed.
+ "id": "str", # Optional. The unique identifier for the
+ resource associated with the Droplet.
+ "name": "str" # Optional. The name of the resource
+ associated with the Droplet.
+ }
+ ],
+ "reserved_ips": [
+ {
+ "cost": "str", # Optional. The cost of the resource in USD
+ per month if the resource is retained after the Droplet is destroyed.
+ "id": "str", # Optional. The unique identifier for the
+ resource associated with the Droplet.
+ "name": "str" # Optional. The name of the resource
+ associated with the Droplet.
+ }
+ ],
+ "snapshots": [
+ {
+ "cost": "str", # Optional. The cost of the resource in USD
+ per month if the resource is retained after the Droplet is destroyed.
+ "id": "str", # Optional. The unique identifier for the
+ resource associated with the Droplet.
+ "name": "str" # Optional. The name of the resource
+ associated with the Droplet.
+ }
+ ],
+ "volume_snapshots": [
+ {
+ "cost": "str", # Optional. The cost of the resource in USD
+ per month if the resource is retained after the Droplet is destroyed.
+ "id": "str", # Optional. The unique identifier for the
+ resource associated with the Droplet.
+ "name": "str" # Optional. The name of the resource
+ associated with the Droplet.
+ }
+ ],
+ "volumes": [
+ {
+ "cost": "str", # Optional. The cost of the resource in USD
+ per month if the resource is retained after the Droplet is destroyed.
+ "id": "str", # Optional. The unique identifier for the
+ resource associated with the Droplet.
+ "name": "str" # Optional. The name of the resource
+ associated with the Droplet.
+ }
+ ]
+ }
+ # 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_associated_resources_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
+
+ @overload
+ async def destroy_with_associated_resources_selective( # pylint: disable=name-too-long
+ self,
+ droplet_id: int,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Destroy a Droplet and its Associated Resources.
+
+ To destroy a Droplet along with a sub-set of its associated resources, send a
+ DELETE request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/selective``
+ endpoint. The JSON body of the request should include ``reserved_ips``\\ , ``snapshots``\\ ,
+ ``volumes``\\ ,
+ or ``volume_snapshots`` keys each set to an array of IDs for the associated
+ resources to be destroyed. The IDs can be found by querying the Droplet's
+ associated resources. Any associated resource not included in the request
+ will remain and continue to accrue changes on your account.
+
+ A successful response will include a 202 response code and no content. Use
+ the status endpoint to check on the success or failure of the destruction of
+ the individual resources.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :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: JSON object or None
+ :rtype: JSON or None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "floating_ips": [
+ "str" # Optional. An array of unique identifiers for the floating
+ IPs to be scheduled for deletion.
+ ],
+ "reserved_ips": [
+ "str" # Optional. An array of unique identifiers for the reserved
+ IPs to be scheduled for deletion.
+ ],
+ "snapshots": [
+ "str" # Optional. An array of unique identifiers for the snapshots
+ to be scheduled for deletion.
+ ],
+ "volume_snapshots": [
+ "str" # Optional. An array of unique identifiers for the volume
+ snapshots to be scheduled for deletion.
+ ],
+ "volumes": [
+ "str" # Optional. An array of unique identifiers for the volumes to
+ be scheduled for deletion.
+ ]
+ }
+
+ # 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.
+ }
+ """
+
+ @overload
+ async def destroy_with_associated_resources_selective( # pylint: disable=name-too-long
+ self,
+ droplet_id: int,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Destroy a Droplet and its Associated Resources.
+
+ To destroy a Droplet along with a sub-set of its associated resources, send a
+ DELETE request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/selective``
+ endpoint. The JSON body of the request should include ``reserved_ips``\\ , ``snapshots``\\ ,
+ ``volumes``\\ ,
+ or ``volume_snapshots`` keys each set to an array of IDs for the associated
+ resources to be destroyed. The IDs can be found by querying the Droplet's
+ associated resources. Any associated resource not included in the request
+ will remain and continue to accrue changes on your account.
+
+ A successful response will include a 202 response code and no content. Use
+ the status endpoint to check on the success or failure of the destruction of
+ the individual resources.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: 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.
+ }
+ """
+
+ @distributed_trace_async
+ async def destroy_with_associated_resources_selective( # pylint: disable=name-too-long
+ self,
+ droplet_id: int,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Destroy a Droplet and its Associated Resources.
+
+ To destroy a Droplet along with a sub-set of its associated resources, send a
+ DELETE request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/selective``
+ endpoint. The JSON body of the request should include ``reserved_ips``\\ , ``snapshots``\\ ,
+ ``volumes``\\ ,
+ or ``volume_snapshots`` keys each set to an array of IDs for the associated
+ resources to be destroyed. The IDs can be found by querying the Droplet's
+ associated resources. Any associated resource not included in the request
+ will remain and continue to accrue changes on your account.
+
+ A successful response will include a 202 response code and no content. Use
+ the status endpoint to check on the success or failure of the destruction of
+ the individual resources.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: JSON object or None
+ :rtype: JSON or None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "floating_ips": [
+ "str" # Optional. An array of unique identifiers for the floating
+ IPs to be scheduled for deletion.
+ ],
+ "reserved_ips": [
+ "str" # Optional. An array of unique identifiers for the reserved
+ IPs to be scheduled for deletion.
+ ],
+ "snapshots": [
+ "str" # Optional. An array of unique identifiers for the snapshots
+ to be scheduled for deletion.
+ ],
+ "volume_snapshots": [
+ "str" # Optional. An array of unique identifiers for the volume
+ snapshots to be scheduled for deletion.
+ ],
+ "volumes": [
+ "str" # Optional. An array of unique identifiers for the volumes to
+ be scheduled for deletion.
+ ]
+ }
+
+ # 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_droplets_destroy_with_associated_resources_selective_request(
+ droplet_id=droplet_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [202, 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 == 202:
+ 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 destroy_with_associated_resources_dangerous( # pylint: disable=name-too-long
+ self, droplet_id: int, *, x_dangerous: bool, **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Destroy a Droplet and All of its Associated Resources (Dangerous).
+
+ To destroy a Droplet along with all of its associated resources, send a DELETE
+ request to the ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/dangerous``
+ endpoint. The headers of this request must include an ``X-Dangerous`` key set to
+ ``true``. To preview which resources will be destroyed, first query the
+ Droplet's associated resources. This operation *can not* be reverse and should
+ be used with caution.
+
+ A successful response will include a 202 response code and no content. Use the
+ status endpoint to check on the success or failure of the destruction of the
+ individual resources.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :keyword x_dangerous: Acknowledge this action will destroy the Droplet and all associated
+ resources and *can not* be reversed. Required.
+ :paramtype x_dangerous: bool
+ :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_droplets_destroy_with_associated_resources_dangerous_request(
+ droplet_id=droplet_id,
+ x_dangerous=x_dangerous,
+ 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 [202, 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 == 202:
+ 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 get_destroy_associated_resources_status(
+ self, droplet_id: int, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Check Status of a Droplet Destroy with Associated Resources Request.
+
+ To check on the status of a request to destroy a Droplet with its associated
+ resources, send a GET request to the
+ ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/status`` endpoint.
+
+ :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 == {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format indicating when the requested action was
+ completed.
+ "droplet": {
+ "destroyed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format indicating when the resource
+ was destroyed if the request was successful.
+ "error_message": "str", # Optional. A string indicating that the
+ resource was not successfully destroyed and providing additional information.
+ "id": "str", # Optional. The unique identifier for the resource
+ scheduled for deletion.
+ "name": "str" # Optional. The name of the resource scheduled for
+ deletion.
+ },
+ "failures": 0, # Optional. A count of the associated resources that failed
+ to be destroyed, if any.
+ "resources": {
+ "floating_ips": [
+ {
+ "destroyed_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format indicating
+ when the resource was destroyed if the request was successful.
+ "error_message": "str", # Optional. A string
+ indicating that the resource was not successfully destroyed and
+ providing additional information.
+ "id": "str", # Optional. The unique identifier for
+ the resource scheduled for deletion.
+ "name": "str" # Optional. The name of the resource
+ scheduled for deletion.
+ }
+ ],
+ "reserved_ips": [
+ {
+ "destroyed_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format indicating
+ when the resource was destroyed if the request was successful.
+ "error_message": "str", # Optional. A string
+ indicating that the resource was not successfully destroyed and
+ providing additional information.
+ "id": "str", # Optional. The unique identifier for
+ the resource scheduled for deletion.
+ "name": "str" # Optional. The name of the resource
+ scheduled for deletion.
+ }
+ ],
+ "snapshots": [
+ {
+ "destroyed_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format indicating
+ when the resource was destroyed if the request was successful.
+ "error_message": "str", # Optional. A string
+ indicating that the resource was not successfully destroyed and
+ providing additional information.
+ "id": "str", # Optional. The unique identifier for
+ the resource scheduled for deletion.
+ "name": "str" # Optional. The name of the resource
+ scheduled for deletion.
+ }
+ ],
+ "volume_snapshots": [
+ {
+ "destroyed_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format indicating
+ when the resource was destroyed if the request was successful.
+ "error_message": "str", # Optional. A string
+ indicating that the resource was not successfully destroyed and
+ providing additional information.
+ "id": "str", # Optional. The unique identifier for
+ the resource scheduled for deletion.
+ "name": "str" # Optional. The name of the resource
+ scheduled for deletion.
+ }
+ ],
+ "volumes": [
+ {
+ "destroyed_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format indicating
+ when the resource was destroyed if the request was successful.
+ "error_message": "str", # Optional. A string
+ indicating that the resource was not successfully destroyed and
+ providing additional information.
+ "id": "str", # Optional. The unique identifier for
+ the resource scheduled for deletion.
+ "name": "str" # Optional. The name of the resource
+ scheduled for deletion.
+ }
+ ]
+ }
+ }
+ # 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_destroy_associated_resources_status_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 destroy_retry_with_associated_resources(
+ self, droplet_id: int, **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Retry a Droplet Destroy with Associated Resources Request.
+
+ If the status of a request to destroy a Droplet with its associated resources
+ reported any errors, it can be retried by sending a POST request to the
+ ``/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/retry`` endpoint.
+
+ Only one destroy can be active at a time per Droplet. If a retry is issued
+ while another destroy is in progress for the Droplet a 409 status code will
+ be returned. A successful response will include a 202 response code and no
+ content.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :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, 409
+ 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_droplets_destroy_retry_with_associated_resources_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 [202, 404, 409]:
+ 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 == 202:
+ 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 response.status_code == 409:
+ 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_neighbors_ids(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Droplet Neighbors.
+
+ To retrieve a list of all Droplets that are co-located on the same physical
+ hardware, send a GET request to ``/v2/reports/droplet_neighbors_ids``.
+
+ The results will be returned as a JSON object with a key of ``neighbor_ids``.
+ This will be set to an array of arrays. Each array will contain a set of
+ Droplet IDs for Droplets that share a physical server. An empty array
+ indicates that all Droplets associated with your account are located on
+ separate physical hardware.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "neighbor_ids": [
+ [
+ 0 # Optional. An array of arrays. Each array will contain a
+ set of Droplet IDs for Droplets that share a physical server.
+ ]
+ ]
+ }
+ # 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_neighbors_ids_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
+
+
+class DropletActionsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`droplet_actions` attribute.
+ """
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
+ @distributed_trace_async
+ async def list(
+ self, droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Actions for a Droplet.
+
+ To retrieve a list of all actions that have been executed for a Droplet, send
+ a GET request to ``/v2/droplets/$DROPLET_ID/actions``.
+
+ The results will be returned as a JSON object with an ``actions`` key. This will
+ be set to an array filled with ``action`` objects containing the standard
+ ``action`` attributes.
+
+ :param droplet_id: A unique identifier for a Droplet instance. Required.
+ :type droplet_id: int
+ :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.
+ },
+ "actions": [
+ {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "region": {
+ "available": bool, # This is a boolean value that
+ represents whether new Droplets can be created in this region.
+ Required.
+ "features": [
+ "str" # This attribute is set to an array
+ which contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region.
+ This will be a full name that is used in the control panel and other
+ interfaces. Required.
+ "sizes": [
+ "str" # This attribute is set to an array
+ which contains the identifying slugs for the sizes available in
+ this region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used
+ as a unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string
+ that is used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the
+ resource that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource
+ that the action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the action was initiated.
+ "status": "in-progress", # Optional. Default value is
+ "in-progress". The current status of the action. This can be
+ "in-progress", "completed", or "errored". Known values are:
+ "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that
+ the object represents. For example, this could be "transfer" to represent
+ the state of an image transfer action.
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
+ }
+ # 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_droplet_actions_list_request(
+ droplet_id=droplet_id,
+ 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
+
+ @overload
+ async def post(
+ self,
+ droplet_id: int,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Initiate a Droplet Action.
+
+ To initiate an action on a Droplet send a POST request to
+ ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
+
+ .. list-table::
+ :header-rows: 1
+
+ * - Action
+ - Details
+ - Additionally Required Permission
+ * - :code:``enable_backups``
+ - 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.
+ -
+ * - :code:``power_cycle``
+ - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button
+ on a physical machine, it's similar to booting from scratch.
+ -
+ * - :code:``shutdown``
+ - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a
+ graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown``
+ command can fail, this action guarantees that the command is issued, not that it succeeds. The
+ preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout,
+ followed by a ``power_off`` action to ensure the Droplet is off.
+ -
+ * - :code:``power_off``
+ - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used
+ if the ``shutdown`` action is not successful. It is similar to cutting the power on a server
+ and could lead to complications.
+ -
+ * - :code:``power_on``
- Powers on a Droplet.
-
* - :code:``restore``
@@ -169341,88 +172198,1004 @@ async def create(
To create your container registry, send a POST request to ``/v2/registry``.
- The ``name`` becomes part of the URL for images stored in the registry. For
- example, if your registry is called ``example``\\ , an image in it will have the
- URL ``registry.digitalocean.com/example/image:tag``.
+ The ``name`` becomes part of the URL for images stored in the registry. For
+ example, if your registry is called ``example``\\ , an image in it will have the
+ URL ``registry.digitalocean.com/example/image:tag``.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "registry": {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the registry
+ was created.
+ "name": "str", # Optional. A globally unique name for the container
+ registry. Must be lowercase and be composed only of numbers, letters and
+ ``-``"" , up to a limit of 63 characters.
+ "region": "str", # Optional. Slug of the region where registry data
+ is stored.
+ "storage_usage_bytes": 0, # Optional. The amount of storage used in
+ the registry in bytes.
+ "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
+ The time at which the storage usage was updated. Storage usage is calculated
+ asynchronously, and may not immediately reflect pushes to the registry.
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at
+ which the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The
+ amount of outbound data transfer included in the subscription tier in
+ bytes.
+ "included_repositories": 0, # Optional. The number
+ of repositories included in the subscription tier. ``0`` indicates
+ that the subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount
+ of storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly
+ cost of the subscription tier in cents.
+ "name": "str", # Optional. The name of the
+ subscription tier.
+ "slug": "str", # Optional. The slug identifier of
+ the subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The
+ price paid in cents per GiB for additional storage beyond what is
+ included in the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at
+ which the subscription was last updated.
+ }
+ }
+ }
+ """
+
+ @distributed_trace_async
+ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create Container Registry.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To create your container registry, send a POST request to ``/v2/registry``.
+
+ The ``name`` becomes part of the URL for images stored in the registry. For
+ example, if your registry is called ``example``\\ , an image in it will have the
+ URL ``registry.digitalocean.com/example/image:tag``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "name": "str", # A globally unique name for the container registry. Must be
+ lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
+ 63 characters. Required.
+ "subscription_tier_slug": "str", # The slug of the subscription tier to sign
+ up for. Valid values can be retrieved using the options endpoint. Required. Known
+ values are: "starter", "basic", and "professional".
+ "region": "str" # Optional. Slug of the region where registry data is
+ stored. When not provided, a region will be selected. Known values are: "nyc3",
+ "sfo3", "ams3", "sgp1", and "fra1".
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "registry": {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the registry
+ was created.
+ "name": "str", # Optional. A globally unique name for the container
+ registry. Must be lowercase and be composed only of numbers, letters and
+ ``-``"" , up to a limit of 63 characters.
+ "region": "str", # Optional. Slug of the region where registry data
+ is stored.
+ "storage_usage_bytes": 0, # Optional. The amount of storage used in
+ the registry in bytes.
+ "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
+ The time at which the storage usage was updated. Storage usage is calculated
+ asynchronously, and may not immediately reflect pushes to the registry.
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at
+ which the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The
+ amount of outbound data transfer included in the subscription tier in
+ bytes.
+ "included_repositories": 0, # Optional. The number
+ of repositories included in the subscription tier. ``0`` indicates
+ that the subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount
+ of storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly
+ cost of the subscription tier in cents.
+ "name": "str", # Optional. The name of the
+ subscription tier.
+ "slug": "str", # Optional. The slug identifier of
+ the subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The
+ price paid in cents per GiB for additional storage beyond what is
+ included in the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at
+ which the subscription was last updated.
+ }
+ }
+ }
+ """
+ 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_registry_create_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [201]:
+ 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 = {}
+ 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(self, **kwargs: Any) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete Container Registry.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To delete your container registry, destroying all container image
+ data stored in it, send a DELETE request to ``/v2/registry``.
+
+ This operation is not compatible with multiple registries in a DO account. You should use
+ ``/v2/registries/{registry_name}`` instead.
+
+ :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, 412
+ 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_registry_delete_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 [204, 404, 412]:
+ 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 response.status_code == 412:
+ 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 get_subscription(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Get Subscription.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ A subscription is automatically created when you configure your
+ container registry. To get information about your subscription, send a GET
+ request to ``/v2/registry/subscription``.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ """
+ 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_registry_get_subscription_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]:
+ 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 = {}
+ 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
+
+ @overload
+ async def update_subscription(
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Subscription Tier.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ After creating your registry, you can switch to a different
+ subscription tier to better suit your needs. To do this, send a POST request
+ to ``/v2/registry/subscription``.
+
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
+ for. Known values are: "starter", "basic", and "professional".
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ # response body for status code(s): 412
+ 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.
+ }
+ """
+
+ @overload
+ async def update_subscription(
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Subscription Tier.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ After creating your registry, you can switch to a different
+ subscription tier to better suit your needs. To do this, send a POST request
+ to ``/v2/registry/subscription``.
+
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ # response body for status code(s): 412
+ 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.
+ }
+ """
+
+ @distributed_trace_async
+ async def update_subscription(
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Subscription Tier.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ After creating your registry, you can switch to a different
+ subscription tier to better suit your needs. To do this, send a POST request
+ to ``/v2/registry/subscription``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
+ for. Known values are: "starter", "basic", and "professional".
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ # response body for status code(s): 412
+ 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_registry_update_subscription_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, 412]:
+ 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 == 412:
+ 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 get_docker_credentials(
+ self, *, expiry_seconds: int = 0, read_write: bool = False, **kwargs: Any
+ ) -> JSON:
+ """Get Docker Credentials for Container Registry.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ In order to access your container registry with the Docker client or from a
+ Kubernetes cluster, you will need to configure authentication. The necessary
+ JSON configuration can be retrieved by sending a GET request to
+ ``/v2/registry/docker-credentials``.
+
+ The response will be in the format of a Docker ``config.json`` file. To use the
+ config in your Kubernetes cluster, create a Secret with:
+
+ .. code-block::
+
+ kubectl create secret generic docr \\
+ --from-file=.dockerconfigjson=config.json \\
+ --type=kubernetes.io/dockerconfigjson
+
+
+ By default, the returned credentials have read-only access to your registry
+ and cannot be used to push images. This is appropriate for most Kubernetes
+ clusters. To retrieve read/write credentials, suitable for use with the Docker
+ client or in a CI system, read_write may be provided as query parameter. For
+ example: ``/v2/registry/docker-credentials?read_write=true``
+
+ By default, the returned credentials will not expire. To retrieve credentials
+ with an expiry set, expiry_seconds may be provided as a query parameter. For
+ example: ``/v2/registry/docker-credentials?expiry_seconds=3600`` will return
+ credentials that expire after one hour.
+
+ :keyword expiry_seconds: The duration in seconds that the returned registry credentials will be
+ valid. If not set or 0, the credentials will not expire. Default value is 0.
+ :paramtype expiry_seconds: int
+ :keyword read_write: By default, the registry credentials allow for read-only access. Set this
+ query parameter to ``true`` to obtain read-write credentials. Default value is False.
+ :paramtype read_write: bool
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "auths": {
+ "registry.digitalocean.com": {
+ "auth": "str" # Optional. A base64 encoded string containing
+ credentials for the container registry.
+ }
+ }
+ }
+ """
+ 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_registry_get_docker_credentials_request(
+ expiry_seconds=expiry_seconds,
+ read_write=read_write,
+ 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]:
+ 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 = {}
+ 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
+
+ @overload
+ async def validate_name(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Validate a Container Registry Name.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To validate that a container registry name is available for use, send a POST
+ request to ``/v2/registry/validate-name``.
+
+ If the name is both formatted correctly and available, the response code will
+ be 204 and contain no body. If the name is already in use, the response will
+ be a 409 Conflict.
+
+ :param body: Required.
+ :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: JSON object or None
+ :rtype: JSON or None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "name": "str" # A globally unique name for the container registry. Must be
+ lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
+ 63 characters. Required.
+ }
+
+ # response body for status code(s): 409
+ 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.
+ }
+ """
+
+ @overload
+ async def validate_name(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Validate a Container Registry Name.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To validate that a container registry name is available for use, send a POST
+ request to ``/v2/registry/validate-name``.
+
+ If the name is both formatted correctly and available, the response code will
+ be 204 and contain no body. If the name is already in use, the response will
+ be a 409 Conflict.
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 409
response == {
- "registry": {
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the registry
- was created.
- "name": "str", # Optional. A globally unique name for the container
- registry. Must be lowercase and be composed only of numbers, letters and
- ``-``"" , up to a limit of 63 characters.
- "region": "str", # Optional. Slug of the region where registry data
- is stored.
- "storage_usage_bytes": 0, # Optional. The amount of storage used in
- the registry in bytes.
- "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
- The time at which the storage usage was updated. Storage usage is calculated
- asynchronously, and may not immediately reflect pushes to the registry.
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at
- which the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The
- amount of outbound data transfer included in the subscription tier in
- bytes.
- "included_repositories": 0, # Optional. The number
- of repositories included in the subscription tier. ``0`` indicates
- that the subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount
- of storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly
- cost of the subscription tier in cents.
- "name": "str", # Optional. The name of the
- subscription tier.
- "slug": "str", # Optional. The slug identifier of
- the subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The
- price paid in cents per GiB for additional storage beyond what is
- included in the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at
- which the subscription was last updated.
- }
- }
+ "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.
}
"""
@distributed_trace_async
- async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ async def validate_name(
+ self, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create Container Registry.
+ """Validate a Container Registry Name.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To create your container registry, send a POST request to ``/v2/registry``.
+ To validate that a container registry name is available for use, send a POST
+ request to ``/v2/registry/validate-name``.
- The ``name`` becomes part of the URL for images stored in the registry. For
- example, if your registry is called ``example``\\ , an image in it will have the
- URL ``registry.digitalocean.com/example/image:tag``.
+ If the name is both formatted correctly and available, the response code will
+ be 204 and contain no body. If the name is already in use, the response will
+ be a 409 Conflict.
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -169430,63 +173203,21 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A globally unique name for the container registry. Must be
+ "name": "str" # A globally unique name for the container registry. Must be
lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
63 characters. Required.
- "subscription_tier_slug": "str", # The slug of the subscription tier to sign
- up for. Valid values can be retrieved using the options endpoint. Required. Known
- values are: "starter", "basic", and "professional".
- "region": "str" # Optional. Slug of the region where registry data is
- stored. When not provided, a region will be selected. Known values are: "nyc3",
- "sfo3", "ams3", "sgp1", and "fra1".
}
- # response body for status code(s): 201
+ # response body for status code(s): 409
response == {
- "registry": {
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the registry
- was created.
- "name": "str", # Optional. A globally unique name for the container
- registry. Must be lowercase and be composed only of numbers, letters and
- ``-``"" , up to a limit of 63 characters.
- "region": "str", # Optional. Slug of the region where registry data
- is stored.
- "storage_usage_bytes": 0, # Optional. The amount of storage used in
- the registry in bytes.
- "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
- The time at which the storage usage was updated. Storage usage is calculated
- asynchronously, and may not immediately reflect pushes to the registry.
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at
- which the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The
- amount of outbound data transfer included in the subscription tier in
- bytes.
- "included_repositories": 0, # Optional. The number
- of repositories included in the subscription tier. ``0`` indicates
- that the subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount
- of storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly
- cost of the subscription tier in cents.
- "name": "str", # Optional. The name of the
- subscription tier.
- "slug": "str", # Optional. The slug identifier of
- the subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The
- price paid in cents per GiB for additional storage beyond what is
- included in the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at
- which the subscription was last updated.
- }
- }
+ "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]] = {
@@ -169508,7 +173239,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -169518,7 +173249,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_registry_create_request(
+ _request = build_registry_validate_name_request(
content_type=content_type,
json=_json,
content=_content,
@@ -169536,54 +173267,109 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [201]:
+ if response.status_code not in [204, 409]:
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 = {}
- 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 == 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.content:
- deserialized = response.json()
- else:
- deserialized = None
+ if response.status_code == 409:
+ 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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete(self, **kwargs: Any) -> Optional[JSON]:
+ async def list_repositories(
+ self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete Container Registry.
+ """List All Container Registry Repositories.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To delete your container registry, destroying all container image
- data stored in it, send a DELETE request to ``/v2/registry``.
+ This endpoint has been deprecated in favor of the *List All Container Registry Repositories
+ [V2]* endpoint.
- This operation is not compatible with multiple registries in a DO account. You should use
- ``/v2/registries/{registry_name}`` instead.
+ To list all repositories in your container registry, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositories``.
- :return: JSON object or None
- :rtype: JSON or None
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :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): 404, 412
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "repositories": [
+ {
+ "latest_tag": {
+ "compressed_size_bytes": 0, # Optional. The
+ compressed size of the tag in bytes.
+ "manifest_digest": "str", # Optional. The digest of
+ the manifest associated with the tag.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the
+ repository.
+ "size_bytes": 0, # Optional. The uncompressed size
+ of the tag in bytes (this size is calculated asynchronously so it may
+ not be immediately available).
+ "tag": "str", # Optional. The name of the tag.
+ "updated_at": "2020-02-20 00:00:00" # Optional. The
+ time the tag was last updated.
+ },
+ "name": "str", # Optional. The name of the repository.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "tag_count": 0 # Optional. The number of tags in the
+ repository.
+ }
+ ]
+ }
+ # 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
@@ -169611,9 +173397,12 @@ async def delete(self, **kwargs: Any) -> Optional[JSON]:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_delete_request(
+ _request = build_registry_list_repositories_request(
+ registry_name=registry_name,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -169628,26 +173417,14 @@ async def delete(self, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404, 412]:
+ 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)
- 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:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -169663,7 +173440,7 @@ async def delete(self, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
- if response.status_code == 412:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -169680,21 +173457,38 @@ async def delete(self, **kwargs: Any) -> Optional[JSON]:
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get_subscription(self, **kwargs: Any) -> JSON:
+ async def list_repositories_v2(
+ self,
+ registry_name: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ page_token: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Get Subscription.
+ """List All Container Registry Repositories (V2).
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- A subscription is automatically created when you configure your
- container registry. To get information about your subscription, send a GET
- request to ``/v2/registry/subscription``.
+ To list all repositories in your container registry, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositoriesV2``.
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :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. Ignored when 'page_token' is
+ provided. Default value is 1.
+ :paramtype page: int
+ :keyword page_token: Token to retrieve of the next or previous set of results more quickly than
+ using 'page'. Default value is None.
+ :paramtype page_token: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -169704,34 +173498,60 @@ async def get_subscription(self, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "repositories": [
+ {
+ "latest_manifest": {
+ "blobs": [
+ {
+ "compressed_size_bytes": 0, #
+ Optional. The compressed size of the blob in bytes.
+ "digest": "str" # Optional. The
+ digest of the blob.
+ }
+ ],
+ "compressed_size_bytes": 0, # Optional. The
+ compressed size of the manifest in bytes.
+ "digest": "str", # Optional. The manifest digest.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the
+ repository.
+ "size_bytes": 0, # Optional. The uncompressed size
+ of the manifest in bytes (this size is calculated asynchronously so
+ it may not be immediately available).
+ "tags": [
+ "str" # Optional. All tags associated with
+ this manifest.
+ ],
+ "updated_at": "2020-02-20 00:00:00" # Optional. The
+ time the manifest was last updated.
+ },
+ "manifest_count": 0, # Optional. The number of manifests in
+ the repository.
+ "name": "str", # Optional. The name of the repository.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "tag_count": 0 # Optional. The number of tags in the
+ repository.
+ }
+ ]
+ }
+ # response body for status code(s): 400, 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]] = {
@@ -169752,7 +173572,11 @@ async def get_subscription(self, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_get_subscription_request(
+ _request = build_registry_list_repositories_v2_request(
+ registry_name=registry_name,
+ per_page=per_page,
+ page=page,
+ page_token=page_token,
headers=_headers,
params=_params,
)
@@ -169767,55 +173591,98 @@ async def get_subscription(self, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ if response.status_code not in [200, 400, 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 = {}
- 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 == 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ 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
- @overload
- async def update_subscription(
+ @distributed_trace_async
+ async def list_repository_tags(
self,
- body: Optional[JSON] = None,
+ registry_name: str,
+ repository_name: str,
*,
- content_type: str = "application/json",
+ per_page: int = 20,
+ page: int = 1,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update Subscription Tier.
+ """List All Container Registry Repository Tags.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- After creating your registry, you can switch to a different
- subscription tier to better suit your needs. To do this, send a POST request
- to ``/v2/registry/subscription``.
+ To list all tags in your container registry repository, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags``.
- :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
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to list tags for
+ ``registry.digitalocean.com/example/my/repo``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/tags``.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :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:
@@ -169823,44 +173690,33 @@ async def update_subscription(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
- for. Known values are: "starter", "basic", and "professional".
- }
-
# response body for status code(s): 200
response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "tags": [
+ {
+ "compressed_size_bytes": 0, # Optional. The compressed size
+ of the tag in bytes.
+ "manifest_digest": "str", # Optional. The digest of the
+ manifest associated with the tag.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the repository.
+ "size_bytes": 0, # Optional. The uncompressed size of the
+ tag in bytes (this size is calculated asynchronously so it may not be
+ immediately available).
+ "tag": "str", # Optional. The name of the tag.
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time the
+ tag was last updated.
+ }
+ ]
}
- # response body for status code(s): 412
+ # 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
@@ -169872,68 +173728,126 @@ async def update_subscription(
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 {})
- @overload
- async def update_subscription(
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_registry_list_repository_tags_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ 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 delete_repository_tag(
self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
+ registry_name: str,
+ repository_name: str,
+ repository_tag: str,
**kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Update Subscription Tier.
+ """Delete Container Registry Repository Tag.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- After creating your registry, you can switch to a different
- subscription tier to better suit your needs. To do this, send a POST request
- to ``/v2/registry/subscription``.
+ To delete a container repository tag, send a DELETE request to
+ ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags/$TAG``.
- :param body: Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to delete
+ ``registry.digitalocean.com/example/my/repo:mytag``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/tags/mytag``.
+
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :param repository_tag: The name of a container registry repository tag. Required.
+ :type repository_tag: 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): 200
- response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
- }
- # response body for status code(s): 412
+ # 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
@@ -169945,22 +173859,114 @@ async def update_subscription(
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_registry_delete_repository_tag_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ repository_tag=repository_tag,
+ 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 update_subscription(
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ async def list_repository_manifests(
+ self,
+ registry_name: str,
+ repository_name: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update Subscription Tier.
+ """List All Container Registry Repository Manifests.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- After creating your registry, you can switch to a different
- subscription tier to better suit your needs. To do this, send a POST request
- to ``/v2/registry/subscription``.
+ To list all manifests in your container registry repository, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests``.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to list manifests for
+ ``registry.digitalocean.com/example/my/repo``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/digests``.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :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:
@@ -169968,44 +173974,43 @@ async def update_subscription(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
- for. Known values are: "starter", "basic", and "professional".
- }
-
# response body for status code(s): 200
response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "manifests": [
+ {
+ "blobs": [
+ {
+ "compressed_size_bytes": 0, # Optional. The
+ compressed size of the blob in bytes.
+ "digest": "str" # Optional. The digest of
+ the blob.
+ }
+ ],
+ "compressed_size_bytes": 0, # Optional. The compressed size
+ of the manifest in bytes.
+ "digest": "str", # Optional. The manifest digest.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the repository.
+ "size_bytes": 0, # Optional. The uncompressed size of the
+ manifest in bytes (this size is calculated asynchronously so it may not
+ be immediately available).
+ "tags": [
+ "str" # Optional. All tags associated with this
+ manifest.
+ ],
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time the
+ manifest was last updated.
+ }
+ ]
}
- # response body for status code(s): 412
+ # 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
@@ -170030,29 +174035,16 @@ async def update_subscription(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- content_type: Optional[str] = kwargs.pop(
- "content_type", _headers.pop("Content-Type", None)
- )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- content_type = content_type or "application/json"
- _json = None
- _content = None
- if isinstance(body, (IOBase, bytes)):
- _content = body
- else:
- if body is not None:
- _json = body
- else:
- _json = None
-
- _request = build_registry_update_subscription_request(
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_registry_list_repository_manifests_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -170067,7 +174059,7 @@ async def update_subscription(
response = pipeline_response.http_response
- if response.status_code not in [200, 412]:
+ 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
@@ -170090,7 +174082,7 @@ async def update_subscription(
else:
deserialized = None
- if response.status_code == 412:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -170112,60 +174104,53 @@ async def update_subscription(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get_docker_credentials(
- self, *, expiry_seconds: int = 0, read_write: bool = False, **kwargs: Any
- ) -> JSON:
- """Get Docker Credentials for Container Registry.
+ async def delete_repository_manifest(
+ self,
+ registry_name: str,
+ repository_name: str,
+ manifest_digest: str,
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete Container Registry Repository Manifest.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- In order to access your container registry with the Docker client or from a
- Kubernetes cluster, you will need to configure authentication. The necessary
- JSON configuration can be retrieved by sending a GET request to
- ``/v2/registry/docker-credentials``.
-
- The response will be in the format of a Docker ``config.json`` file. To use the
- config in your Kubernetes cluster, create a Secret with:
-
- .. code-block::
-
- kubectl create secret generic docr \\
- --from-file=.dockerconfigjson=config.json \\
- --type=kubernetes.io/dockerconfigjson
-
+ To delete a container repository manifest by digest, send a DELETE request to
+ ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests/$MANIFEST_DIGEST``.
- By default, the returned credentials have read-only access to your registry
- and cannot be used to push images. This is appropriate for most Kubernetes
- clusters. To retrieve read/write credentials, suitable for use with the Docker
- client or in a CI system, read_write may be provided as query parameter. For
- example: ``/v2/registry/docker-credentials?read_write=true``
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to delete
+ ``registry.digitalocean.com/example/my/repo@sha256:abcd``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/digests/sha256:abcd``.
- By default, the returned credentials will not expire. To retrieve credentials
- with an expiry set, expiry_seconds may be provided as a query parameter. For
- example: ``/v2/registry/docker-credentials?expiry_seconds=3600`` will return
- credentials that expire after one hour.
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
- :keyword expiry_seconds: The duration in seconds that the returned registry credentials will be
- valid. If not set or 0, the credentials will not expire. Default value is 0.
- :paramtype expiry_seconds: int
- :keyword read_write: By default, the registry credentials allow for read-only access. Set this
- query parameter to ``true`` to obtain read-write credentials. Default value is False.
- :paramtype read_write: bool
- :return: JSON object
- :rtype: JSON
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :param manifest_digest: The manifest digest of a container registry repository tag. Required.
+ :type manifest_digest: 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): 200
+ # response body for status code(s): 404
response == {
- "auths": {
- "registry.digitalocean.com": {
- "auth": "str" # Optional. A base64 encoded string containing
- credentials for the container registry.
- }
- }
+ "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]] = {
@@ -170184,11 +174169,12 @@ async def get_docker_credentials(
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_registry_get_docker_credentials_request(
- expiry_seconds=expiry_seconds,
- read_write=read_write,
+ _request = build_registry_delete_repository_manifest_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ manifest_digest=manifest_digest,
headers=_headers,
params=_params,
)
@@ -170203,56 +174189,93 @@ async def get_docker_credentials(
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@overload
- async def validate_name(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
- ) -> Optional[JSON]:
+ async def run_garbage_collection(
+ self,
+ registry_name: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Validate a Container Registry Name.
+ """Start Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To validate that a container registry name is available for use, send a POST
- request to ``/v2/registry/validate-name``.
+ Garbage collection enables users to clear out unreferenced blobs (layer &
+ manifest data) after deleting one or more manifests from a repository. If
+ there are no unreferenced blobs resulting from the deletion of one or more
+ manifests, garbage collection is effectively a noop.
+ `See here for more information
+ `_
+ about how and why you should clean up your container registry periodically.
- If the name is both formatted correctly and available, the response code will
- be 204 and contain no body. If the name is already in use, the response will
- be a 409 Conflict.
+ To request a garbage collection run on your registry, send a POST request to
+ ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
+ following sequence of events on your registry.
- :param body: Required.
+
+ * Set the registry to read-only mode, meaning no further write-scoped
+ JWTs will be issued to registry clients. Existing write-scoped JWTs will
+ continue to work until they expire which can take up to 15 minutes.
+ * Wait until all existing write-scoped JWTs have expired.
+ * Scan all registry manifests to determine which blobs are unreferenced.
+ * Delete all unreferenced blobs from the registry.
+ * Record the number of blobs deleted and bytes freed, mark the garbage
+ collection status as ``success``.
+ * Remove the read-only mode restriction from the registry, meaning write-scoped
+ JWTs will once again be issued to registry clients.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :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: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -170260,12 +174283,33 @@ async def validate_name(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str" # A globally unique name for the container registry. Must be
- lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
- 63 characters. Required.
+ "type": "str" # Optional. Type of the garbage collection to run against this
+ registry. Known values are: "untagged manifests only", "unreferenced blobs only",
+ and "untagged manifests and unreferenced blobs".
}
- # response body for status code(s): 409
+ # response body for status code(s): 201
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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
@@ -170279,34 +174323,79 @@ async def validate_name(
"""
@overload
- async def validate_name(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
- ) -> Optional[JSON]:
+ async def run_garbage_collection(
+ self,
+ registry_name: str,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Validate a Container Registry Name.
+ """Start Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To validate that a container registry name is available for use, send a POST
- request to ``/v2/registry/validate-name``.
+ Garbage collection enables users to clear out unreferenced blobs (layer &
+ manifest data) after deleting one or more manifests from a repository. If
+ there are no unreferenced blobs resulting from the deletion of one or more
+ manifests, garbage collection is effectively a noop.
+ `See here for more information
+ `_
+ about how and why you should clean up your container registry periodically.
- If the name is both formatted correctly and available, the response code will
- be 204 and contain no body. If the name is already in use, the response will
- be a 409 Conflict.
+ To request a garbage collection run on your registry, send a POST request to
+ ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
+ following sequence of events on your registry.
- :param body: Required.
+
+ * Set the registry to read-only mode, meaning no further write-scoped
+ JWTs will be issued to registry clients. Existing write-scoped JWTs will
+ continue to work until they expire which can take up to 15 minutes.
+ * Wait until all existing write-scoped JWTs have expired.
+ * Scan all registry manifests to determine which blobs are unreferenced.
+ * Delete all unreferenced blobs from the registry.
+ * Record the number of blobs deleted and bytes freed, mark the garbage
+ collection status as ``success``.
+ * Remove the read-only mode restriction from the registry, meaning write-scoped
+ JWTs will once again be issued to registry clients.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param body: Default value is None.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 409
+ # response body for status code(s): 201
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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
@@ -170320,25 +174409,47 @@ async def validate_name(
"""
@distributed_trace_async
- async def validate_name(
- self, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
+ async def run_garbage_collection(
+ self,
+ registry_name: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Validate a Container Registry Name.
+ """Start Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To validate that a container registry name is available for use, send a POST
- request to ``/v2/registry/validate-name``.
+ Garbage collection enables users to clear out unreferenced blobs (layer &
+ manifest data) after deleting one or more manifests from a repository. If
+ there are no unreferenced blobs resulting from the deletion of one or more
+ manifests, garbage collection is effectively a noop.
+ `See here for more information
+ `_
+ about how and why you should clean up your container registry periodically.
- If the name is both formatted correctly and available, the response code will
- be 204 and contain no body. If the name is already in use, the response will
- be a 409 Conflict.
+ To request a garbage collection run on your registry, send a POST request to
+ ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
+ following sequence of events on your registry.
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+
+ * Set the registry to read-only mode, meaning no further write-scoped
+ JWTs will be issued to registry clients. Existing write-scoped JWTs will
+ continue to work until they expire which can take up to 15 minutes.
+ * Wait until all existing write-scoped JWTs have expired.
+ * Scan all registry manifests to determine which blobs are unreferenced.
+ * Delete all unreferenced blobs from the registry.
+ * Record the number of blobs deleted and bytes freed, mark the garbage
+ collection status as ``success``.
+ * Remove the read-only mode restriction from the registry, meaning write-scoped
+ JWTs will once again be issued to registry clients.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
:type body: JSON or IO[bytes]
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -170346,12 +174457,33 @@ async def validate_name(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str" # A globally unique name for the container registry. Must be
- lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
- 63 characters. Required.
+ "type": "str" # Optional. Type of the garbage collection to run against this
+ registry. Known values are: "untagged manifests only", "unreferenced blobs only",
+ and "untagged manifests and unreferenced blobs".
}
- # response body for status code(s): 409
+ # response body for status code(s): 201
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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
@@ -170382,7 +174514,7 @@ async def validate_name(
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -170390,9 +174522,13 @@ async def validate_name(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_registry_validate_name_request(
+ _request = build_registry_run_garbage_collection_request(
+ registry_name=registry_name,
content_type=content_type,
json=_json,
content=_content,
@@ -170410,15 +174546,14 @@ async def validate_name(
response = pipeline_response.http_response
- if response.status_code not in [204, 409]:
+ if response.status_code not in [201, 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:
+ if response.status_code == 201:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -170429,7 +174564,12 @@ async def validate_name(
"int", response.headers.get("ratelimit-reset")
)
- if response.status_code == 409:
+ 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")
)
@@ -170446,31 +174586,22 @@ async def validate_name(
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def list_repositories(
- self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ async def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repositories.
+ """Get Active Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- This endpoint has been deprecated in favor of the *List All Container Registry Repositories
- [V2]* endpoint.
-
- To list all repositories in your container registry, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositories``.
+ To get information about the currently-active garbage collection
+ for a registry, send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collection``.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
- :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:
@@ -170480,37 +174611,24 @@ async def list_repositories(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "repositories": [
- {
- "latest_tag": {
- "compressed_size_bytes": 0, # Optional. The
- compressed size of the tag in bytes.
- "manifest_digest": "str", # Optional. The digest of
- the manifest associated with the tag.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the
- repository.
- "size_bytes": 0, # Optional. The uncompressed size
- of the tag in bytes (this size is calculated asynchronously so it may
- not be immediately available).
- "tag": "str", # Optional. The name of the tag.
- "updated_at": "2020-02-20 00:00:00" # Optional. The
- time the tag was last updated.
- },
- "name": "str", # Optional. The name of the repository.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "tag_count": 0 # Optional. The number of tags in the
- repository.
- }
- ]
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
}
# response body for status code(s): 404
response == {
@@ -170542,10 +174660,8 @@ async def list_repositories(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_repositories_request(
+ _request = build_registry_get_garbage_collection_request(
registry_name=registry_name,
- per_page=per_page,
- page=page,
headers=_headers,
params=_params,
)
@@ -170605,33 +174721,23 @@ async def list_repositories(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def list_repositories_v2(
- self,
- registry_name: str,
- *,
- per_page: int = 20,
- page: int = 1,
- page_token: Optional[str] = None,
- **kwargs: Any
+ async def list_garbage_collections(
+ self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repositories (V2).
+ """List Garbage Collections.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To list all repositories in your container registry, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositoriesV2``.
+ To get information about past garbage collections for a registry,
+ send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collections``.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
: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. Ignored when 'page_token' is
- provided. Default value is 1.
+ :keyword page: Which 'page' of paginated results to return. Default value is 1.
:paramtype page: int
- :keyword page_token: Token to retrieve of the next or previous set of results more quickly than
- using 'page'. Default value is None.
- :paramtype page_token: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -170641,51 +174747,28 @@ async def list_repositories_v2(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "repositories": [
+ "garbage_collections": [
{
- "latest_manifest": {
- "blobs": [
- {
- "compressed_size_bytes": 0, #
- Optional. The compressed size of the blob in bytes.
- "digest": "str" # Optional. The
- digest of the blob.
- }
- ],
- "compressed_size_bytes": 0, # Optional. The
- compressed size of the manifest in bytes.
- "digest": "str", # Optional. The manifest digest.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the
- repository.
- "size_bytes": 0, # Optional. The uncompressed size
- of the manifest in bytes (this size is calculated asynchronously so
- it may not be immediately available).
- "tags": [
- "str" # Optional. All tags associated with
- this manifest.
- ],
- "updated_at": "2020-02-20 00:00:00" # Optional. The
- time the manifest was last updated.
- },
- "manifest_count": 0, # Optional. The number of manifests in
- the repository.
- "name": "str", # Optional. The name of the repository.
+ "blobs_deleted": 0, # Optional. The number of blobs deleted
+ as a result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time
+ the garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a
+ result of this garbage collection.
"registry_name": "str", # Optional. The name of the
container registry.
- "tag_count": 0 # Optional. The number of tags in the
- repository.
+ "status": "str", # Optional. The current status of this
+ garbage collection. Known values are: "requested", "waiting for write
+ JWTs to expire", "scanning manifests", "deleting unreferenced blobs",
+ "cancelling", "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time
+ the garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of
+ the garbage collection.
}
]
}
- # response body for status code(s): 400, 404
+ # 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
@@ -170715,11 +174798,10 @@ async def list_repositories_v2(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_repositories_v2_request(
+ _request = build_registry_list_garbage_collections_request(
registry_name=registry_name,
per_page=per_page,
page=page,
- page_token=page_token,
headers=_headers,
params=_params,
)
@@ -170734,7 +174816,7 @@ async def list_repositories_v2(
response = pipeline_response.http_response
- if response.status_code not in [200, 400, 404]:
+ 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
@@ -170757,22 +174839,6 @@ async def list_repositories_v2(
else:
deserialized = None
- if response.status_code == 400:
- 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")
@@ -170794,38 +174860,34 @@ async def list_repositories_v2(
return cast(JSON, deserialized) # type: ignore
- @distributed_trace_async
- async def list_repository_tags(
+ @overload
+ async def update_garbage_collection(
self,
registry_name: str,
- repository_name: str,
+ garbage_collection_uuid: str,
+ body: JSON,
*,
- per_page: int = 20,
- page: int = 1,
+ content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repository Tags.
+ """Update Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To list all tags in your container registry repository, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags``.
-
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to list tags for
- ``registry.digitalocean.com/example/my/repo``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/tags``.
+ To cancel the currently-active garbage collection for a registry,
+ send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
+ and specify one or more of the attributes below.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :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
+ :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
+ :type garbage_collection_uuid: str
+ :param body: Required.
+ :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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -170833,31 +174895,32 @@ async def list_repository_tags(
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cancel": bool # Optional. A boolean value indicating that the garbage
+ collection should be cancelled.
+ }
+
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "tags": [
- {
- "compressed_size_bytes": 0, # Optional. The compressed size
- of the tag in bytes.
- "manifest_digest": "str", # Optional. The digest of the
- manifest associated with the tag.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the repository.
- "size_bytes": 0, # Optional. The uncompressed size of the
- tag in bytes (this size is calculated asynchronously so it may not be
- immediately available).
- "tag": "str", # Optional. The name of the tag.
- "updated_at": "2020-02-20 00:00:00" # Optional. The time the
- tag was last updated.
- }
- ]
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
}
# response body for status code(s): 404
response == {
@@ -170871,125 +174934,133 @@ async def list_repository_tags(
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_registry_list_repository_tags_request(
- registry_name=registry_name,
- repository_name=repository_name,
- 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")
- )
+ @overload
+ async def update_garbage_collection(
+ self,
+ registry_name: str,
+ garbage_collection_uuid: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Garbage Collection.
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- 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")
- )
+ To cancel the currently-active garbage collection for a registry,
+ send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
+ and specify one or more of the attributes below.
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
+ :type garbage_collection_uuid: str
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
- if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ Example:
+ .. code-block:: python
- return cast(JSON, deserialized) # type: ignore
+ # response body for status code(s): 200
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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.
+ }
+ """
@distributed_trace_async
- async def delete_repository_tag(
+ async def update_garbage_collection(
self,
registry_name: str,
- repository_name: str,
- repository_tag: str,
+ garbage_collection_uuid: str,
+ body: Union[JSON, IO[bytes]],
**kwargs: Any
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete Container Registry Repository Tag.
+ """Update Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To delete a container repository tag, send a DELETE request to
- ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags/$TAG``.
-
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to delete
- ``registry.digitalocean.com/example/my/repo:mytag``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/tags/mytag``.
-
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ To cancel the currently-active garbage collection for a registry,
+ send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
+ and specify one or more of the attributes below.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :param repository_tag: The name of a container registry repository tag. Required.
- :type repository_tag: str
- :return: JSON object or None
- :rtype: JSON or None
+ :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
+ :type garbage_collection_uuid: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cancel": bool # Optional. A boolean value indicating that the garbage
+ collection should be cancelled.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -171015,15 +175086,28 @@ async def delete_repository_tag(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_delete_repository_tag_request(
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_registry_update_garbage_collection_request(
registry_name=registry_name,
- repository_name=repository_name,
- repository_tag=repository_tag,
+ garbage_collection_uuid=garbage_collection_uuid,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -171038,15 +175122,14 @@ async def delete_repository_tag(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ 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)
- deserialized = None
response_headers = {}
- if response.status_code == 204:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -171057,6 +175140,11 @@ async def delete_repository_tag(
"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")
@@ -171074,42 +175162,32 @@ async def delete_repository_tag(
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def list_repository_manifests(
- self,
- registry_name: str,
- repository_name: str,
- *,
- per_page: int = 20,
- page: int = 1,
- **kwargs: Any
- ) -> JSON:
+ async def get_options(self, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repository Manifests.
+ """List Registry Options (Subscription Tiers and Available Regions).
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ **Note: This endpoint is deprecated and may be removed in a future version. There is no
+ alternative.****\\ Note: This endpoint is deprecated. Please use the ``/v2/registries``
+ endpoint instead.**
- To list all manifests in your container registry repository, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests``.
+ This endpoint serves to provide additional information as to which option values
+ are available when creating a container registry.
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to list manifests for
- ``registry.digitalocean.com/example/my/repo``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/digests``.
+ There are multiple subscription tiers available for container registry. Each
+ tier allows a different number of image repositories to be created in your
+ registry, and has a different amount of storage and transfer included.
+
+ There are multiple regions available for container registry and controls
+ where your data is stored.
+
+ To list the available options, send a GET request to
+ ``/v2/registry/options``.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :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:
@@ -171119,50 +175197,43 @@ async def list_repository_manifests(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "manifests": [
- {
- "blobs": [
- {
- "compressed_size_bytes": 0, # Optional. The
- compressed size of the blob in bytes.
- "digest": "str" # Optional. The digest of
- the blob.
- }
- ],
- "compressed_size_bytes": 0, # Optional. The compressed size
- of the manifest in bytes.
- "digest": "str", # Optional. The manifest digest.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the repository.
- "size_bytes": 0, # Optional. The uncompressed size of the
- manifest in bytes (this size is calculated asynchronously so it may not
- be immediately available).
- "tags": [
- "str" # Optional. All tags associated with this
- manifest.
- ],
- "updated_at": "2020-02-20 00:00:00" # Optional. The time the
- manifest was last updated.
- }
- ]
- }
- # 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.
+ "options": {
+ "available_regions": [
+ "str" # Optional.
+ ],
+ "subscription_tiers": [
+ {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "eligibility_reasons": [
+ "str" # Optional. If your account is not
+ eligible to use a certain subscription tier, this will include a
+ list of reasons that prevent you from using the tier.
+ ],
+ "eligible": bool, # Optional. A boolean indicating
+ whether your account it eligible to use a certain subscription tier.
+ "included_bandwidth_bytes": 0, # Optional. The
+ amount of outbound data transfer included in the subscription tier in
+ bytes.
+ "included_repositories": 0, # Optional. The number
+ of repositories included in the subscription tier. ``0`` indicates
+ that the subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount
+ of storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly
+ cost of the subscription tier in cents.
+ "name": "str", # Optional. The name of the
+ subscription tier.
+ "slug": "str", # Optional. The slug identifier of
+ the subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The
+ price paid in cents per GiB for additional storage beyond what is
+ included in the subscription plan.
+ }
+ ]
+ }
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -171183,11 +175254,7 @@ async def list_repository_manifests(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_repository_manifests_request(
- registry_name=registry_name,
- repository_name=repository_name,
- per_page=per_page,
- page=page,
+ _request = build_registry_get_options_request(
headers=_headers,
params=_params,
)
@@ -171202,98 +175269,112 @@ async def list_repository_manifests(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [200]:
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")
- )
+ 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.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_repository_manifest(
- self,
- registry_name: str,
- repository_name: str,
- manifest_digest: str,
- **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Delete Container Registry Repository Manifest.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+class ReservedIPsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
- To delete a container repository manifest by digest, send a DELETE request to
- ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests/$MANIFEST_DIGEST``.
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`reserved_ips` attribute.
+ """
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to delete
- ``registry.digitalocean.com/example/my/repo@sha256:abcd``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/digests/sha256:abcd``.
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ @distributed_trace_async
+ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Reserved IPs.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :param manifest_digest: The manifest digest of a container registry repository tag. Required.
- :type manifest_digest: str
- :return: JSON object or None
- :rtype: JSON or None
+ To list all of the reserved IPs available on your account, send a GET request to
+ ``/v2/reserved_ips``.
+
+ :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): 404
+ # response body for status code(s): 200
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.
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "reserved_ips": [
+ {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the
+ reserved IP. It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating
+ whether or not the reserved IP has pending actions preventing new ones
+ from being submitted.
+ "project_id": "str", # Optional. The UUID of the project to
+ which the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that
+ represents whether new Droplets can be created in this region.
+ Required.
+ "features": [
+ "str" # This attribute is set to an array
+ which contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region.
+ This will be a full name that is used in the control panel and other
+ interfaces. Required.
+ "sizes": [
+ "str" # This attribute is set to an array
+ which contains the identifying slugs for the sizes available in
+ this region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used
+ as a unique identifier for each region. Required.
+ }
+ }
+ ]
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -171312,12 +175393,11 @@ async def delete_repository_manifest(
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_delete_repository_manifest_request(
- registry_name=registry_name,
- repository_name=repository_name,
- manifest_digest=manifest_digest,
+ _request = build_reserved_ips_list_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -171332,87 +175412,52 @@ async def delete_repository_manifest(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [200]:
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")
- )
+ 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@overload
- async def run_garbage_collection(
- self,
- registry_name: str,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
+ async def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Start Garbage Collection.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """Create a New Reserved IP.
- Garbage collection enables users to clear out unreferenced blobs (layer &
- manifest data) after deleting one or more manifests from a repository. If
- there are no unreferenced blobs resulting from the deletion of one or more
- manifests, garbage collection is effectively a noop.
- `See here for more information
- `_
- about how and why you should clean up your container registry periodically.
+ On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
- To request a garbage collection run on your registry, send a POST request to
- ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
- following sequence of events on your registry.
+ *
+ To create a new reserved IP assigned to a Droplet, send a POST
+ request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- * Set the registry to read-only mode, meaning no further write-scoped
- JWTs will be issued to registry clients. Existing write-scoped JWTs will
- continue to work until they expire which can take up to 15 minutes.
- * Wait until all existing write-scoped JWTs have expired.
- * Scan all registry manifests to determine which blobs are unreferenced.
- * Delete all unreferenced blobs from the registry.
- * Record the number of blobs deleted and bytes freed, mark the garbage
- collection status as ``success``.
- * Remove the read-only mode restriction from the registry, meaning write-scoped
- JWTs will once again be issued to registry clients.
+ *
+ To create a new reserved IP reserved to a region, send a POST request to
+ ``/v2/reserved_ips`` with the ``region`` attribute.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param body: Default value is None.
+ :param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@@ -171425,87 +175470,83 @@ async def run_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "type": "str" # Optional. Type of the garbage collection to run against this
- registry. Known values are: "untagged manifests only", "unreferenced blobs only",
- and "untagged manifests and unreferenced blobs".
- }
+ body = {}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "links": {
+ "actions": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ],
+ "droplets": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ]
+ },
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
}
}
- # 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.
- }
"""
@overload
- async def run_garbage_collection(
- self,
- registry_name: str,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
+ async def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Start Garbage Collection.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """Create a New Reserved IP.
- Garbage collection enables users to clear out unreferenced blobs (layer &
- manifest data) after deleting one or more manifests from a repository. If
- there are no unreferenced blobs resulting from the deletion of one or more
- manifests, garbage collection is effectively a noop.
- `See here for more information
- `_
- about how and why you should clean up your container registry periodically.
+ On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
- To request a garbage collection run on your registry, send a POST request to
- ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
- following sequence of events on your registry.
+ *
+ To create a new reserved IP assigned to a Droplet, send a POST
+ request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- * Set the registry to read-only mode, meaning no further write-scoped
- JWTs will be issued to registry clients. Existing write-scoped JWTs will
- continue to work until they expire which can take up to 15 minutes.
- * Wait until all existing write-scoped JWTs have expired.
- * Scan all registry manifests to determine which blobs are unreferenced.
- * Delete all unreferenced blobs from the registry.
- * Record the number of blobs deleted and bytes freed, mark the garbage
- collection status as ``success``.
- * Remove the read-only mode restriction from the registry, meaning write-scoped
- JWTs will once again be issued to registry clients.
+ *
+ To create a new reserved IP reserved to a region, send a POST request to
+ ``/v2/reserved_ips`` with the ``region`` attribute.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param body: Default value is None.
+ :param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -171517,79 +175558,79 @@ async def run_garbage_collection(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "links": {
+ "actions": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ],
+ "droplets": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ]
+ },
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
}
}
- # 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.
- }
"""
@distributed_trace_async
- async def run_garbage_collection(
- self,
- registry_name: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any
- ) -> JSON:
+ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Start Garbage Collection.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """Create a New Reserved IP.
- Garbage collection enables users to clear out unreferenced blobs (layer &
- manifest data) after deleting one or more manifests from a repository. If
- there are no unreferenced blobs resulting from the deletion of one or more
- manifests, garbage collection is effectively a noop.
- `See here for more information
- `_
- about how and why you should clean up your container registry periodically.
+ On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
- To request a garbage collection run on your registry, send a POST request to
- ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
- following sequence of events on your registry.
+ *
+ To create a new reserved IP assigned to a Droplet, send a POST
+ request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- * Set the registry to read-only mode, meaning no further write-scoped
- JWTs will be issued to registry clients. Existing write-scoped JWTs will
- continue to work until they expire which can take up to 15 minutes.
- * Wait until all existing write-scoped JWTs have expired.
- * Scan all registry manifests to determine which blobs are unreferenced.
- * Delete all unreferenced blobs from the registry.
- * Record the number of blobs deleted and bytes freed, mark the garbage
- collection status as ``success``.
- * Remove the read-only mode restriction from the registry, meaning write-scoped
- JWTs will once again be issued to registry clients.
+ *
+ To create a new reserved IP reserved to a region, send a POST request to
+ ``/v2/reserved_ips`` with the ``region`` attribute.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -171599,44 +175640,62 @@ async def run_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "type": "str" # Optional. Type of the garbage collection to run against this
- registry. Known values are: "untagged manifests only", "unreferenced blobs only",
- and "untagged manifests and unreferenced blobs".
- }
+ body = {}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "links": {
+ "actions": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ],
+ "droplets": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ]
+ },
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
}
}
- # 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,
@@ -171665,13 +175724,9 @@ async def run_garbage_collection(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_registry_run_garbage_collection_request(
- registry_name=registry_name,
+ _request = build_reserved_ips_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -171689,14 +175744,136 @@ async def run_garbage_collection(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ if response.status_code not in [202]:
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 == 201:
+ 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 get(self, reserved_ip: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Existing Reserved IP.
+
+ To show information about a reserved IP, send a GET request to
+ ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
+ }
+ }
+ # 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_reserved_ips_get_request(
+ reserved_ip=reserved_ip,
+ 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")
)
@@ -171734,45 +175911,25 @@ async def run_garbage_collection(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
+ async def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Get Active Garbage Collection.
+ """Delete a Reserved IP.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To delete a reserved IP and remove it from your account, send a DELETE request
+ to ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
- To get information about the currently-active garbage collection
- for a registry, send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collection``.
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :return: JSON object
- :rtype: JSON
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: 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): 200
- response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -171801,10 +175958,10 @@ async def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSO
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_registry_get_garbage_collection_request(
- registry_name=registry_name,
+ _request = build_reserved_ips_delete_request(
+ reserved_ip=reserved_ip,
headers=_headers,
params=_params,
)
@@ -171819,14 +175976,15 @@ async def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSO
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ 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 == 200:
+ if response.status_code == 204:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -171837,11 +175995,6 @@ async def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSO
"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")
@@ -171859,28 +176012,40 @@ async def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSO
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
+
+
+class ReservedIPsActionsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`reserved_ips_actions` attribute.
+ """
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
@distributed_trace_async
- async def list_garbage_collections(
- self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ async def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List Garbage Collections.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """List All Actions for a Reserved IP.
- To get information about past garbage collections for a registry,
- send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collections``.
+ To retrieve all actions that have been executed on a reserved IP, send a GET request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :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
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -171890,26 +176055,56 @@ async def list_garbage_collections(
# response body for status code(s): 200
response == {
- "garbage_collections": [
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "actions": [
{
- "blobs_deleted": 0, # Optional. The number of blobs deleted
- as a result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time
- the garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a
- result of this garbage collection.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "status": "str", # Optional. The current status of this
- garbage collection. Known values are: "requested", "waiting for write
- JWTs to expire", "scanning manifests", "deleting unreferenced blobs",
- "cancelling", "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time
- the garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of
- the garbage collection.
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "region": {
+ "available": bool, # This is a boolean value that
+ represents whether new Droplets can be created in this region.
+ Required.
+ "features": [
+ "str" # This attribute is set to an array
+ which contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region.
+ This will be a full name that is used in the control panel and other
+ interfaces. Required.
+ "sizes": [
+ "str" # This attribute is set to an array
+ which contains the identifying slugs for the sizes available in
+ this region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used
+ as a unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string
+ that is used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the
+ resource that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource
+ that the action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the action was initiated.
+ "status": "in-progress", # Optional. Default value is
+ "in-progress". The current status of the action. This can be
+ "in-progress", "completed", or "errored". Known values are:
+ "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that
+ the object represents. For example, this could be "transfer" to represent
+ the state of an image transfer action.
}
- ]
+ ],
+ "links": {
+ "pages": {}
+ }
}
# response body for status code(s): 404
response == {
@@ -171941,10 +176136,8 @@ async def list_garbage_collections(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_garbage_collections_request(
- registry_name=registry_name,
- per_page=per_page,
- page=page,
+ _request = build_reserved_ips_actions_list_request(
+ reserved_ip=reserved_ip,
headers=_headers,
params=_params,
)
@@ -172004,29 +176197,35 @@ async def list_garbage_collections(
return cast(JSON, deserialized) # type: ignore
@overload
- async def update_garbage_collection(
+ async def post(
self,
- registry_name: str,
- garbage_collection_uuid: str,
- body: JSON,
+ reserved_ip: str,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update Garbage Collection.
+ """Initiate a Reserved IP Action.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To initiate an action on a reserved IP send a POST request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- To cancel the currently-active garbage collection for a registry,
- send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
- and specify one or more of the attributes below.
+ .. list-table::
+ :header-rows: 1
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
- :type garbage_collection_uuid: str
- :param body: Required.
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IP to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IP from a Droplet.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IP. 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".
@@ -172039,30 +176238,51 @@ async def update_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "cancel": bool # Optional. A boolean value indicating that the garbage
- collection should be cancelled.
- }
+ body = {}
- # response body for status code(s): 200
+ # response body for status code(s): 201
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -172079,29 +176299,35 @@ async def update_garbage_collection(
"""
@overload
- async def update_garbage_collection(
+ async def post(
self,
- registry_name: str,
- garbage_collection_uuid: str,
- body: IO[bytes],
+ reserved_ip: str,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update Garbage Collection.
+ """Initiate a Reserved IP Action.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To initiate an action on a reserved IP send a POST request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- To cancel the currently-active garbage collection for a registry,
- send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
- and specify one or more of the attributes below.
+ .. list-table::
+ :header-rows: 1
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
- :type garbage_collection_uuid: str
- :param body: Required.
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IP to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IP from a Droplet.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IP. Default value is None.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -172113,25 +176339,49 @@ async def update_garbage_collection(
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # response body for status code(s): 201
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -172148,27 +176398,34 @@ async def update_garbage_collection(
"""
@distributed_trace_async
- async def update_garbage_collection(
+ async def post(
self,
- registry_name: str,
- garbage_collection_uuid: str,
- body: Union[JSON, IO[bytes]],
+ reserved_ip: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update Garbage Collection.
+ """Initiate a Reserved IP Action.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To initiate an action on a reserved IP send a POST request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- To cancel the currently-active garbage collection for a registry,
- send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
- and specify one or more of the attributes below.
+ .. list-table::
+ :header-rows: 1
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
- :type garbage_collection_uuid: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IP to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IP from a Droplet.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IP. Is either a JSON type or a IO[bytes] type. Default value is
+ None.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -172178,30 +176435,51 @@ async def update_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "cancel": bool # Optional. A boolean value indicating that the garbage
- collection should be cancelled.
- }
+ body = {}
- # response body for status code(s): 200
+ # response body for status code(s): 201
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -172243,11 +176521,13 @@ async def update_garbage_collection(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_registry_update_garbage_collection_request(
- registry_name=registry_name,
- garbage_collection_uuid=garbage_collection_uuid,
+ _request = build_reserved_ips_actions_post_request(
+ reserved_ip=reserved_ip,
content_type=content_type,
json=_json,
content=_content,
@@ -172265,14 +176545,14 @@ async def update_garbage_collection(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [201, 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:
+ if response.status_code == 201:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -172310,27 +176590,18 @@ async def update_garbage_collection(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get_options(self, **kwargs: Any) -> JSON:
+ async def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List Registry Options (Subscription Tiers and Available Regions).
-
- **Note: This endpoint is deprecated and may be removed in a future version. There is no
- alternative.****\\ Note: This endpoint is deprecated. Please use the ``/v2/registries``
- endpoint instead.**
-
- This endpoint serves to provide additional information as to which option values
- are available when creating a container registry.
-
- There are multiple subscription tiers available for container registry. Each
- tier allows a different number of image repositories to be created in your
- registry, and has a different amount of storage and transfer included.
-
- There are multiple regions available for container registry and controls
- where your data is stored.
+ """Retrieve an Existing Reserved IP Action.
- To list the available options, send a GET request to
- ``/v2/registry/options``.
+ To retrieve the status of a reserved IP action, send a GET request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions/$ACTION_ID``.
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param action_id: A unique numeric ID that can be used to identify and reference an action.
+ Required.
+ :type action_id: int
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -172340,44 +176611,60 @@ async def get_options(self, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "options": {
- "available_regions": [
- "str" # Optional.
- ],
- "subscription_tiers": [
- {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "eligibility_reasons": [
- "str" # Optional. If your account is not
- eligible to use a certain subscription tier, this will include a
- list of reasons that prevent you from using the tier.
- ],
- "eligible": bool, # Optional. A boolean indicating
- whether your account it eligible to use a certain subscription tier.
- "included_bandwidth_bytes": 0, # Optional. The
- amount of outbound data transfer included in the subscription tier in
- bytes.
- "included_repositories": 0, # Optional. The number
- of repositories included in the subscription tier. ``0`` indicates
- that the subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount
- of storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly
- cost of the subscription tier in cents.
- "name": "str", # Optional. The name of the
- subscription tier.
- "slug": "str", # Optional. The slug identifier of
- the subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The
- price paid in cents per GiB for additional storage beyond what is
- included in the subscription plan.
- }
- ]
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
+ # 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,
@@ -172397,7 +176684,9 @@ async def get_options(self, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_get_options_request(
+ _request = build_reserved_ips_actions_get_request(
+ reserved_ip=reserved_ip,
+ action_id=action_id,
headers=_headers,
params=_params,
)
@@ -172412,27 +176701,44 @@ async def get_options(self, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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
@@ -172440,14 +176746,14 @@ async def get_options(self, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
-class ReservedIPsOperations:
+class ReservedIPv6Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~pydo.aio.GeneratedClient`'s
- :attr:`reserved_ips` attribute.
+ :attr:`reserved_ipv6` attribute.
"""
def __init__(self, *args, **kwargs) -> None:
@@ -172462,10 +176768,10 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace_async
async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Reserved IPs.
+ """List All Reserved IPv6s.
- To list all of the reserved IPs available on your account, send a GET request to
- ``/v2/reserved_ips``.
+ To list all of the reserved IPv6s available on your account, send a GET request to
+ ``/v2/reserved_ipv6``.
:keyword per_page: Number of items returned per page. Default value is 20.
:paramtype per_page: int
@@ -172486,36 +176792,15 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
"links": {
"pages": {}
},
- "reserved_ips": [
+ "reserved_ipv6s": [
{
"droplet": {},
"ip": "str", # Optional. The public IP address of the
- reserved IP. It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating
- whether or not the reserved IP has pending actions preventing new ones
- from being submitted.
- "project_id": "str", # Optional. The UUID of the project to
- which the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
- Required.
- "features": [
- "str" # This attribute is set to an array
- which contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region.
- This will be a full name that is used in the control panel and other
- interfaces. Required.
- "sizes": [
- "str" # This attribute is set to an array
- which contains the identifying slugs for the sizes available in
- this region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used
- as a unique identifier for each region. Required.
- }
+ reserved IPv6. It also serves as its identifier.
+ "region_slug": "str", # Optional. The region that the
+ reserved IPv6 is reserved to. When you query a reserved IPv6,the
+ region_slug will be returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
]
}
@@ -172538,7 +176823,7 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ips_list_request(
+ _request = build_reserved_ipv6_list_request(
per_page=per_page,
page=page,
headers=_headers,
@@ -172587,18 +176872,13 @@ async def create(
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IP.
-
- On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
+ """Create a New Reserved IPv6.
+ On creation, a reserved IPv6 must be reserved to a region.
- *
- To create a new reserved IP assigned to a Droplet, send a POST
- request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- *
- To create a new reserved IP reserved to a region, send a POST request to
- ``/v2/reserved_ips`` with the ``region`` attribute.
+ * To create a new reserved IPv6 reserved to a region, send a POST request to
+ ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
:param body: Required.
:type body: JSON
@@ -172613,60 +176893,20 @@ async def create(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
+ body = {
+ "region_slug": "str" # The slug identifier for the region the reserved IPv6
+ will be reserved to. Required.
+ }
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "links": {
- "actions": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ],
- "droplets": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ]
- },
- "reserved_ip": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "reserved_ipv6": {
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
}
"""
@@ -172676,18 +176916,13 @@ async def create(
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IP.
-
- On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
+ """Create a New Reserved IPv6.
+ On creation, a reserved IPv6 must be reserved to a region.
- *
- To create a new reserved IP assigned to a Droplet, send a POST
- request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- *
- To create a new reserved IP reserved to a region, send a POST request to
- ``/v2/reserved_ips`` with the ``region`` attribute.
+ * To create a new reserved IPv6 reserved to a region, send a POST request to
+ ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
:param body: Required.
:type body: IO[bytes]
@@ -172701,58 +176936,15 @@ async def create(
Example:
.. code-block:: python
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "links": {
- "actions": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ],
- "droplets": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ]
- },
- "reserved_ip": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "reserved_ipv6": {
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
}
"""
@@ -172760,18 +176952,13 @@ async def create(
@distributed_trace_async
async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IP.
-
- On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
+ """Create a New Reserved IPv6.
+ On creation, a reserved IPv6 must be reserved to a region.
- *
- To create a new reserved IP assigned to a Droplet, send a POST
- request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- *
- To create a new reserved IP reserved to a region, send a POST request to
- ``/v2/reserved_ips`` with the ``region`` attribute.
+ * To create a new reserved IPv6 reserved to a region, send a POST request to
+ ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
@@ -172783,60 +176970,20 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
+ body = {
+ "region_slug": "str" # The slug identifier for the region the reserved IPv6
+ will be reserved to. Required.
+ }
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "links": {
- "actions": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ],
- "droplets": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ]
- },
- "reserved_ip": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "reserved_ipv6": {
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
}
"""
@@ -172869,7 +177016,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_reserved_ips_create_request(
+ _request = build_reserved_ipv6_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -172887,7 +177034,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [202]:
+ if response.status_code not in [201]:
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
@@ -172915,15 +177062,15 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
+ async def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Reserved IP.
+ """Retrieve an Existing Reserved IPv6.
- To show information about a reserved IP, send a GET request to
- ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
+ To show information about a reserved IPv6, send a GET request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6``.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -172933,34 +177080,15 @@ async def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "reserved_ip": {
+ "reserved_ipv6": {
"droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional. The date and time
+ when the reserved IPv6 was reserved.
}
}
# response body for status code(s): 404
@@ -172993,8 +177121,8 @@ async def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ips_get_request(
- reserved_ip=reserved_ip,
+ _request = build_reserved_ipv6_get_request(
+ reserved_ipv6=reserved_ipv6,
headers=_headers,
params=_params,
)
@@ -173054,18 +177182,18 @@ async def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
+ async def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Delete a Reserved IP.
+ """Delete a Reserved IPv6.
To delete a reserved IP and remove it from your account, send a DELETE request
- to ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
+ to ``/v2/reserved_ipv6/$RESERVED_IPV6``.
A successful request will receive a 204 status code with no body in response.
This indicates that the request was processed successfully.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -173073,7 +177201,7 @@ async def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
Example:
.. code-block:: python
- # response body for status code(s): 404
+ # response body for status code(s): 404, 422
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
@@ -173103,8 +177231,8 @@ async def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_reserved_ips_delete_request(
- reserved_ip=reserved_ip,
+ _request = build_reserved_ipv6_delete_request(
+ reserved_ipv6=reserved_ipv6,
headers=_headers,
params=_params,
)
@@ -173119,7 +177247,7 @@ async def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [204, 404, 422]:
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
@@ -173154,20 +177282,36 @@ async def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
+ if response.status_code == 422:
+ 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 ReservedIPsActionsOperations:
+class ReservedIPv6ActionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~pydo.aio.GeneratedClient`'s
- :attr:`reserved_ips_actions` attribute.
+ :attr:`reserved_ipv6_actions` attribute.
"""
def __init__(self, *args, **kwargs) -> None:
@@ -173179,16 +177323,40 @@ def __init__(self, *args, **kwargs) -> None:
input_args.pop(0) if input_args else kwargs.pop("deserializer")
)
- @distributed_trace_async
- async def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
+ @overload
+ async def post(
+ self,
+ reserved_ipv6: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """List All Actions for a Reserved IP.
+ """Initiate a Reserved IPv6 Action.
- To retrieve all actions that have been executed on a reserved IP, send a GET request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``.
+ To initiate an action on a reserved IPv6 send a POST request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ .. list-table::
+ :header-rows: 1
+
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IPv6 to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IPv6 from a Droplet.
+
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IPv6. 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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -173196,57 +177364,50 @@ async def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
+ # response body for status code(s): 201
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "actions": [
- {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
- Required.
- "features": [
- "str" # This attribute is set to an array
- which contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region.
- This will be a full name that is used in the control panel and other
- interfaces. Required.
- "sizes": [
- "str" # This attribute is set to an array
- which contains the identifying slugs for the sizes available in
- this region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used
- as a unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string
- that is used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the
- resource that the action is associated with.
- "resource_type": "str", # Optional. The type of resource
- that the action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the action was initiated.
- "status": "in-progress", # Optional. Default value is
- "in-progress". The current status of the action. This can be
- "in-progress", "completed", or "errored". Known values are:
- "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that
- the object represents. For example, this could be "transfer" to represent
- the state of an image transfer action.
- }
- ],
- "links": {
- "pages": {}
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -173261,98 +177422,21 @@ async def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
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_reserved_ips_actions_list_request(
- reserved_ip=reserved_ip,
- 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
@overload
async def post(
self,
- reserved_ip: str,
- body: Optional[JSON] = None,
+ reserved_ipv6: str,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IP Action.
+ """Initiate a Reserved IPv6 Action.
- To initiate an action on a reserved IP send a POST request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ To initiate an action on a reserved IPv6 send a POST request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
set the ``type`` attribute to on of the supported action types:
.. list-table::
@@ -173361,16 +177445,16 @@ async def post(
* - Action
- Details
* - ``assign``
- - Assigns a reserved IP to a Droplet
+ - Assigns a reserved IPv6 to a Droplet
* - ``unassign``
- - Unassign a reserved IP from a Droplet.
+ - Unassign a reserved IPv6 from a Droplet.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IP. Default value is None.
- :type body: JSON
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ will be taken on the reserved IPv6. Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: JSON object
@@ -173380,9 +177464,6 @@ async def post(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
# response body for status code(s): 201
response == {
"action": {
@@ -173391,8 +177472,6 @@ async def post(
action was completed.
"id": 0, # Optional. A unique numeric ID that can be used to
identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
"region": {
"available": bool, # This is a boolean value that represents
whether new Droplets can be created in this region. Required.
@@ -173441,20 +177520,18 @@ async def post(
}
"""
- @overload
+ @distributed_trace_async
async def post(
self,
- reserved_ip: str,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
+ reserved_ipv6: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IP Action.
+ """Initiate a Reserved IPv6 Action.
- To initiate an action on a reserved IP send a POST request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ To initiate an action on a reserved IPv6 send a POST request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
set the ``type`` attribute to on of the supported action types:
.. list-table::
@@ -173463,18 +177540,16 @@ async def post(
* - Action
- Details
* - ``assign``
- - Assigns a reserved IP to a Droplet
+ - Assigns a reserved IPv6 to a Droplet
* - ``unassign``
- - Unassign a reserved IP from a Droplet.
+ - Unassign a reserved IPv6 from a Droplet.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IP. Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
+ will be taken on the reserved IPv6. Is either a JSON type or a IO[bytes] type. Default value
+ is None.
+ :type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -173482,6 +177557,9 @@ async def post(
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
# response body for status code(s): 201
response == {
"action": {
@@ -173490,8 +177568,6 @@ async def post(
action was completed.
"id": 0, # Optional. A unique numeric ID that can be used to
identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
"region": {
"available": bool, # This is a boolean value that represents
whether new Droplets can be created in this region. Required.
@@ -173527,7 +177603,215 @@ async def post(
an image transfer action.
}
}
- # response body for status code(s): 404
+ # 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_reserved_ipv6_actions_post_request(
+ reserved_ipv6=reserved_ipv6,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [201, 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 == 201:
+ 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
+
+
+class ByoipPrefixesOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`byoip_prefixes` attribute.
+ """
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
+ @overload
+ async def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a BYOIP Prefix.
+
+ To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
+
+ A successful request will initiate the process of bringing your BYOIP Prefix into your account.
+ The response will include the details of the created prefix, including its UUID and status.
+
+ :param body: Required.
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
+ "region": "str", # The region where the prefix will be created. Required.
+ "signature": "str" # The signature hash for the prefix creation request.
+ Required.
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "region": "str", # Optional. The region where the prefix is created.
+ "status": "str", # Optional. The status of the BYOIP prefix.
+ "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
+ }
+ # response body for status code(s): 422
+ 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.
+ }
+ """
+
+ @overload
+ async def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a BYOIP Prefix.
+
+ To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
+
+ A successful request will initiate the process of bringing your BYOIP Prefix into your account.
+ The response will include the details of the created prefix, including its UUID and status.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 202
+ response == {
+ "region": "str", # Optional. The region where the prefix is created.
+ "status": "str", # Optional. The status of the BYOIP prefix.
+ "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
+ }
+ # response body for status code(s): 422
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
@@ -173541,34 +177825,16 @@ async def post(
"""
@distributed_trace_async
- async def post(
- self,
- reserved_ip: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any
- ) -> JSON:
+ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IP Action.
-
- To initiate an action on a reserved IP send a POST request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
+ """Create a BYOIP Prefix.
- .. list-table::
- :header-rows: 1
+ To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IP to a Droplet
- * - ``unassign``
- - Unassign a reserved IP from a Droplet.
+ A successful request will initiate the process of bringing your BYOIP Prefix into your account.
+ The response will include the details of the created prefix, including its UUID and status.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IP. Is either a JSON type or a IO[bytes] type. Default value is
- None.
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -173578,54 +177844,20 @@ async def post(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
+ body = {
+ "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
+ "region": "str", # The region where the prefix will be created. Required.
+ "signature": "str" # The signature hash for the prefix creation request.
+ Required.
+ }
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
- }
+ "region": "str", # Optional. The region where the prefix is created.
+ "status": "str", # Optional. The status of the BYOIP prefix.
+ "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
}
- # response body for status code(s): 404
+ # response body for status code(s): 422
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
@@ -173664,13 +177896,9 @@ async def post(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_reserved_ips_actions_post_request(
- reserved_ip=reserved_ip,
+ _request = build_byoip_prefixes_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -173688,14 +177916,14 @@ async def post(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ if response.status_code not in [202, 422]:
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 == 201:
+ if response.status_code == 202:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -173711,7 +177939,7 @@ async def post(
else:
deserialized = None
- if response.status_code == 404:
+ if response.status_code == 422:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -173733,18 +177961,135 @@ async def post(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
+ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ """List BYOIP Prefixes.
+
+ To list all BYOIP prefixes, send a GET request to ``/v2/byoip_prefixes``.
+ A successful response will return a list of all BYOIP prefixes associated with the account.
+
+ :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.
+ },
+ "byoip_prefixes": [
+ {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is
+ being advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is
+ locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project
+ associated with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix
+ is located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP
+ prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the
+ validation.
+ "note": "str", # Optional. Additional notes
+ or details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
+ }
+ """
+ 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_byoip_prefixes_list_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]:
+ 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 = {}
+ 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 get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Reserved IP Action.
+ """Get a BYOIP Prefix.
- To retrieve the status of a reserved IP action, send a GET request to
- ``/v2/reserved_ips/$RESERVED_IP/actions/$ACTION_ID``.
+ To get a BYOIP prefix, send a GET request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
- :param action_id: A unique numeric ID that can be used to identify and reference an action.
- Required.
- :type action_id: int
+ A successful response will return the details of the specified BYOIP prefix.
+
+ :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
+ :type byoip_prefix_uuid: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -173754,50 +178099,32 @@ async def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
- # response body for status code(s): 404
+ # response body for status code(s): 404, 422
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
@@ -173827,9 +178154,8 @@ async def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ips_actions_get_request(
- reserved_ip=reserved_ip,
- action_id=action_id,
+ _request = build_byoip_prefixes_get_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
headers=_headers,
params=_params,
)
@@ -173844,7 +178170,7 @@ async def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [200, 404, 422]:
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
@@ -173883,69 +178209,57 @@ async def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
else:
deserialized = None
+ if response.status_code == 422:
+ 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
-
-class ReservedIPv6Operations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.aio.GeneratedClient`'s
- :attr:`reserved_ipv6` attribute.
- """
-
- def __init__(self, *args, **kwargs) -> None:
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
-
@distributed_trace_async
- async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ async def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List All Reserved IPv6s.
+ """Delete a BYOIP Prefix.
- To list all of the reserved IPv6s available on your account, send a GET request to
- ``/v2/reserved_ipv6``.
+ To delete a BYOIP prefix and remove it from your account, send a DELETE request
+ to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- :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
+ A successful request will receive a 202 status code with no body in response.
+ This indicates that the request was accepted and the prefix is being deleted.
+
+ :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
+ :type byoip_prefix_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): 200
+ # response body for status code(s): 404, 422
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "reserved_ipv6s": [
- {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the
- reserved IPv6. It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the
- reserved IPv6 is reserved to. When you query a reserved IPv6,the
- region_slug will be returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
- }
- ]
+ "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]] = {
@@ -173964,11 +178278,10 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_reserved_ipv6_list_request(
- per_page=per_page,
- page=page,
+ _request = build_byoip_prefixes_delete_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
headers=_headers,
params=_params,
)
@@ -173983,46 +178296,81 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ if response.status_code not in [202, 404, 422]:
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 = {}
- 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 == 202:
+ 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 response.status_code == 422:
+ 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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@overload
- async def create(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ async def patch(
+ self,
+ byoip_prefix_uuid: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IPv6.
-
- On creation, a reserved IPv6 must be reserved to a region.
+ """Update a BYOIP Prefix.
+ To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- * To create a new reserved IPv6 reserved to a region, send a POST request to
- ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
+ Currently, you can update the advertisement status of the prefix.
+ The response will include the updated details of the prefix.
+ :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
+ :type byoip_prefix_uuid: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -174037,36 +178385,68 @@ async def create(
# JSON input template you can fill out and use as your body input.
body = {
- "region_slug": "str" # The slug identifier for the region the reserved IPv6
- will be reserved to. Required.
+ "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "reserved_ipv6": {
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
+ # response body for status code(s): 404, 422
+ 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.
+ }
"""
@overload
- async def create(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ async def patch(
+ self,
+ byoip_prefix_uuid: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IPv6.
-
- On creation, a reserved IPv6 must be reserved to a region.
+ """Update a BYOIP Prefix.
+ To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- * To create a new reserved IPv6 reserved to a region, send a POST request to
- ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
+ Currently, you can update the advertisement status of the prefix.
+ The response will include the updated details of the prefix.
+ :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
+ :type byoip_prefix_uuid: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -174079,30 +178459,60 @@ async def create(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "reserved_ipv6": {
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
+ # response body for status code(s): 404, 422
+ 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.
+ }
"""
@distributed_trace_async
- async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ async def patch(
+ self, byoip_prefix_uuid: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IPv6.
-
- On creation, a reserved IPv6 must be reserved to a region.
+ """Update a BYOIP Prefix.
+ To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- * To create a new reserved IPv6 reserved to a region, send a POST request to
- ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
+ Currently, you can update the advertisement status of the prefix.
+ The response will include the updated details of the prefix.
+ :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
+ :type byoip_prefix_uuid: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -174114,21 +178524,47 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# JSON input template you can fill out and use as your body input.
body = {
- "region_slug": "str" # The slug identifier for the region the reserved IPv6
- will be reserved to. Required.
+ "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "reserved_ipv6": {
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
+ # response body for status code(s): 404, 422
+ 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,
@@ -174159,7 +178595,8 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_reserved_ipv6_create_request(
+ _request = build_byoip_prefixes_patch_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
content_type=content_type,
json=_json,
content=_content,
@@ -174177,27 +178614,60 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [201]:
+ if response.status_code not in [202, 404, 422]:
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 = {}
- 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 == 202:
+ 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.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 response.status_code == 422:
+ 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
@@ -174205,15 +178675,29 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
+ async def list_resources(
+ self,
+ byoip_prefix_uuid: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Reserved IPv6.
+ """List BYOIP Prefix Resources.
- To show information about a reserved IPv6, send a GET request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6``.
+ To list resources associated with BYOIP prefixes, send a GET request to
+ ``/v2/byoip_prefixes/{byoip_prefix_uuid}/ips``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
+ A successful response will return a list of resources associated with the specified BYOIP
+ prefix.
+
+ :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
+ :type byoip_prefix_uuid: str
+ :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:
@@ -174223,15 +178707,23 @@ async def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "reserved_ipv6": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional. The date and time
- when the reserved IPv6 was reserved.
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "ips": [
+ {
+ "assigned_at": "2020-02-20 00:00:00", # Optional. Time when
+ the allocation was assigned.
+ "byoip": "str", # Optional. The BYOIP prefix UUID.
+ "id": 0, # Optional. Unique identifier for the allocation.
+ "region": "str", # Optional. Region where the allocation is
+ made.
+ "resource": "str" # Optional. The resource associated with
+ the allocation.
+ }
+ ],
+ "links": {
+ "pages": {}
}
}
# response body for status code(s): 404
@@ -174264,8 +178756,10 @@ async def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ipv6_get_request(
- reserved_ipv6=reserved_ipv6,
+ _request = build_byoip_prefixes_list_resources_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -174324,27 +178818,96 @@ async def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
+
+class SecurityOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`security` attribute.
+ """
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
@distributed_trace_async
- async def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
+ async def list_scans(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete a Reserved IPv6.
+ """List Scans.
- To delete a reserved IP and remove it from your account, send a DELETE request
- to ``/v2/reserved_ipv6/$RESERVED_IPV6``.
-
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ To list all CSPM scans, send a GET request to ``/v2/security/scans``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :return: JSON object or None
- :rtype: JSON or None
+ :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): 404, 422
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "scans": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan
+ was created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional.
+ The number of affected resources for the finding.
+ "business_impact": "str", # Optional. A
+ description of the business impact of the finding.
+ "details": "str", # Optional. A description
+ of the risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", #
+ Optional. When the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", #
+ Optional. description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional.
+ title.
+ }
+ ],
+ "name": "str", # Optional. The name of the
+ rule that triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity
+ of the finding. Known values are: "CRITICAL", "HIGH", "MEDIUM",
+ and "LOW".
+ "technical_details": "str" # Optional. A
+ description of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known
+ values are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
+ }
+ ]
+ }
+ # 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
@@ -174372,10 +178935,11 @@ async def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ipv6_delete_request(
- reserved_ipv6=reserved_ipv6,
+ _request = build_security_list_scans_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -174390,26 +178954,14 @@ async def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404, 422]:
+ 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)
- 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:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -174425,7 +178977,7 @@ async def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -174442,64 +178994,17 @@ async def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
-
- return deserialized # type: ignore
-
-
-class ReservedIPv6ActionsOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.aio.GeneratedClient`'s
- :attr:`reserved_ipv6_actions` attribute.
- """
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- def __init__(self, *args, **kwargs) -> None:
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
+ return cast(JSON, deserialized) # type: ignore
- @overload
- async def post(
- self,
- reserved_ipv6: str,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> JSON:
+ @distributed_trace_async
+ async def create_scan(self, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IPv6 Action.
-
- To initiate an action on a reserved IPv6 send a POST request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
-
- .. list-table::
- :header-rows: 1
+ """Create Scan.
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IPv6 to a Droplet
- * - ``unassign``
- - Unassign a reserved IPv6 from a Droplet.
+ To create a CSPM scan, send a POST request to ``/v2/security/scans``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IPv6. 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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -174507,53 +179012,46 @@ async def post(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
# response body for status code(s): 201
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "scan": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan was
+ created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional. The
+ number of affected resources for the finding.
+ "business_impact": "str", # Optional. A description
+ of the business impact of the finding.
+ "details": "str", # Optional. A description of the
+ risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", # Optional. When
+ the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", # Optional.
+ description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional. title.
+ }
+ ],
+ "name": "str", # Optional. The name of the rule that
+ triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity of the
+ finding. Known values are: "CRITICAL", "HIGH", "MEDIUM", and "LOW".
+ "technical_details": "str" # Optional. A description
+ of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known values
+ are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
}
}
- # response body for status code(s): 404
+ # response body for status code(s): 400, 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
@@ -174565,41 +179063,126 @@ async def post(
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_security_create_scan_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 [201, 400, 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 == 201:
+ 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")
+ )
- @overload
- async def post(
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ 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 get_scan(
self,
- reserved_ipv6: str,
- body: Optional[IO[bytes]] = None,
+ scan_id: str,
*,
- content_type: str = "application/json",
+ severity: Optional[str] = None,
+ per_page: int = 20,
+ page: int = 1,
+ type: Optional[str] = None,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IPv6 Action.
-
- To initiate an action on a reserved IPv6 send a POST request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
-
- .. list-table::
- :header-rows: 1
+ """Get Scan.
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IPv6 to a Droplet
- * - ``unassign``
- - Unassign a reserved IPv6 from a Droplet.
+ To get a CSPM scan by ID, send a GET request to ``/v2/security/scans/{scan_id}``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IPv6. Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
+ :param scan_id: The scan UUID. Required.
+ :type scan_id: str
+ :keyword severity: The finding severity level to include. Known values are: "LOW", "MEDIUM",
+ "HIGH", and "CRITICAL". Default value is None.
+ :paramtype severity: str
+ :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
+ :keyword type: The finding type to include. Default value is None.
+ :paramtype type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -174607,47 +179190,43 @@ async def post(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "scan": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan was
+ created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional. The
+ number of affected resources for the finding.
+ "business_impact": "str", # Optional. A description
+ of the business impact of the finding.
+ "details": "str", # Optional. A description of the
+ risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", # Optional. When
+ the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", # Optional.
+ description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional. title.
+ }
+ ],
+ "name": "str", # Optional. The name of the rule that
+ triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity of the
+ finding. Known values are: "CRITICAL", "HIGH", "MEDIUM", and "LOW".
+ "technical_details": "str" # Optional. A description
+ of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known values
+ are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
}
}
# response body for status code(s): 404
@@ -174662,37 +179241,112 @@ async def post(
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_security_get_scan_request(
+ scan_id=scan_id,
+ severity=severity,
+ per_page=per_page,
+ page=page,
+ type=type,
+ 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 post(
+ async def get_latest_scan(
self,
- reserved_ipv6: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ severity: Optional[str] = None,
+ type: Optional[str] = None,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IPv6 Action.
-
- To initiate an action on a reserved IPv6 send a POST request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
-
- .. list-table::
- :header-rows: 1
+ """Get Latest Scan.
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IPv6 to a Droplet
- * - ``unassign``
- - Unassign a reserved IPv6 from a Droplet.
+ To get the latest CSPM scan, send a GET request to ``/v2/security/scans/latest``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IPv6. Is either a JSON type or a IO[bytes] type. Default value
- is None.
- :type body: JSON or IO[bytes]
+ :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
+ :keyword severity: The finding severity level to include. Known values are: "LOW", "MEDIUM",
+ "HIGH", and "CRITICAL". Default value is None.
+ :paramtype severity: str
+ :keyword type: The finding type to include. Default value is None.
+ :paramtype type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -174700,50 +179354,43 @@ async def post(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "scan": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan was
+ created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional. The
+ number of affected resources for the finding.
+ "business_impact": "str", # Optional. A description
+ of the business impact of the finding.
+ "details": "str", # Optional. A description of the
+ risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", # Optional. When
+ the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", # Optional.
+ description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional. title.
+ }
+ ],
+ "name": "str", # Optional. The name of the rule that
+ triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity of the
+ finding. Known values are: "CRITICAL", "HIGH", "MEDIUM", and "LOW".
+ "technical_details": "str" # Optional. A description
+ of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known values
+ are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
}
}
# response body for status code(s): 404
@@ -174771,30 +179418,16 @@ async def post(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- content_type: Optional[str] = kwargs.pop(
- "content_type", _headers.pop("Content-Type", None)
- )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- content_type = content_type or "application/json"
- _json = None
- _content = None
- if isinstance(body, (IOBase, bytes)):
- _content = body
- else:
- if body is not None:
- _json = body
- else:
- _json = None
-
- _request = build_reserved_ipv6_actions_post_request(
- reserved_ipv6=reserved_ipv6,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_security_get_latest_scan_request(
+ per_page=per_page,
+ page=page,
+ severity=severity,
+ type=type,
headers=_headers,
params=_params,
)
@@ -174809,14 +179442,14 @@ async def post(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ 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 == 201:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -174853,45 +179486,23 @@ async def post(
return cast(JSON, deserialized) # type: ignore
-
-class ByoipPrefixesOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.aio.GeneratedClient`'s
- :attr:`byoip_prefixes` attribute.
- """
-
- def __init__(self, *args, **kwargs) -> None:
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
-
@overload
- async def create(
+ async def create_scan_rule(
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a BYOIP Prefix.
-
- To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
+ """Create Scan Rule.
- A successful request will initiate the process of bringing your BYOIP Prefix into your account.
- The response will include the details of the created prefix, including its UUID and status.
+ To mark a scan finding as a false positive, send a POST request to
+ ``/v2/security/scans/rules`` to create a new scan rule.
:param body: Required.
: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: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -174899,19 +179510,11 @@ async def create(
# JSON input template you can fill out and use as your body input.
body = {
- "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
- "region": "str", # The region where the prefix will be created. Required.
- "signature": "str" # The signature hash for the prefix creation request.
- Required.
+ "resource": "str" # Optional. The URN of a resource to exclude from future
+ scans.
}
- # response body for status code(s): 202
- response == {
- "region": "str", # Optional. The region where the prefix is created.
- "status": "str", # Optional. The status of the BYOIP prefix.
- "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
- }
- # response body for status code(s): 422
+ # response body for status code(s): 400, 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
@@ -174925,36 +179528,28 @@ async def create(
"""
@overload
- async def create(
+ async def create_scan_rule(
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a BYOIP Prefix.
-
- To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
+ """Create Scan Rule.
- A successful request will initiate the process of bringing your BYOIP Prefix into your account.
- The response will include the details of the created prefix, including its UUID and status.
+ To mark a scan finding as a false positive, send a POST request to
+ ``/v2/security/scans/rules`` to create a new scan rule.
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 202
- response == {
- "region": "str", # Optional. The region where the prefix is created.
- "status": "str", # Optional. The status of the BYOIP prefix.
- "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
- }
- # response body for status code(s): 422
+ # response body for status code(s): 400, 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
@@ -174968,19 +179563,19 @@ async def create(
"""
@distributed_trace_async
- async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ async def create_scan_rule(
+ self, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a BYOIP Prefix.
-
- To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
+ """Create Scan Rule.
- A successful request will initiate the process of bringing your BYOIP Prefix into your account.
- The response will include the details of the created prefix, including its UUID and status.
+ To mark a scan finding as a false positive, send a POST request to
+ ``/v2/security/scans/rules`` to create a new scan rule.
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -174988,19 +179583,11 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# JSON input template you can fill out and use as your body input.
body = {
- "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
- "region": "str", # The region where the prefix will be created. Required.
- "signature": "str" # The signature hash for the prefix creation request.
- Required.
+ "resource": "str" # Optional. The URN of a resource to exclude from future
+ scans.
}
- # response body for status code(s): 202
- response == {
- "region": "str", # Optional. The region where the prefix is created.
- "status": "str", # Optional. The status of the BYOIP prefix.
- "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
- }
- # response body for status code(s): 422
+ # response body for status code(s): 400, 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
@@ -175031,7 +179618,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -175041,7 +179628,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_byoip_prefixes_create_request(
+ _request = build_security_create_scan_rule_request(
content_type=content_type,
json=_json,
content=_content,
@@ -175059,14 +179646,26 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [202, 422]:
+ if response.status_code not in [201, 400, 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 == 202:
+ if response.status_code == 201:
+ 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 == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175082,7 +179681,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175099,17 +179698,30 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@distributed_trace_async
- async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
- """List BYOIP Prefixes.
+ async def list_scan_finding_affected_resources(
+ self,
+ scan_id: str,
+ finding_uuid: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Finding Affected Resources.
- To list all BYOIP prefixes, send a GET request to ``/v2/byoip_prefixes``.
- A successful response will return a list of all BYOIP prefixes associated with the account.
+ To get affected resources for a scan finding, send a GET request to
+ ``/v2/security/scans/{scan_id}/findings/{finding_uuid}/affected_resources``.
+ :param scan_id: The scan UUID. Required.
+ :type scan_id: str
+ :param finding_uuid: The finding UUID. Required.
+ :type finding_uuid: str
: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.
@@ -175123,41 +179735,26 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "byoip_prefixes": [
+ "affected_resources": [
{
- "advertised": bool, # Optional. Whether the BYOIP prefix is
- being advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is
- locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project
- associated with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix
- is located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP
- prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the
- validation.
- "note": "str", # Optional. Additional notes
- or details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
+ "name": "str", # Optional. The name of the affected
+ resource.
+ "type": "str", # Optional. The type of the affected
+ resource.
+ "urn": "str" # Optional. The URN for the affected resource.
}
- ],
- "links": {
- "pages": {}
- }
+ ]
+ }
+ # 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]] = {
@@ -175178,7 +179775,9 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_list_request(
+ _request = build_security_list_scan_finding_affected_resources_request(
+ scan_id=scan_id,
+ finding_uuid=finding_uuid,
per_page=per_page,
page=page,
headers=_headers,
@@ -175195,27 +179794,44 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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
@@ -175223,16 +179839,18 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
+ async def list_settings(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Get a BYOIP Prefix.
-
- To get a BYOIP prefix, send a GET request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """List Settings.
- A successful response will return the details of the specified BYOIP prefix.
+ To list CSPM scan settings, send a GET request to ``/v2/security/settings``.
- :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
- :type byoip_prefix_uuid: str
+ :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:
@@ -175242,32 +179860,61 @@ async def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
+ "plan_downgrades": {
+ "str": {
+ "effective_at": "2020-02-20 00:00:00", # Optional. When the
+ coverage downgrade takes effect.
+ "resources": [
+ "str" # Optional. URNs of resources that will be
+ downgraded.
+ ]
+ }
+ },
+ "settings": {
+ "suppressions": {
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier
+ for the suppressed resource.
+ "resource_id": "str", # Optional. Unique
+ identifier for the resource suppressed.
+ "resource_type": "str", # Optional. Resource
+ type for the resource suppressed.
+ "rule_name": "str", # Optional.
+ Human-readable rule name for the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique
+ identifier for the suppressed rule.
+ }
+ ]
+ }
+ },
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
}
}
- # response body for status code(s): 404, 422
+ # 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
@@ -175297,8 +179944,9 @@ async def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_get_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
+ _request = build_security_list_settings_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -175313,7 +179961,7 @@ async def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404, 422]:
+ 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
@@ -175352,48 +180000,175 @@ async def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
else:
deserialized = None
- if response.status_code == 422:
- 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(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
+ @overload
+ async def update_settings_plan(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete a BYOIP Prefix.
+ """Update Plan.
- To delete a BYOIP prefix and remove it from your account, send a DELETE request
- to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ To update CSPM plan coverage, send a PUT request to ``/v2/security/settings/plan``.
- A successful request will receive a 202 status code with no body in response.
- This indicates that the request was accepted and the prefix is being deleted.
+ :param body: Required.
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
- :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
- :type byoip_prefix_uuid: str
- :return: JSON object or None
- :rtype: JSON or None
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. The URNs of resources to scan for
+ the tier.
+ ],
+ "tags": [
+ "str" # Optional. Resource tags to scan for the
+ tier.
+ ]
+ }
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
+ }
+ }
+ # response body for status code(s): 400, 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.
+ }
+ """
+
+ @overload
+ async def update_settings_plan(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Plan.
+
+ To update CSPM plan coverage, send a PUT request to ``/v2/security/settings/plan``.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 404, 422
+ # response body for status code(s): 200
+ response == {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
+ }
+ }
+ # response body for status code(s): 400, 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.
+ }
+ """
+
+ @distributed_trace_async
+ async def update_settings_plan(
+ self, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Plan.
+
+ To update CSPM plan coverage, send a PUT request to ``/v2/security/settings/plan``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. The URNs of resources to scan for
+ the tier.
+ ],
+ "tags": [
+ "str" # Optional. Resource tags to scan for the
+ tier.
+ ]
+ }
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
+ }
+ }
+ # response body for status code(s): 400, 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
@@ -175418,13 +180193,26 @@ async def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_delete_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_security_update_settings_plan_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -175439,15 +180227,14 @@ async def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [202, 404, 422]:
+ if response.status_code not in [200, 400, 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 == 202:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175458,7 +180245,12 @@ async def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
"int", response.headers.get("ratelimit-reset")
)
- if response.status_code == 404:
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175474,7 +180266,7 @@ async def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175491,29 +180283,19 @@ async def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@overload
- async def patch(
- self,
- byoip_prefix_uuid: str,
- body: JSON,
- *,
- content_type: str = "application/json",
- **kwargs: Any
+ async def create_suppression(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a BYOIP Prefix.
-
- To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """Create Suppression.
- Currently, you can update the advertisement status of the prefix.
- The response will include the updated details of the prefix.
+ To suppress scan findings, send a POST request to ``/v2/security/settings/suppressions``.
- :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
- :type byoip_prefix_uuid: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -175528,37 +180310,44 @@ async def patch(
# JSON input template you can fill out and use as your body input.
body = {
- "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
+ "resources": [
+ "str" # Optional. The URNs of resources to suppress for the rule.
+ ],
+ "rule_uuid": "str" # Optional. The rule UUID to suppress for the listed
+ resources.
}
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
- }
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier for the
+ suppressed resource.
+ "resource_id": "str", # Optional. Unique identifier for the
+ resource suppressed.
+ "resource_type": "str", # Optional. Resource type for the
+ resource suppressed.
+ "rule_name": "str", # Optional. Human-readable rule name for
+ the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique identifier for the
+ suppressed rule.
+ }
+ ]
}
- # response body for status code(s): 404, 422
+ # response body for status code(s): 400, 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
@@ -175572,24 +180361,14 @@ async def patch(
"""
@overload
- async def patch(
- self,
- byoip_prefix_uuid: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any
+ async def create_suppression(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a BYOIP Prefix.
-
- To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """Create Suppression.
- Currently, you can update the advertisement status of the prefix.
- The response will include the updated details of the prefix.
+ To suppress scan findings, send a POST request to ``/v2/security/settings/suppressions``.
- :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
- :type byoip_prefix_uuid: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -175602,34 +180381,37 @@ async def patch(
Example:
.. code-block:: python
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
- }
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier for the
+ suppressed resource.
+ "resource_id": "str", # Optional. Unique identifier for the
+ resource suppressed.
+ "resource_type": "str", # Optional. Resource type for the
+ resource suppressed.
+ "rule_name": "str", # Optional. Human-readable rule name for
+ the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique identifier for the
+ suppressed rule.
+ }
+ ]
}
- # response body for status code(s): 404, 422
+ # response body for status code(s): 400, 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
@@ -175643,19 +180425,14 @@ async def patch(
"""
@distributed_trace_async
- async def patch(
- self, byoip_prefix_uuid: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ async def create_suppression(
+ self, body: Union[JSON, IO[bytes]], **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a BYOIP Prefix.
-
- To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """Create Suppression.
- Currently, you can update the advertisement status of the prefix.
- The response will include the updated details of the prefix.
+ To suppress scan findings, send a POST request to ``/v2/security/settings/suppressions``.
- :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
- :type byoip_prefix_uuid: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -175667,37 +180444,44 @@ async def patch(
# JSON input template you can fill out and use as your body input.
body = {
- "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
+ "resources": [
+ "str" # Optional. The URNs of resources to suppress for the rule.
+ ],
+ "rule_uuid": "str" # Optional. The rule UUID to suppress for the listed
+ resources.
}
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
- }
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier for the
+ suppressed resource.
+ "resource_id": "str", # Optional. Unique identifier for the
+ resource suppressed.
+ "resource_type": "str", # Optional. Resource type for the
+ resource suppressed.
+ "rule_name": "str", # Optional. Human-readable rule name for
+ the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique identifier for the
+ suppressed rule.
+ }
+ ]
}
- # response body for status code(s): 404, 422
+ # response body for status code(s): 400, 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
@@ -175738,8 +180522,7 @@ async def patch(
else:
_json = body
- _request = build_byoip_prefixes_patch_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
+ _request = build_security_create_suppression_request(
content_type=content_type,
json=_json,
content=_content,
@@ -175757,14 +180540,14 @@ async def patch(
response = pipeline_response.http_response
- if response.status_code not in [202, 404, 422]:
+ if response.status_code not in [201, 400, 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 == 202:
+ if response.status_code == 201:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175780,7 +180563,7 @@ async def patch(
else:
deserialized = None
- if response.status_code == 404:
+ if response.status_code == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175796,7 +180579,7 @@ async def patch(
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175818,57 +180601,24 @@ async def patch(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def list_resources(
- self,
- byoip_prefix_uuid: str,
- *,
- per_page: int = 20,
- page: int = 1,
- **kwargs: Any
- ) -> JSON:
+ async def delete_suppression(
+ self, suppression_uuid: str, **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List BYOIP Prefix Resources.
+ """Delete Suppression.
- To list resources associated with BYOIP prefixes, send a GET request to
- ``/v2/byoip_prefixes/{byoip_prefix_uuid}/ips``.
-
- A successful response will return a list of resources associated with the specified BYOIP
- prefix.
+ To remove a suppression, send a DELETE request to
+ ``/v2/security/settings/suppressions/{suppression_uuid}``.
- :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
- :type byoip_prefix_uuid: str
- :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
+ :param suppression_uuid: The suppression UUID to remove. Required.
+ :type suppression_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): 200
- response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "ips": [
- {
- "assigned_at": "2020-02-20 00:00:00", # Optional. Time when
- the allocation was assigned.
- "byoip": "str", # Optional. The BYOIP prefix UUID.
- "id": 0, # Optional. Unique identifier for the allocation.
- "region": "str", # Optional. Region where the allocation is
- made.
- "resource": "str" # Optional. The resource associated with
- the allocation.
- }
- ],
- "links": {
- "pages": {}
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -175897,12 +180647,10 @@ async def list_resources(
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_list_resources_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
- per_page=per_page,
- page=page,
+ _request = build_security_delete_suppression_request(
+ suppression_uuid=suppression_uuid,
headers=_headers,
params=_params,
)
@@ -175917,14 +180665,15 @@ async def list_resources(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ 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 == 200:
+ if response.status_code == 204:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175935,11 +180684,6 @@ async def list_resources(
"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")
@@ -175957,9 +180701,9 @@ async def list_resources(
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
class SizesOperations:
diff --git a/src/pydo/operations/__init__.py b/src/pydo/operations/__init__.py
index 4a74b7ce..7f1635b6 100644
--- a/src/pydo/operations/__init__.py
+++ b/src/pydo/operations/__init__.py
@@ -17,6 +17,7 @@
from ._operations import InvoicesOperations
from ._operations import BillingInsightsOperations
from ._operations import DatabasesOperations
+from ._operations import DedicatedInferencesOperations
from ._operations import DomainsOperations
from ._operations import DropletsOperations
from ._operations import DropletActionsOperations
@@ -39,6 +40,7 @@
from ._operations import ReservedIPv6Operations
from ._operations import ReservedIPv6ActionsOperations
from ._operations import ByoipPrefixesOperations
+from ._operations import SecurityOperations
from ._operations import SizesOperations
from ._operations import SnapshotsOperations
from ._operations import SpacesKeyOperations
@@ -70,6 +72,7 @@
"InvoicesOperations",
"BillingInsightsOperations",
"DatabasesOperations",
+ "DedicatedInferencesOperations",
"DomainsOperations",
"DropletsOperations",
"DropletActionsOperations",
@@ -92,6 +95,7 @@
"ReservedIPv6Operations",
"ReservedIPv6ActionsOperations",
"ByoipPrefixesOperations",
+ "SecurityOperations",
"SizesOperations",
"SnapshotsOperations",
"SpacesKeyOperations",
diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py
index f06ed50c..3d121626 100644
--- a/src/pydo/operations/_operations.py
+++ b/src/pydo/operations/_operations.py
@@ -3581,6 +3581,342 @@ def build_databases_delete_opensearch_index_request( # pylint: disable=name-too
return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
+def build_dedicated_inferences_get_request(
+ dedicated_inference_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/{dedicated_inference_id}"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ }
+
+ _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_dedicated_inferences_patch_request(
+ dedicated_inference_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/{dedicated_inference_id}"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs)
+
+
+def build_dedicated_inferences_delete_request( # pylint: disable=name-too-long
+ dedicated_inference_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/{dedicated_inference_id}"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
+
+
+def build_dedicated_inferences_list_request(
+ *, per_page: int = 20, page: int = 1, region: Optional[str] = None, **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/dedicated-inferences"
+
+ # 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)
+ if region is not None:
+ _params["region"] = _SERIALIZER.query("region", region, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_dedicated_inferences_create_request(
+ **kwargs: Any,
+) -> HttpRequest: # pylint: disable=name-too-long
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences"
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_dedicated_inferences_list_accelerators_request( # pylint: disable=name-too-long
+ dedicated_inference_id: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ slug: Optional[str] = None,
+ **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/dedicated-inferences/{dedicated_inference_id}/accelerators"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # 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)
+ if slug is not None:
+ _params["slug"] = _SERIALIZER.query("slug", slug, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_dedicated_inferences_get_accelerator_request( # pylint: disable=name-too-long
+ dedicated_inference_id: str, accelerator_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/{dedicated_inference_id}/accelerators/{accelerator_id}"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ "accelerator_id": _SERIALIZER.url("accelerator_id", accelerator_id, "str"),
+ }
+
+ _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_dedicated_inferences_get_ca_request( # pylint: disable=name-too-long
+ dedicated_inference_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/{dedicated_inference_id}/ca"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ }
+
+ _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_dedicated_inferences_list_tokens_request( # pylint: disable=name-too-long
+ dedicated_inference_id: str, *, 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/dedicated-inferences/{dedicated_inference_id}/tokens"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # 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_dedicated_inferences_create_tokens_request( # pylint: disable=name-too-long
+ dedicated_inference_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/{dedicated_inference_id}/tokens"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_dedicated_inferences_delete_tokens_request( # pylint: disable=name-too-long
+ dedicated_inference_id: str, token_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/{dedicated_inference_id}/tokens/{token_id}"
+ path_format_arguments = {
+ "dedicated_inference_id": _SERIALIZER.url(
+ "dedicated_inference_id", dedicated_inference_id, "str"
+ ),
+ "token_id": _SERIALIZER.url("token_id", token_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
+
+
+def build_dedicated_inferences_list_sizes_request(
+ **kwargs: Any,
+) -> HttpRequest: # pylint: disable=name-too-long
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/dedicated-inferences/sizes"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_dedicated_inferences_get_gpu_model_config_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/dedicated-inferences/gpu-model-config"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
def build_domains_list_request(
*, per_page: int = 20, page: int = 1, **kwargs: Any
) -> HttpRequest:
@@ -10078,6 +10414,275 @@ def build_byoip_prefixes_list_resources_request( # pylint: disable=name-too-lon
)
+def build_security_list_scans_request(
+ *, 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/security/scans"
+
+ # 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_security_create_scan_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/security/scans"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_security_get_scan_request(
+ scan_id: str,
+ *,
+ severity: Optional[str] = None,
+ per_page: int = 20,
+ page: int = 1,
+ type: Optional[str] = None,
+ **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/security/scans/{scan_id}"
+ path_format_arguments = {
+ "scan_id": _SERIALIZER.url("scan_id", scan_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if severity is not None:
+ _params["severity"] = _SERIALIZER.query("severity", severity, "str")
+ 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)
+ if type is not None:
+ _params["type"] = _SERIALIZER.query("type", type, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_security_get_latest_scan_request(
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ severity: Optional[str] = None,
+ type: Optional[str] = None,
+ **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/security/scans/latest"
+
+ # 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)
+ if severity is not None:
+ _params["severity"] = _SERIALIZER.query("severity", severity, "str")
+ if type is not None:
+ _params["type"] = _SERIALIZER.query("type", type, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_security_create_scan_rule_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/security/scans/rules"
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_security_list_scan_finding_affected_resources_request( # pylint: disable=name-too-long
+ scan_id: str, finding_uuid: str, *, 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/security/scans/{scan_id}/findings/{finding_uuid}/affected_resources"
+ path_format_arguments = {
+ "scan_id": _SERIALIZER.url("scan_id", scan_id, "str"),
+ "finding_uuid": _SERIALIZER.url("finding_uuid", finding_uuid, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # 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_security_list_settings_request(
+ *, 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/security/settings"
+
+ # 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_security_update_settings_plan_request(
+ **kwargs: Any,
+) -> HttpRequest: # pylint: disable=name-too-long
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/security/settings/plan"
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
+
+
+def build_security_create_suppression_request(
+ **kwargs: Any,
+) -> HttpRequest: # pylint: disable=name-too-long
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/security/settings/suppressions"
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_security_delete_suppression_request( # pylint: disable=name-too-long
+ suppression_uuid: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/security/settings/suppressions/{suppression_uuid}"
+ path_format_arguments = {
+ "suppression_uuid": _SERIALIZER.url(
+ "suppression_uuid", suppression_uuid, "str"
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
+
+
def build_sizes_list_request(
*, per_page: int = 20, page: int = 1, **kwargs: Any
) -> HttpRequest:
@@ -135007,14 +135612,14 @@ def delete_opensearch_index(
return deserialized # type: ignore
-class DomainsOperations:
+class DedicatedInferencesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~pydo.GeneratedClient`'s
- :attr:`domains` attribute.
+ :attr:`dedicated_inferences` attribute.
"""
def __init__(self, *args, **kwargs):
@@ -135027,17 +135632,17 @@ def __init__(self, *args, **kwargs):
)
@distributed_trace
- def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ def get(self, dedicated_inference_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Domains.
+ """Get a Dedicated Inference.
- To retrieve a list of all of the domains in your account, send a GET request to
- ``/v2/domains``.
+ Retrieve an existing Dedicated Inference by ID. Send a GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}``. The status in the response
+ is one of active, new, provisioning, updating, deleting, or error.
- :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
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -135047,33 +135652,121 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "domains": [
- {
- "ip_address": "str", # Optional. This optional attribute may
- contain an IP address. When provided, an A record will be automatically
- created pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself.
- This should follow the standard domain format of domain.TLD. For
- instance, ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the
- records on this domain, in seconds. This defines the time frame that
- clients can cache queried information before a refresh should be
- requested.
- "zone_file": "str" # Optional. This attribute contains the
- complete contents of the zone file for the selected domain. Individual
- domain record resources should be used to get more granular control over
- records. However, this attribute can also be used to get information
- about the SOA record, which is created automatically and is not
- accessible as an individual record resource.
- }
- ],
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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,
@@ -135093,9 +135786,8 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_domains_list_request(
- per_page=per_page,
- page=page,
+ _request = build_dedicated_inferences_get_request(
+ dedicated_inference_id=dedicated_inference_id,
headers=_headers,
params=_params,
)
@@ -135110,27 +135802,44 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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
@@ -135138,22 +135847,25 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@overload
- def create(
+ def patch(
self,
- body: Optional[JSON] = None,
+ dedicated_inference_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain.
+ """Update a Dedicated Inference.
- To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
- attribute to the domain name you are adding. Optionally, you may set the
- "ip_address" attribute, and an A record will be automatically created pointing
- to the apex domain.
+ Update an existing Dedicated Inference. Send a PATCH request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}`` with updated ``spec`` and/or
+ ``access_tokens``. Status will move to updating and return to active when done.
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@@ -135167,61 +135879,189 @@ def create(
# JSON input template you can fill out and use as your body input.
body = {
- "ip_address": "str", # Optional. This optional attribute may contain an IP
- address. When provided, an A record will be automatically created pointing to the
- apex domain.
- "name": "str", # Optional. The name of the domain itself. This should follow
- the standard domain format of domain.TLD. For instance, ``example.com`` is a
- valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records on this
- domain, in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete contents
- of the zone file for the selected domain. Individual domain record resources
- should be used to get more granular control over records. However, this attribute
- can also be used to get information about the SOA record, which is created
- automatically and is not accessible as an individual record resource.
+ "access_tokens": {
+ "hugging_face_token": "str" # Optional. Hugging Face token required
+ for gated models.
+ },
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ }
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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.
+ }
"""
@overload
- def create(
+ def patch(
self,
- body: Optional[IO[bytes]] = None,
+ dedicated_inference_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain.
+ """Update a Dedicated Inference.
- To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
- attribute to the domain name you are adding. Optionally, you may set the
- "ip_address" attribute, and an A record will be automatically created pointing
- to the apex domain.
+ Update an existing Dedicated Inference. Send a PATCH request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}`` with updated ``spec`` and/or
+ ``access_tokens``. Status will move to updating and return to active when done.
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -135233,41 +136073,140 @@ def create(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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.
+ }
"""
@distributed_trace
- def create(
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ def patch(
+ self, dedicated_inference_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain.
+ """Update a Dedicated Inference.
- To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
- attribute to the domain name you are adding. Optionally, you may set the
- "ip_address" attribute, and an A record will be automatically created pointing
- to the apex domain.
+ Update an existing Dedicated Inference. Send a PATCH request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}`` with updated ``spec`` and/or
+ ``access_tokens``. Status will move to updating and return to active when done.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -135278,42 +136217,167 @@ def create(
# JSON input template you can fill out and use as your body input.
body = {
- "ip_address": "str", # Optional. This optional attribute may contain an IP
- address. When provided, an A record will be automatically created pointing to the
- apex domain.
- "name": "str", # Optional. The name of the domain itself. This should follow
- the standard domain format of domain.TLD. For instance, ``example.com`` is a
- valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records on this
- domain, in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete contents
- of the zone file for the selected domain. Individual domain record resources
- should be used to get more granular control over records. However, this attribute
- can also be used to get information about the SOA record, which is created
- automatically and is not accessible as an individual record resource.
+ "access_tokens": {
+ "hugging_face_token": "str" # Optional. Hugging Face token required
+ for gated models.
+ },
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ }
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
}
}
+ # 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,
@@ -135342,12 +136406,10 @@ def create(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_domains_create_request(
+ _request = build_dedicated_inferences_patch_request(
+ dedicated_inference_id=dedicated_inference_id,
content_type=content_type,
json=_json,
content=_content,
@@ -135365,27 +136427,44 @@ def create(
response = pipeline_response.http_response
- if response.status_code not in [201]:
+ if response.status_code not in [202, 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 = {}
- 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 == 202:
+ 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.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
@@ -135393,41 +136472,24 @@ def create(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get(self, domain_name: str, **kwargs: Any) -> JSON:
+ def delete(self, dedicated_inference_id: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Retrieve an Existing Domain.
+ """Delete a Dedicated Inference.
- To get details about a specific domain, send a GET request to ``/v2/domains/$DOMAIN_NAME``.
+ Delete an existing Dedicated Inference. Send a DELETE request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}``. The response 202 Accepted
+ indicates the request was accepted for processing.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :return: JSON object
- :rtype: JSON
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: 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): 200
- response == {
- "domain": {
- "ip_address": "str", # Optional. This optional attribute may contain
- an IP address. When provided, an A record will be automatically created
- pointing to the apex domain.
- "name": "str", # Optional. The name of the domain itself. This
- should follow the standard domain format of domain.TLD. For instance,
- ``example.com`` is a valid domain name.
- "ttl": 0, # Optional. This value is the time to live for the records
- on this domain, in seconds. This defines the time frame that clients can
- cache queried information before a refresh should be requested.
- "zone_file": "str" # Optional. This attribute contains the complete
- contents of the zone file for the selected domain. Individual domain record
- resources should be used to get more granular control over records. However,
- this attribute can also be used to get information about the SOA record,
- which is created automatically and is not accessible as an individual record
- resource.
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -135456,10 +136518,10 @@ def get(self, domain_name: str, **kwargs: Any) -> JSON:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_domains_get_request(
- domain_name=domain_name,
+ _request = build_dedicated_inferences_delete_request(
+ dedicated_inference_id=dedicated_inference_id,
headers=_headers,
params=_params,
)
@@ -135474,14 +136536,15 @@ def get(self, domain_name: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [202, 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 == 200:
+ if response.status_code == 202:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -135492,11 +136555,6 @@ def get(self, domain_name: str, **kwargs: Any) -> JSON:
"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")
@@ -135514,36 +136572,158 @@ def get(self, domain_name: str, **kwargs: Any) -> JSON:
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@distributed_trace
- def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
+ def list(
+ self,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ region: Optional[str] = None,
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete a Domain.
+ """List Dedicated Inferences.
- To delete a domain, send a DELETE request to ``/v2/domains/$DOMAIN_NAME``.
+ List all Dedicated Inference instances for your team. Send a GET request to
+ ``/v2/dedicated-inferences``. You may filter by region and use page and per_page
+ for pagination.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :return: JSON object or None
- :rtype: JSON or None
+ :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
+ :keyword region: Filter by region. Dedicated Inference is only available in nyc2, tor1, and
+ atl1. Known values are: "nyc2", "tor1", and "atl1". Default value is None.
+ :paramtype region: str
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 404
+ # response body for status code(s): 200
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.
+ "dedicated_inferences": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the
+ Dedicated Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private
+ VPC FQDN of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public
+ FQDN of the Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated
+ Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ Pending deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether
+ to expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug":
+ "str", # DigitalOcean GPU slug. Required.
+ "scale": 0, # Number
+ of accelerator instances. Required.
+ "type": "str", #
+ Accelerator type (e.g. prefill_decode). Required.
+ "status": "str" #
+ Optional. Current state of the Accelerator. Known
+ values are: "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used
+ to identify an existing deployment when updating; empty means
+ create new.
+ "model_provider": "str", # Optional.
+ Model provider. "hugging_face"
+ "model_slug": "str", # Optional.
+ Model identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated
+ Inference. Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional.
+ Pending deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the
+ Dedicated Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose
+ a public LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug":
+ "str", # DigitalOcean GPU slug. Required.
+ "scale": 0, # Number
+ of accelerator instances. Required.
+ "type": "str", #
+ Accelerator type (e.g. prefill_decode). Required.
+ "status": "str" #
+ Optional. Current state of the Accelerator. Known
+ values are: "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used
+ to identify an existing deployment when updating; empty means
+ create new.
+ "model_provider": "str", # Optional.
+ Model provider. "hugging_face"
+ "model_slug": "str", # Optional.
+ Model identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference.
+ Must be unique within the team. Required.
+ "region": "str", # DigitalOcean region where the
+ Dedicated Inference is hosted. Required. Known values are: "atl1",
+ "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the
+ Dedicated Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated
+ Inference.
+ }
+ ],
+ "links": {
+ "pages": {
+ "str": "str" # Optional. Pagination links (first, prev,
+ next, last).
+ }
+ },
+ "meta": {
+ "total": 0 # Total number of results. Required.
+ }
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -135562,10 +136742,12 @@ def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_domains_delete_request(
- domain_name=domain_name,
+ _request = build_dedicated_inferences_list_request(
+ per_page=per_page,
+ page=page,
+ region=region,
headers=_headers,
params=_params,
)
@@ -135580,82 +136762,645 @@ def delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [200]:
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")
- )
+ 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, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Dedicated Inference.
+
+ Create a new Dedicated Inference for your team. Send a POST request to
+ ``/v2/dedicated-inferences`` with a ``spec`` object (version, name, region, vpc,
+ enable_public_endpoint, model_deployments) and optional ``access_tokens`` (e.g.
+ hugging_face_token for gated models). The response code 202 Accepted indicates
+ the request was accepted for processing; it does not indicate success or failure.
+ The token value is returned only on create; store it securely.
+
+ :param body: Required.
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ },
+ "access_tokens": {
+ "str": "str" # Optional. Key-value pairs for provider tokens (e.g.
+ Hugging Face).
+ }
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
+ },
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
+ }
+ }
+ """
+
+ @overload
+ def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Dedicated Inference.
+
+ Create a new Dedicated Inference for your team. Send a POST request to
+ ``/v2/dedicated-inferences`` with a ``spec`` object (version, name, region, vpc,
+ enable_public_endpoint, model_deployments) and optional ``access_tokens`` (e.g.
+ hugging_face_token for gated models). The response code 202 Accepted indicates
+ the request was accepted for processing; it does not indicate success or failure.
+ The token value is returned only on create; store it securely.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 202
+ response == {
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
+ },
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
+ }
+ }
+ """
+
+ @distributed_trace
+ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Dedicated Inference.
+
+ Create a new Dedicated Inference for your team. Send a POST request to
+ ``/v2/dedicated-inferences`` with a ``spec`` object (version, name, region, vpc,
+ enable_public_endpoint, model_deployments) and optional ``access_tokens`` (e.g.
+ hugging_face_token for gated models). The response code 202 Accepted indicates
+ the request was accepted for processing; it does not indicate success or failure.
+ The token value is returned only on create; store it securely.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public LLM
+ endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of accelerator
+ instances. Required.
+ "type": "str", # Accelerator type
+ (e.g. prefill_decode). Required.
+ "status": "str" # Optional. Current
+ state of the Accelerator. Known values are: "new",
+ "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to identify an
+ existing deployment when updating; empty means create new.
+ "model_provider": "str", # Optional. Model provider.
+ "hugging_face"
+ "model_slug": "str", # Optional. Model identifier
+ (e.g. Hugging Face slug).
+ "workload_config": {} # Optional. Workload-specific
+ configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be unique
+ within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated Inference
+ is hosted. Required. Known values are: "atl1", "nyc2", and "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated Inference.
+ Required.
+ }
+ },
+ "access_tokens": {
+ "str": "str" # Optional. Key-value pairs for provider tokens (e.g.
+ Hugging Face).
+ }
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "dedicated_inference": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was created.
+ "endpoints": {
+ "private_endpoint_fqdn": "str", # Optional. Private VPC FQDN
+ of the Dedicated Inference instance.
+ "public_endpoint_fqdn": "str" # Optional. Public FQDN of the
+ Dedicated Inference instance.
+ },
+ "id": "str", # Optional. Unique ID of the Dedicated Inference.
+ "pending_deployment_spec": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "enable_public_endpoint": bool, # Optional. Whether to
+ expose a public LLM endpoint.
+ "id": "str", # Optional. Deployment UUID.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Optional. Name of the Dedicated Inference.
+ Must be unique within the team.
+ "status": "str", # Optional. Known values are:
+ "provisioning" and "updating".
+ "updated_at": "2020-02-20 00:00:00", # Optional. Pending
+ deployment when status is provisioning or updating.
+ "version": 0, # Optional. Spec version.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "region": "str", # Optional. DigitalOcean region where the Dedicated
+ Inference is hosted.
+ "spec": {
+ "enable_public_endpoint": bool, # Whether to expose a public
+ LLM endpoint. Required.
+ "model_deployments": [
+ {
+ "accelerators": [
+ {
+ "accelerator_slug": "str", #
+ DigitalOcean GPU slug. Required.
+ "scale": 0, # Number of
+ accelerator instances. Required.
+ "type": "str", # Accelerator
+ type (e.g. prefill_decode). Required.
+ "status": "str" # Optional.
+ Current state of the Accelerator. Known values are:
+ "new", "provisioning", and "active".
+ }
+ ],
+ "model_id": "str", # Optional. Used to
+ identify an existing deployment when updating; empty means create
+ new.
+ "model_provider": "str", # Optional. Model
+ provider. "hugging_face"
+ "model_slug": "str", # Optional. Model
+ identifier (e.g. Hugging Face slug).
+ "workload_config": {} # Optional.
+ Workload-specific configuration (e.g. ISL/OSL in future).
+ }
+ ],
+ "name": "str", # Name of the Dedicated Inference. Must be
+ unique within the team. Required.
+ "region": "str", # DigitalOcean region where the Dedicated
+ Inference is hosted. Required. Known values are: "atl1", "nyc2", and
+ "tor1".
+ "version": 0, # Spec version. Required.
+ "vpc": {
+ "uuid": "str" # VPC UUID for the Dedicated
+ Inference. Required.
+ }
+ },
+ "status": "str", # Optional. Current state of the Dedicated
+ Inference. Known values are: "active", "new", "provisioning", "updating",
+ "deleting", and "error".
+ "updated_at": "2020-02-20 00:00:00", # Optional. When the Dedicated
+ Inference was last updated.
+ "vpc_uuid": "str" # Optional. VPC UUID of the Dedicated Inference.
+ },
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
+ }
+ }
+ """
+ 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_dedicated_inferences_create_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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
)
+ )
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ response = pipeline_response.http_response
+
+ if response.status_code not in [202]:
+ 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 = {}
+ 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 cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def list_records(
+ def list_accelerators(
self,
- domain_name: str,
+ dedicated_inference_id: str,
*,
- name: Optional[str] = None,
- type: Optional[str] = None,
per_page: int = 20,
page: int = 1,
+ slug: Optional[str] = None,
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """List All Domain Records.
+ """List Dedicated Inference Accelerators.
- To get a listing of all records configured for a domain, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records``.
- The list of records returned can be filtered by using the ``name`` and ``type`` query
- parameters. For example, to only include A records for a domain, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records?type=A``. ``name`` must be a fully qualified record name.
- For example, to only include records matching ``sub.example.com``\\ , send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Both name and type may be used
- together.
+ List all accelerators (GPUs) in use by a Dedicated Inference instance. Send a
+ GET request to ``/v2/dedicated-inferences/{dedicated_inference_id}/accelerators``.
+ Optionally filter by slug and use page/per_page for pagination.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :keyword name: A fully qualified record name. For example, to only include records matching
- sub.example.com, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Default value is None.
- :paramtype name: str
- :keyword type: The type of the DNS record. For example: A, CNAME, TXT, ... Known values are:
- "A", "AAAA", "CAA", "CNAME", "MX", "NS", "SOA", "SRV", and "TXT". Default value is None.
- :paramtype type: str
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
: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
+ :keyword slug: Filter accelerators by GPU slug. Default value is None.
+ :paramtype slug: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -135668,30 +137413,15 @@ def list_records(
"meta": {
"total": 0 # Optional. Number of objects returned by the request.
},
- "domain_records": [
+ "accelerators": [
{
- "type": "str", # The type of the DNS record. For example: A,
- CNAME, TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record
- type. For example, the "data" value for an A record would be the IPv4
- address to which the domain will be mapped. For a CAA record, it would
- contain the domain name of the CA being granted permission to issue
- certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255
- used for CAA records.
- "id": 0, # Optional. A unique identifier for each domain
- record.
- "name": "str", # Optional. The host name, alias, or service
- being defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX
- records.
- "tag": "str", # Optional. The parameter tag for CAA records.
- Valid values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the
- record, in seconds. This defines the time frame that clients can cache
- queried information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ "id": "str", # Optional. Unique ID of the accelerator.
+ "name": "str", # Optional. Name of the accelerator.
+ "role": "str", # Optional. Role of the accelerator (e.g.
+ prefill_decode).
+ "slug": "str", # Optional. DigitalOcean GPU slug.
+ "status": "str" # Optional. Status of the accelerator.
}
],
"links": {
@@ -135728,12 +137458,11 @@ def list_records(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_domains_list_records_request(
- domain_name=domain_name,
- name=name,
- type=type,
+ _request = build_dedicated_inferences_list_accelerators_request(
+ dedicated_inference_id=dedicated_inference_id,
per_page=per_page,
page=page,
+ slug=slug,
headers=_headers,
params=_params,
)
@@ -135792,34 +137521,22 @@ def list_records(
return cast(JSON, deserialized) # type: ignore
- @overload
- def create_record(
- self,
- domain_name: str,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
+ @distributed_trace
+ def get_accelerator(
+ self, dedicated_inference_id: str, accelerator_id: str, **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Domain Record.
-
- To create a new record to a domain, send a POST request to
- ``/v2/domains/$DOMAIN_NAME/records``.
+ """Get a Dedicated Inference Accelerator.
- The request must include all of the required fields for the domain record type
- being added.
-
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective required attributes.
+ Retrieve a single accelerator by ID for a Dedicated Inference instance. Send a
+ GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}/accelerators/{accelerator_id}``.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :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
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param accelerator_id: A unique identifier for a Dedicated Inference accelerator. Required.
+ :type accelerator_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -135827,32 +137544,14 @@ def create_record(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ "id": "str", # Optional. Unique ID of the accelerator.
+ "name": "str", # Optional. Name of the accelerator.
+ "role": "str", # Optional. Role of the accelerator (e.g. prefill_decode).
+ "slug": "str", # Optional. DigitalOcean GPU slug.
+ "status": "str" # Optional. Status of the accelerator.
}
# response body for status code(s): 404
response == {
@@ -135866,102 +137565,97 @@ def create_record(
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 {})
- @overload
- def create_record(
- self,
- domain_name: str,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> JSON:
- # pylint: disable=line-too-long
- """Create a New Domain Record.
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
- To create a new record to a domain, send a POST request to
- ``/v2/domains/$DOMAIN_NAME/records``.
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- The request must include all of the required fields for the domain record type
- being added.
+ _request = build_dedicated_inferences_get_accelerator_request(
+ dedicated_inference_id=dedicated_inference_id,
+ accelerator_id=accelerator_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective required attributes.
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param body: Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
- :return: JSON object
- :rtype: JSON
- :raises ~azure.core.exceptions.HttpResponseError:
+ response = pipeline_response.http_response
- Example:
- .. code-block:: python
+ 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 body for status code(s): 201
- response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
- }
- # 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.
- }
- """
+ 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")
+ )
- @distributed_trace
- def create_record(
- self,
- domain_name: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any,
- ) -> JSON:
- # pylint: disable=line-too-long
- """Create a New Domain Record.
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- To create a new record to a domain, send a POST request to
- ``/v2/domains/$DOMAIN_NAME/records``.
+ 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")
+ )
- The request must include all of the required fields for the domain record type
- being added.
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective required attributes.
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def get_ca(self, dedicated_inference_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Get Dedicated Inference CA Certificate.
+
+ Get the CA certificate for a Dedicated Inference instance (base64-encoded).
+ Required for private endpoint connectivity. Send a GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}/ca``.
+
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -135969,32 +137663,9 @@ def create_record(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
+ "cert": "str" # Base64-encoded CA certificate. Required.
}
# response body for status code(s): 404
response == {
@@ -136021,30 +137692,13 @@ def create_record(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- content_type: Optional[str] = kwargs.pop(
- "content_type", _headers.pop("Content-Type", None)
- )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- content_type = content_type or "application/json"
- _json = None
- _content = None
- if isinstance(body, (IOBase, bytes)):
- _content = body
- else:
- if body is not None:
- _json = body
- else:
- _json = None
-
- _request = build_domains_create_record_request(
- domain_name=domain_name,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_dedicated_inferences_get_ca_request(
+ dedicated_inference_id=dedicated_inference_id,
headers=_headers,
params=_params,
)
@@ -136059,14 +137713,14 @@ def create_record(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ 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 == 201:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -136104,19 +137758,28 @@ def create_record(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_record(
- self, domain_name: str, domain_record_id: int, **kwargs: Any
+ def list_tokens(
+ self,
+ dedicated_inference_id: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Domain Record.
+ """List Dedicated Inference Tokens.
- To retrieve a specific domain record, send a GET request to
- ``/v2/domains/$DOMAIN_NAME/records/$RECORD_ID``.
+ List all access tokens for a Dedicated Inference instance. Token values are
+ not returned; only id, name, and created_at. Send a GET request to
+ ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens``.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :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:
@@ -136126,27 +137789,21 @@ def get_record(
# response body for status code(s): 200
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "tokens": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once
+ on create. Store securely.
+ }
+ ]
}
# response body for status code(s): 404
response == {
@@ -136178,9 +137835,10 @@ def get_record(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_domains_get_record_request(
- domain_name=domain_name,
- domain_record_id=domain_record_id,
+ _request = build_dedicated_inferences_list_tokens_request(
+ dedicated_inference_id=dedicated_inference_id,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -136240,30 +137898,25 @@ def get_record(
return cast(JSON, deserialized) # type: ignore
@overload
- def patch_record(
+ def create_tokens(
self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[JSON] = None,
+ dedicated_inference_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PATCH request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Create a Dedicated Inference Token.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Create a new access token for a Dedicated Inference instance. Send a POST
+ request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens`` with a
+ ``name``. The token value is returned only once in the response; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@@ -136277,49 +137930,18 @@ def patch_record(
# JSON input template you can fill out and use as your body input.
body = {
- "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
- Required.
- "data": "str", # Optional. Variable data depending on record type. For
- example, the "data" value for an A record would be the IPv4 address to which the
- domain will be mapped. For a CAA record, it would contain the domain name of the
- CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
- records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being defined by
- the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid values
- are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record, in
- seconds. This defines the time frame that clients can cache queried information
- before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "name": "str" # Name for the new token. Required.
}
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
}
}
# response body for status code(s): 404
@@ -136336,30 +137958,25 @@ def patch_record(
"""
@overload
- def patch_record(
+ def create_tokens(
self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[IO[bytes]] = None,
+ dedicated_inference_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PATCH request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Create a Dedicated Inference Token.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Create a new access token for a Dedicated Inference instance. Send a POST
+ request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens`` with a
+ ``name``. The token value is returned only once in the response; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -136371,28 +137988,15 @@ def patch_record(
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
}
}
# response body for status code(s): 404
@@ -136409,28 +138013,20 @@ def patch_record(
"""
@distributed_trace
- def patch_record(
- self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any,
+ def create_tokens(
+ self, dedicated_inference_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PATCH request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Create a Dedicated Inference Token.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Create a new access token for a Dedicated Inference instance. Send a POST
+ request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens`` with a
+ ``name``. The token value is returned only once in the response; store it securely.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -136441,49 +138037,18 @@ def patch_record(
# JSON input template you can fill out and use as your body input.
body = {
- "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
- Required.
- "data": "str", # Optional. Variable data depending on record type. For
- example, the "data" value for an A record would be the IPv4 address to which the
- domain will be mapped. For a CAA record, it would contain the domain name of the
- CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
- records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being defined by
- the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid values
- are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record, in
- seconds. This defines the time frame that clients can cache queried information
- before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "name": "str" # Name for the new token. Required.
}
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
+ "token": {
+ "created_at": "2020-02-20 00:00:00", # Optional. Access token for
+ authenticating to Dedicated Inference endpoints.
+ "id": "str", # Optional. Unique ID of the token.
+ "name": "str", # Optional. Name of the token.
+ "value": "str" # Optional. Token value; only returned once on
+ create. Store securely.
}
}
# response body for status code(s): 404
@@ -136525,14 +138090,10 @@ def patch_record(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_domains_patch_record_request(
- domain_name=domain_name,
- domain_record_id=domain_record_id,
+ _request = build_dedicated_inferences_create_tokens_request(
+ dedicated_inference_id=dedicated_inference_id,
content_type=content_type,
json=_json,
content=_content,
@@ -136550,14 +138111,14 @@ def patch_record(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [202, 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:
+ if response.status_code == 202:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -136594,89 +138155,28 @@ def patch_record(
return cast(JSON, deserialized) # type: ignore
- @overload
- def update_record(
- self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> JSON:
+ @distributed_trace
+ def delete_tokens(
+ self, dedicated_inference_id: str, token_id: str, **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Update a Domain Record.
-
- To update an existing record, send a PUT request to
- ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
- the record type can be set to a new value for the record.
+ """Revoke a Dedicated Inference Token.
- See the `attribute table <#tag/Domain-Records>`_ for details regarding record
- types and their respective attributes.
+ Revoke (delete) an access token for a Dedicated Inference instance. Send a
+ DELETE request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens/{token_id}``.
- :param domain_name: The name of the domain itself. Required.
- :type domain_name: str
- :param domain_record_id: The unique identifier of the domain record. Required.
- :type domain_record_id: int
- :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: JSON object
- :rtype: JSON
+ :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance.
+ Required.
+ :type dedicated_inference_id: str
+ :param token_id: A unique identifier for a Dedicated Inference access token. Required.
+ :type token_id: str
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
- Required.
- "data": "str", # Optional. Variable data depending on record type. For
- example, the "data" value for an A record would be the IPv4 address to which the
- domain will be mapped. For a CAA record, it would contain the domain name of the
- CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
- records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being defined by
- the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid values
- are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record, in
- seconds. This defines the time frame that clients can cache queried information
- before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
-
- # response body for status code(s): 200
- response == {
- "domain_record": {
- "type": "str", # The type of the DNS record. For example: A, CNAME,
- TXT, ... Required.
- "data": "str", # Optional. Variable data depending on record type.
- For example, the "data" value for an A record would be the IPv4 address to
- which the domain will be mapped. For a CAA record, it would contain the
- domain name of the CA being granted permission to issue certificates.
- "flags": 0, # Optional. An unsigned integer between 0-255 used for
- CAA records.
- "id": 0, # Optional. A unique identifier for each domain record.
- "name": "str", # Optional. The host name, alias, or service being
- defined by the record.
- "port": 0, # Optional. The port for SRV records.
- "priority": 0, # Optional. The priority for SRV and MX records.
- "tag": "str", # Optional. The parameter tag for CAA records. Valid
- values are "issue", "issuewild", or "iodef".
- "ttl": 0, # Optional. This value is the time to live for the record,
- in seconds. This defines the time frame that clients can cache queried
- information before a refresh should be requested.
- "weight": 0 # Optional. The weight for SRV records.
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -136689,17 +138189,1954 @@ def update_record(
tickets to help identify the issue.
}
"""
-
- @overload
- def update_record(
- self,
- domain_name: str,
- domain_record_id: int,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> JSON:
+ 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_dedicated_inferences_delete_tokens_request(
+ dedicated_inference_id=dedicated_inference_id,
+ token_id=token_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 [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_sizes(self, **kwargs: Any) -> JSON:
+ """List Dedicated Inference Sizes.
+
+ Get available Dedicated Inference sizes and pricing for supported GPUs. Send a
+ GET request to ``/v2/dedicated-inferences/sizes``.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "enabled_regions": [
+ "str" # Optional. Regions where Dedicated Inference is available.
+ ],
+ "sizes": [
+ {
+ "currency": "str", # Optional.
+ "gpu_slug": "str", # Optional.
+ "price_per_hour": "str", # Optional.
+ "region": "str" # Optional.
+ }
+ ]
+ }
+ """
+ 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_dedicated_inferences_list_sizes_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]:
+ 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 = {}
+ 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 get_gpu_model_config(self, **kwargs: Any) -> JSON:
+ """Get Dedicated Inference GPU Model Config.
+
+ Get supported GPU and model configurations for Dedicated Inference. Use this to
+ discover supported GPU slugs and model slugs (e.g. Hugging Face). Send a GET
+ request to ``/v2/dedicated-inferences/gpu-model-config``.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "gpu_model_configs": [
+ {
+ "gpu_slugs": [
+ "str" # Optional.
+ ],
+ "is_gated_model": bool, # Optional. Whether the model
+ requires gated access (e.g. Hugging Face token).
+ "model_name": "str", # Optional.
+ "model_slug": "str" # Optional.
+ }
+ ]
+ }
+ """
+ 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_dedicated_inferences_get_gpu_model_config_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]:
+ 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 = {}
+ 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
+
+
+class DomainsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`domains` attribute.
+ """
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
+ @distributed_trace
+ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Domains.
+
+ To retrieve a list of all of the domains in your account, send a GET request to
+ ``/v2/domains``.
+
+ :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 == {
+ "domains": [
+ {
+ "ip_address": "str", # Optional. This optional attribute may
+ contain an IP address. When provided, an A record will be automatically
+ created pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself.
+ This should follow the standard domain format of domain.TLD. For
+ instance, ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the
+ records on this domain, in seconds. This defines the time frame that
+ clients can cache queried information before a refresh should be
+ requested.
+ "zone_file": "str" # Optional. This attribute contains the
+ complete contents of the zone file for the selected domain. Individual
+ domain record resources should be used to get more granular control over
+ records. However, this attribute can also be used to get information
+ about the SOA record, which is created automatically and is not
+ accessible as an individual record resource.
+ }
+ ],
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ }
+ }
+ """
+ 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_domains_list_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]:
+ 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 = {}
+ 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
+
+ @overload
+ def create(
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain.
+
+ To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
+ attribute to the domain name you are adding. Optionally, you may set the
+ "ip_address" attribute, and an A record will be automatically created pointing
+ to the apex domain.
+
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "ip_address": "str", # Optional. This optional attribute may contain an IP
+ address. When provided, an A record will be automatically created pointing to the
+ apex domain.
+ "name": "str", # Optional. The name of the domain itself. This should follow
+ the standard domain format of domain.TLD. For instance, ``example.com`` is a
+ valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records on this
+ domain, in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete contents
+ of the zone file for the selected domain. Individual domain record resources
+ should be used to get more granular control over records. However, this attribute
+ can also be used to get information about the SOA record, which is created
+ automatically and is not accessible as an individual record resource.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
+ }
+ }
+ """
+
+ @overload
+ def create(
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain.
+
+ To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
+ attribute to the domain name you are adding. Optionally, you may set the
+ "ip_address" attribute, and an A record will be automatically created pointing
+ to the apex domain.
+
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
+ }
+ }
+ """
+
+ @distributed_trace
+ def create(
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain.
+
+ To create a new domain, send a POST request to ``/v2/domains``. Set the "name"
+ attribute to the domain name you are adding. Optionally, you may set the
+ "ip_address" attribute, and an A record will be automatically created pointing
+ to the apex domain.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "ip_address": "str", # Optional. This optional attribute may contain an IP
+ address. When provided, an A record will be automatically created pointing to the
+ apex domain.
+ "name": "str", # Optional. The name of the domain itself. This should follow
+ the standard domain format of domain.TLD. For instance, ``example.com`` is a
+ valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records on this
+ domain, in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete contents
+ of the zone file for the selected domain. Individual domain record resources
+ should be used to get more granular control over records. However, this attribute
+ can also be used to get information about the SOA record, which is created
+ automatically and is not accessible as an individual record resource.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
+ }
+ }
+ """
+ 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_domains_create_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [201]:
+ 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 = {}
+ 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 get(self, domain_name: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Existing Domain.
+
+ To get details about a specific domain, send a GET request to ``/v2/domains/$DOMAIN_NAME``.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "domain": {
+ "ip_address": "str", # Optional. This optional attribute may contain
+ an IP address. When provided, an A record will be automatically created
+ pointing to the apex domain.
+ "name": "str", # Optional. The name of the domain itself. This
+ should follow the standard domain format of domain.TLD. For instance,
+ ``example.com`` is a valid domain name.
+ "ttl": 0, # Optional. This value is the time to live for the records
+ on this domain, in seconds. This defines the time frame that clients can
+ cache queried information before a refresh should be requested.
+ "zone_file": "str" # Optional. This attribute contains the complete
+ contents of the zone file for the selected domain. Individual domain record
+ resources should be used to get more granular control over records. However,
+ this attribute can also be used to get information about the SOA record,
+ which is created automatically and is not accessible as an individual record
+ resource.
+ }
+ }
+ # 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_domains_get_request(
+ domain_name=domain_name,
+ 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 delete(self, domain_name: str, **kwargs: Any) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete a Domain.
+
+ To delete a domain, send a DELETE request to ``/v2/domains/$DOMAIN_NAME``.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_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_domains_delete_request(
+ domain_name=domain_name,
+ 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_records(
+ self,
+ domain_name: str,
+ *,
+ name: Optional[str] = None,
+ type: Optional[str] = None,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Domain Records.
+
+ To get a listing of all records configured for a domain, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
+ The list of records returned can be filtered by using the ``name`` and ``type`` query
+ parameters. For example, to only include A records for a domain, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records?type=A``. ``name`` must be a fully qualified record name.
+ For example, to only include records matching ``sub.example.com``\\ , send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Both name and type may be used
+ together.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :keyword name: A fully qualified record name. For example, to only include records matching
+ sub.example.com, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records?name=sub.example.com``. Default value is None.
+ :paramtype name: str
+ :keyword type: The type of the DNS record. For example: A, CNAME, TXT, ... Known values are:
+ "A", "AAAA", "CAA", "CNAME", "MX", "NS", "SOA", "SRV", and "TXT". Default value is None.
+ :paramtype type: str
+ :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.
+ },
+ "domain_records": [
+ {
+ "type": "str", # The type of the DNS record. For example: A,
+ CNAME, TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record
+ type. For example, the "data" value for an A record would be the IPv4
+ address to which the domain will be mapped. For a CAA record, it would
+ contain the domain name of the CA being granted permission to issue
+ certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255
+ used for CAA records.
+ "id": 0, # Optional. A unique identifier for each domain
+ record.
+ "name": "str", # Optional. The host name, alias, or service
+ being defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX
+ records.
+ "tag": "str", # Optional. The parameter tag for CAA records.
+ Valid values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the
+ record, in seconds. This defines the time frame that clients can cache
+ queried information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
+ }
+ # 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_domains_list_records_request(
+ domain_name=domain_name,
+ name=name,
+ type=type,
+ 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
+
+ @overload
+ def create_record(
+ self,
+ domain_name: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain Record.
+
+ To create a new record to a domain, send a POST request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
+
+ The request must include all of the required fields for the domain record type
+ being added.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective required attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
+ # response body for status code(s): 201
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
+ @overload
+ def create_record(
+ self,
+ domain_name: str,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain Record.
+
+ To create a new record to a domain, send a POST request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
+
+ The request must include all of the required fields for the domain record type
+ being added.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective required attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
+ @distributed_trace
+ def create_record(
+ self,
+ domain_name: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Domain Record.
+
+ To create a new record to a domain, send a POST request to
+ ``/v2/domains/$DOMAIN_NAME/records``.
+
+ The request must include all of the required fields for the domain record type
+ being added.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective required attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
+ # response body for status code(s): 201
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_domains_create_record_request(
+ domain_name=domain_name,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [201, 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 == 201:
+ 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 get_record(
+ self, domain_name: str, domain_record_id: int, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Existing Domain Record.
+
+ To retrieve a specific domain record, send a GET request to
+ ``/v2/domains/$DOMAIN_NAME/records/$RECORD_ID``.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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_domains_get_record_request(
+ domain_name=domain_name,
+ domain_record_id=domain_record_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
+
+ @overload
+ def patch_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Domain Record.
+
+ To update an existing record, send a PATCH request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
+ Required.
+ "data": "str", # Optional. Variable data depending on record type. For
+ example, the "data" value for an A record would be the IPv4 address to which the
+ domain will be mapped. For a CAA record, it would contain the domain name of the
+ CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
+ records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being defined by
+ the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid values
+ are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record, in
+ seconds. This defines the time frame that clients can cache queried information
+ before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
+ @overload
+ def patch_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Domain Record.
+
+ To update an existing record, send a PATCH request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
+ @distributed_trace
+ def patch_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Domain Record.
+
+ To update an existing record, send a PATCH request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
+ Required.
+ "data": "str", # Optional. Variable data depending on record type. For
+ example, the "data" value for an A record would be the IPv4 address to which the
+ domain will be mapped. For a CAA record, it would contain the domain name of the
+ CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
+ records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being defined by
+ the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid values
+ are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record, in
+ seconds. This defines the time frame that clients can cache queried information
+ before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_domains_patch_record_request(
+ domain_name=domain_name,
+ domain_record_id=domain_record_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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
+
+ @overload
+ def update_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Domain Record.
+
+ To update an existing record, send a PUT request to
+ ``/v2/domains/$DOMAIN_NAME/records/$DOMAIN_RECORD_ID``. Any attribute valid for
+ the record type can be set to a new value for the record.
+
+ See the `attribute table <#tag/Domain-Records>`_ for details regarding record
+ types and their respective attributes.
+
+ :param domain_name: The name of the domain itself. Required.
+ :type domain_name: str
+ :param domain_record_id: The unique identifier of the domain record. Required.
+ :type domain_record_id: int
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "type": "str", # The type of the DNS record. For example: A, CNAME, TXT, ...
+ Required.
+ "data": "str", # Optional. Variable data depending on record type. For
+ example, the "data" value for an A record would be the IPv4 address to which the
+ domain will be mapped. For a CAA record, it would contain the domain name of the
+ CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for CAA
+ records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being defined by
+ the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid values
+ are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record, in
+ seconds. This defines the time frame that clients can cache queried information
+ before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "domain_record": {
+ "type": "str", # The type of the DNS record. For example: A, CNAME,
+ TXT, ... Required.
+ "data": "str", # Optional. Variable data depending on record type.
+ For example, the "data" value for an A record would be the IPv4 address to
+ which the domain will be mapped. For a CAA record, it would contain the
+ domain name of the CA being granted permission to issue certificates.
+ "flags": 0, # Optional. An unsigned integer between 0-255 used for
+ CAA records.
+ "id": 0, # Optional. A unique identifier for each domain record.
+ "name": "str", # Optional. The host name, alias, or service being
+ defined by the record.
+ "port": 0, # Optional. The port for SRV records.
+ "priority": 0, # Optional. The priority for SRV and MX records.
+ "tag": "str", # Optional. The parameter tag for CAA records. Valid
+ values are "issue", "issuewild", or "iodef".
+ "ttl": 0, # Optional. This value is the time to live for the record,
+ in seconds. This defines the time frame that clients can cache queried
+ information before a refresh should be requested.
+ "weight": 0 # Optional. The weight for SRV records.
+ }
+ }
+ # 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.
+ }
+ """
+
+ @overload
+ def update_record(
+ self,
+ domain_name: str,
+ domain_record_id: int,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
"""Update a Domain Record.
@@ -182507,90 +185944,1006 @@ def create(
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To create your container registry, send a POST request to ``/v2/registry``.
+ To create your container registry, send a POST request to ``/v2/registry``.
+
+ The ``name`` becomes part of the URL for images stored in the registry. For
+ example, if your registry is called ``example``\\ , an image in it will have the
+ URL ``registry.digitalocean.com/example/image:tag``.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "registry": {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the registry
+ was created.
+ "name": "str", # Optional. A globally unique name for the container
+ registry. Must be lowercase and be composed only of numbers, letters and
+ ``-``"" , up to a limit of 63 characters.
+ "region": "str", # Optional. Slug of the region where registry data
+ is stored.
+ "storage_usage_bytes": 0, # Optional. The amount of storage used in
+ the registry in bytes.
+ "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
+ The time at which the storage usage was updated. Storage usage is calculated
+ asynchronously, and may not immediately reflect pushes to the registry.
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at
+ which the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The
+ amount of outbound data transfer included in the subscription tier in
+ bytes.
+ "included_repositories": 0, # Optional. The number
+ of repositories included in the subscription tier. ``0`` indicates
+ that the subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount
+ of storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly
+ cost of the subscription tier in cents.
+ "name": "str", # Optional. The name of the
+ subscription tier.
+ "slug": "str", # Optional. The slug identifier of
+ the subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The
+ price paid in cents per GiB for additional storage beyond what is
+ included in the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at
+ which the subscription was last updated.
+ }
+ }
+ }
+ """
+
+ @distributed_trace
+ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create Container Registry.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To create your container registry, send a POST request to ``/v2/registry``.
+
+ The ``name`` becomes part of the URL for images stored in the registry. For
+ example, if your registry is called ``example``\\ , an image in it will have the
+ URL ``registry.digitalocean.com/example/image:tag``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "name": "str", # A globally unique name for the container registry. Must be
+ lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
+ 63 characters. Required.
+ "subscription_tier_slug": "str", # The slug of the subscription tier to sign
+ up for. Valid values can be retrieved using the options endpoint. Required. Known
+ values are: "starter", "basic", and "professional".
+ "region": "str" # Optional. Slug of the region where registry data is
+ stored. When not provided, a region will be selected. Known values are: "nyc3",
+ "sfo3", "ams3", "sgp1", and "fra1".
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "registry": {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the registry
+ was created.
+ "name": "str", # Optional. A globally unique name for the container
+ registry. Must be lowercase and be composed only of numbers, letters and
+ ``-``"" , up to a limit of 63 characters.
+ "region": "str", # Optional. Slug of the region where registry data
+ is stored.
+ "storage_usage_bytes": 0, # Optional. The amount of storage used in
+ the registry in bytes.
+ "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
+ The time at which the storage usage was updated. Storage usage is calculated
+ asynchronously, and may not immediately reflect pushes to the registry.
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at
+ which the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The
+ amount of outbound data transfer included in the subscription tier in
+ bytes.
+ "included_repositories": 0, # Optional. The number
+ of repositories included in the subscription tier. ``0`` indicates
+ that the subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount
+ of storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly
+ cost of the subscription tier in cents.
+ "name": "str", # Optional. The name of the
+ subscription tier.
+ "slug": "str", # Optional. The slug identifier of
+ the subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The
+ price paid in cents per GiB for additional storage beyond what is
+ included in the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at
+ which the subscription was last updated.
+ }
+ }
+ }
+ """
+ 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_registry_create_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [201]:
+ 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 = {}
+ 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 delete(self, **kwargs: Any) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete Container Registry.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To delete your container registry, destroying all container image
+ data stored in it, send a DELETE request to ``/v2/registry``.
+
+ This operation is not compatible with multiple registries in a DO account. You should use
+ ``/v2/registries/{registry_name}`` instead.
+
+ :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, 412
+ 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_registry_delete_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 [204, 404, 412]:
+ 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 response.status_code == 412:
+ 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 get_subscription(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Get Subscription.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ A subscription is automatically created when you configure your
+ container registry. To get information about your subscription, send a GET
+ request to ``/v2/registry/subscription``.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ """
+ 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_registry_get_subscription_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]:
+ 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 = {}
+ 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
+
+ @overload
+ def update_subscription(
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Subscription Tier.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ After creating your registry, you can switch to a different
+ subscription tier to better suit your needs. To do this, send a POST request
+ to ``/v2/registry/subscription``.
+
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
+ for. Known values are: "starter", "basic", and "professional".
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ # response body for status code(s): 412
+ 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.
+ }
+ """
+
+ @overload
+ def update_subscription(
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Subscription Tier.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ After creating your registry, you can switch to a different
+ subscription tier to better suit your needs. To do this, send a POST request
+ to ``/v2/registry/subscription``.
+
+ :param body: Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ # response body for status code(s): 412
+ 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.
+ }
+ """
+
+ @distributed_trace
+ def update_subscription(
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Subscription Tier.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ After creating your registry, you can switch to a different
+ subscription tier to better suit your needs. To do this, send a POST request
+ to ``/v2/registry/subscription``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
+ for. Known values are: "starter", "basic", and "professional".
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "subscription": {
+ "created_at": "2020-02-20 00:00:00", # Optional. The time at which
+ the subscription was created.
+ "tier": {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "included_bandwidth_bytes": 0, # Optional. The amount of
+ outbound data transfer included in the subscription tier in bytes.
+ "included_repositories": 0, # Optional. The number of
+ repositories included in the subscription tier. ``0`` indicates that the
+ subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount of
+ storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly cost of
+ the subscription tier in cents.
+ "name": "str", # Optional. The name of the subscription
+ tier.
+ "slug": "str", # Optional. The slug identifier of the
+ subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The price
+ paid in cents per GiB for additional storage beyond what is included in
+ the subscription plan.
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
+ the subscription was last updated.
+ }
+ }
+ # response body for status code(s): 412
+ 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_registry_update_subscription_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, 412]:
+ 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 == 412:
+ 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 get_docker_credentials(
+ self, *, expiry_seconds: int = 0, read_write: bool = False, **kwargs: Any
+ ) -> JSON:
+ """Get Docker Credentials for Container Registry.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ In order to access your container registry with the Docker client or from a
+ Kubernetes cluster, you will need to configure authentication. The necessary
+ JSON configuration can be retrieved by sending a GET request to
+ ``/v2/registry/docker-credentials``.
+
+ The response will be in the format of a Docker ``config.json`` file. To use the
+ config in your Kubernetes cluster, create a Secret with:
+
+ .. code-block::
+
+ kubectl create secret generic docr \\
+ --from-file=.dockerconfigjson=config.json \\
+ --type=kubernetes.io/dockerconfigjson
+
+
+ By default, the returned credentials have read-only access to your registry
+ and cannot be used to push images. This is appropriate for most Kubernetes
+ clusters. To retrieve read/write credentials, suitable for use with the Docker
+ client or in a CI system, read_write may be provided as query parameter. For
+ example: ``/v2/registry/docker-credentials?read_write=true``
+
+ By default, the returned credentials will not expire. To retrieve credentials
+ with an expiry set, expiry_seconds may be provided as a query parameter. For
+ example: ``/v2/registry/docker-credentials?expiry_seconds=3600`` will return
+ credentials that expire after one hour.
+
+ :keyword expiry_seconds: The duration in seconds that the returned registry credentials will be
+ valid. If not set or 0, the credentials will not expire. Default value is 0.
+ :paramtype expiry_seconds: int
+ :keyword read_write: By default, the registry credentials allow for read-only access. Set this
+ query parameter to ``true`` to obtain read-write credentials. Default value is False.
+ :paramtype read_write: bool
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "auths": {
+ "registry.digitalocean.com": {
+ "auth": "str" # Optional. A base64 encoded string containing
+ credentials for the container registry.
+ }
+ }
+ }
+ """
+ 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_registry_get_docker_credentials_request(
+ expiry_seconds=expiry_seconds,
+ read_write=read_write,
+ 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]:
+ 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 = {}
+ 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
+
+ @overload
+ def validate_name(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Validate a Container Registry Name.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To validate that a container registry name is available for use, send a POST
+ request to ``/v2/registry/validate-name``.
+
+ If the name is both formatted correctly and available, the response code will
+ be 204 and contain no body. If the name is already in use, the response will
+ be a 409 Conflict.
+
+ :param body: Required.
+ :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: JSON object or None
+ :rtype: JSON or None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "name": "str" # A globally unique name for the container registry. Must be
+ lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
+ 63 characters. Required.
+ }
+
+ # response body for status code(s): 409
+ 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.
+ }
+ """
+
+ @overload
+ def validate_name(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Validate a Container Registry Name.
+
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+
+ To validate that a container registry name is available for use, send a POST
+ request to ``/v2/registry/validate-name``.
- The ``name`` becomes part of the URL for images stored in the registry. For
- example, if your registry is called ``example``\\ , an image in it will have the
- URL ``registry.digitalocean.com/example/image:tag``.
+ If the name is both formatted correctly and available, the response code will
+ be 204 and contain no body. If the name is already in use, the response will
+ be a 409 Conflict.
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 409
response == {
- "registry": {
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the registry
- was created.
- "name": "str", # Optional. A globally unique name for the container
- registry. Must be lowercase and be composed only of numbers, letters and
- ``-``"" , up to a limit of 63 characters.
- "region": "str", # Optional. Slug of the region where registry data
- is stored.
- "storage_usage_bytes": 0, # Optional. The amount of storage used in
- the registry in bytes.
- "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
- The time at which the storage usage was updated. Storage usage is calculated
- asynchronously, and may not immediately reflect pushes to the registry.
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at
- which the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The
- amount of outbound data transfer included in the subscription tier in
- bytes.
- "included_repositories": 0, # Optional. The number
- of repositories included in the subscription tier. ``0`` indicates
- that the subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount
- of storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly
- cost of the subscription tier in cents.
- "name": "str", # Optional. The name of the
- subscription tier.
- "slug": "str", # Optional. The slug identifier of
- the subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The
- price paid in cents per GiB for additional storage beyond what is
- included in the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at
- which the subscription was last updated.
- }
- }
+ "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.
}
"""
@distributed_trace
- def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ def validate_name(
+ self, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create Container Registry.
+ """Validate a Container Registry Name.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To create your container registry, send a POST request to ``/v2/registry``.
+ To validate that a container registry name is available for use, send a POST
+ request to ``/v2/registry/validate-name``.
- The ``name`` becomes part of the URL for images stored in the registry. For
- example, if your registry is called ``example``\\ , an image in it will have the
- URL ``registry.digitalocean.com/example/image:tag``.
+ If the name is both formatted correctly and available, the response code will
+ be 204 and contain no body. If the name is already in use, the response will
+ be a 409 Conflict.
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -182598,63 +186951,21 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A globally unique name for the container registry. Must be
+ "name": "str" # A globally unique name for the container registry. Must be
lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
63 characters. Required.
- "subscription_tier_slug": "str", # The slug of the subscription tier to sign
- up for. Valid values can be retrieved using the options endpoint. Required. Known
- values are: "starter", "basic", and "professional".
- "region": "str" # Optional. Slug of the region where registry data is
- stored. When not provided, a region will be selected. Known values are: "nyc3",
- "sfo3", "ams3", "sgp1", and "fra1".
}
- # response body for status code(s): 201
+ # response body for status code(s): 409
response == {
- "registry": {
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the registry
- was created.
- "name": "str", # Optional. A globally unique name for the container
- registry. Must be lowercase and be composed only of numbers, letters and
- ``-``"" , up to a limit of 63 characters.
- "region": "str", # Optional. Slug of the region where registry data
- is stored.
- "storage_usage_bytes": 0, # Optional. The amount of storage used in
- the registry in bytes.
- "storage_usage_bytes_updated_at": "2020-02-20 00:00:00", # Optional.
- The time at which the storage usage was updated. Storage usage is calculated
- asynchronously, and may not immediately reflect pushes to the registry.
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at
- which the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The
- amount of outbound data transfer included in the subscription tier in
- bytes.
- "included_repositories": 0, # Optional. The number
- of repositories included in the subscription tier. ``0`` indicates
- that the subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount
- of storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly
- cost of the subscription tier in cents.
- "name": "str", # Optional. The name of the
- subscription tier.
- "slug": "str", # Optional. The slug identifier of
- the subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The
- price paid in cents per GiB for additional storage beyond what is
- included in the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at
- which the subscription was last updated.
- }
- }
+ "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]] = {
@@ -182676,7 +186987,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -182686,7 +186997,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_registry_create_request(
+ _request = build_registry_validate_name_request(
content_type=content_type,
json=_json,
content=_content,
@@ -182704,54 +187015,109 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [201]:
+ if response.status_code not in [204, 409]:
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 = {}
- 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 == 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.content:
- deserialized = response.json()
- else:
- deserialized = None
+ if response.status_code == 409:
+ 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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@distributed_trace
- def delete(self, **kwargs: Any) -> Optional[JSON]:
+ def list_repositories(
+ self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete Container Registry.
+ """List All Container Registry Repositories.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To delete your container registry, destroying all container image
- data stored in it, send a DELETE request to ``/v2/registry``.
+ This endpoint has been deprecated in favor of the *List All Container Registry Repositories
+ [V2]* endpoint.
- This operation is not compatible with multiple registries in a DO account. You should use
- ``/v2/registries/{registry_name}`` instead.
+ To list all repositories in your container registry, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositories``.
- :return: JSON object or None
- :rtype: JSON or None
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :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): 404, 412
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "repositories": [
+ {
+ "latest_tag": {
+ "compressed_size_bytes": 0, # Optional. The
+ compressed size of the tag in bytes.
+ "manifest_digest": "str", # Optional. The digest of
+ the manifest associated with the tag.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the
+ repository.
+ "size_bytes": 0, # Optional. The uncompressed size
+ of the tag in bytes (this size is calculated asynchronously so it may
+ not be immediately available).
+ "tag": "str", # Optional. The name of the tag.
+ "updated_at": "2020-02-20 00:00:00" # Optional. The
+ time the tag was last updated.
+ },
+ "name": "str", # Optional. The name of the repository.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "tag_count": 0 # Optional. The number of tags in the
+ repository.
+ }
+ ]
+ }
+ # 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
@@ -182779,9 +187145,12 @@ def delete(self, **kwargs: Any) -> Optional[JSON]:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_delete_request(
+ _request = build_registry_list_repositories_request(
+ registry_name=registry_name,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -182796,26 +187165,14 @@ def delete(self, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404, 412]:
+ 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)
- 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:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -182831,7 +187188,7 @@ def delete(self, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
- if response.status_code == 412:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -182848,21 +187205,38 @@ def delete(self, **kwargs: Any) -> Optional[JSON]:
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_subscription(self, **kwargs: Any) -> JSON:
+ def list_repositories_v2(
+ self,
+ registry_name: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ page_token: Optional[str] = None,
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Get Subscription.
+ """List All Container Registry Repositories (V2).
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- A subscription is automatically created when you configure your
- container registry. To get information about your subscription, send a GET
- request to ``/v2/registry/subscription``.
+ To list all repositories in your container registry, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositoriesV2``.
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :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. Ignored when 'page_token' is
+ provided. Default value is 1.
+ :paramtype page: int
+ :keyword page_token: Token to retrieve of the next or previous set of results more quickly than
+ using 'page'. Default value is None.
+ :paramtype page_token: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -182872,34 +187246,60 @@ def get_subscription(self, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "repositories": [
+ {
+ "latest_manifest": {
+ "blobs": [
+ {
+ "compressed_size_bytes": 0, #
+ Optional. The compressed size of the blob in bytes.
+ "digest": "str" # Optional. The
+ digest of the blob.
+ }
+ ],
+ "compressed_size_bytes": 0, # Optional. The
+ compressed size of the manifest in bytes.
+ "digest": "str", # Optional. The manifest digest.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the
+ repository.
+ "size_bytes": 0, # Optional. The uncompressed size
+ of the manifest in bytes (this size is calculated asynchronously so
+ it may not be immediately available).
+ "tags": [
+ "str" # Optional. All tags associated with
+ this manifest.
+ ],
+ "updated_at": "2020-02-20 00:00:00" # Optional. The
+ time the manifest was last updated.
+ },
+ "manifest_count": 0, # Optional. The number of manifests in
+ the repository.
+ "name": "str", # Optional. The name of the repository.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "tag_count": 0 # Optional. The number of tags in the
+ repository.
+ }
+ ]
+ }
+ # response body for status code(s): 400, 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]] = {
@@ -182920,7 +187320,11 @@ def get_subscription(self, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_get_subscription_request(
+ _request = build_registry_list_repositories_v2_request(
+ registry_name=registry_name,
+ per_page=per_page,
+ page=page,
+ page_token=page_token,
headers=_headers,
params=_params,
)
@@ -182935,55 +187339,98 @@ def get_subscription(self, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ if response.status_code not in [200, 400, 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 = {}
- 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 == 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ 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
- @overload
- def update_subscription(
+ @distributed_trace
+ def list_repository_tags(
self,
- body: Optional[JSON] = None,
+ registry_name: str,
+ repository_name: str,
*,
- content_type: str = "application/json",
+ per_page: int = 20,
+ page: int = 1,
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update Subscription Tier.
+ """List All Container Registry Repository Tags.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- After creating your registry, you can switch to a different
- subscription tier to better suit your needs. To do this, send a POST request
- to ``/v2/registry/subscription``.
+ To list all tags in your container registry repository, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags``.
- :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
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to list tags for
+ ``registry.digitalocean.com/example/my/repo``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/tags``.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :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:
@@ -182991,44 +187438,33 @@ def update_subscription(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
- for. Known values are: "starter", "basic", and "professional".
- }
-
# response body for status code(s): 200
response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "tags": [
+ {
+ "compressed_size_bytes": 0, # Optional. The compressed size
+ of the tag in bytes.
+ "manifest_digest": "str", # Optional. The digest of the
+ manifest associated with the tag.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the repository.
+ "size_bytes": 0, # Optional. The uncompressed size of the
+ tag in bytes (this size is calculated asynchronously so it may not be
+ immediately available).
+ "tag": "str", # Optional. The name of the tag.
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time the
+ tag was last updated.
+ }
+ ]
}
- # response body for status code(s): 412
+ # 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
@@ -183040,68 +187476,126 @@ def update_subscription(
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 {})
- @overload
- def update_subscription(
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_registry_list_repository_tags_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ 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 delete_repository_tag(
self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
+ registry_name: str,
+ repository_name: str,
+ repository_tag: str,
**kwargs: Any,
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Update Subscription Tier.
+ """Delete Container Registry Repository Tag.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- After creating your registry, you can switch to a different
- subscription tier to better suit your needs. To do this, send a POST request
- to ``/v2/registry/subscription``.
+ To delete a container repository tag, send a DELETE request to
+ ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags/$TAG``.
- :param body: Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to delete
+ ``registry.digitalocean.com/example/my/repo:mytag``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/tags/mytag``.
+
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :param repository_tag: The name of a container registry repository tag. Required.
+ :type repository_tag: 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): 200
- response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
- }
- # response body for status code(s): 412
+ # 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
@@ -183113,22 +187607,114 @@ def update_subscription(
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_registry_delete_repository_tag_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ repository_tag=repository_tag,
+ 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 update_subscription(
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ def list_repository_manifests(
+ self,
+ registry_name: str,
+ repository_name: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update Subscription Tier.
+ """List All Container Registry Repository Manifests.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- After creating your registry, you can switch to a different
- subscription tier to better suit your needs. To do this, send a POST request
- to ``/v2/registry/subscription``.
+ To list all manifests in your container registry repository, send a GET
+ request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests``.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to list manifests for
+ ``registry.digitalocean.com/example/my/repo``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/digests``.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :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:
@@ -183136,44 +187722,43 @@ def update_subscription(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "tier_slug": "str" # Optional. The slug of the subscription tier to sign up
- for. Known values are: "starter", "basic", and "professional".
- }
-
# response body for status code(s): 200
response == {
- "subscription": {
- "created_at": "2020-02-20 00:00:00", # Optional. The time at which
- the subscription was created.
- "tier": {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "included_bandwidth_bytes": 0, # Optional. The amount of
- outbound data transfer included in the subscription tier in bytes.
- "included_repositories": 0, # Optional. The number of
- repositories included in the subscription tier. ``0`` indicates that the
- subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount of
- storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly cost of
- the subscription tier in cents.
- "name": "str", # Optional. The name of the subscription
- tier.
- "slug": "str", # Optional. The slug identifier of the
- subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The price
- paid in cents per GiB for additional storage beyond what is included in
- the subscription plan.
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. The time at which
- the subscription was last updated.
- }
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "manifests": [
+ {
+ "blobs": [
+ {
+ "compressed_size_bytes": 0, # Optional. The
+ compressed size of the blob in bytes.
+ "digest": "str" # Optional. The digest of
+ the blob.
+ }
+ ],
+ "compressed_size_bytes": 0, # Optional. The compressed size
+ of the manifest in bytes.
+ "digest": "str", # Optional. The manifest digest.
+ "registry_name": "str", # Optional. The name of the
+ container registry.
+ "repository": "str", # Optional. The name of the repository.
+ "size_bytes": 0, # Optional. The uncompressed size of the
+ manifest in bytes (this size is calculated asynchronously so it may not
+ be immediately available).
+ "tags": [
+ "str" # Optional. All tags associated with this
+ manifest.
+ ],
+ "updated_at": "2020-02-20 00:00:00" # Optional. The time the
+ manifest was last updated.
+ }
+ ]
}
- # response body for status code(s): 412
+ # 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
@@ -183198,29 +187783,16 @@ def update_subscription(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- content_type: Optional[str] = kwargs.pop(
- "content_type", _headers.pop("Content-Type", None)
- )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- content_type = content_type or "application/json"
- _json = None
- _content = None
- if isinstance(body, (IOBase, bytes)):
- _content = body
- else:
- if body is not None:
- _json = body
- else:
- _json = None
-
- _request = build_registry_update_subscription_request(
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_registry_list_repository_manifests_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -183235,7 +187807,7 @@ def update_subscription(
response = pipeline_response.http_response
- if response.status_code not in [200, 412]:
+ 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
@@ -183258,7 +187830,7 @@ def update_subscription(
else:
deserialized = None
- if response.status_code == 412:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -183280,60 +187852,53 @@ def update_subscription(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_docker_credentials(
- self, *, expiry_seconds: int = 0, read_write: bool = False, **kwargs: Any
- ) -> JSON:
- """Get Docker Credentials for Container Registry.
+ def delete_repository_manifest(
+ self,
+ registry_name: str,
+ repository_name: str,
+ manifest_digest: str,
+ **kwargs: Any,
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete Container Registry Repository Manifest.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- In order to access your container registry with the Docker client or from a
- Kubernetes cluster, you will need to configure authentication. The necessary
- JSON configuration can be retrieved by sending a GET request to
- ``/v2/registry/docker-credentials``.
-
- The response will be in the format of a Docker ``config.json`` file. To use the
- config in your Kubernetes cluster, create a Secret with:
-
- .. code-block::
-
- kubectl create secret generic docr \\
- --from-file=.dockerconfigjson=config.json \\
- --type=kubernetes.io/dockerconfigjson
-
+ To delete a container repository manifest by digest, send a DELETE request to
+ ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests/$MANIFEST_DIGEST``.
- By default, the returned credentials have read-only access to your registry
- and cannot be used to push images. This is appropriate for most Kubernetes
- clusters. To retrieve read/write credentials, suitable for use with the Docker
- client or in a CI system, read_write may be provided as query parameter. For
- example: ``/v2/registry/docker-credentials?read_write=true``
+ Note that if your repository name contains ``/`` characters, it must be
+ URL-encoded in the request URL. For example, to delete
+ ``registry.digitalocean.com/example/my/repo@sha256:abcd``\\ , the path would be
+ ``/v2/registry/example/repositories/my%2Frepo/digests/sha256:abcd``.
- By default, the returned credentials will not expire. To retrieve credentials
- with an expiry set, expiry_seconds may be provided as a query parameter. For
- example: ``/v2/registry/docker-credentials?expiry_seconds=3600`` will return
- credentials that expire after one hour.
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
- :keyword expiry_seconds: The duration in seconds that the returned registry credentials will be
- valid. If not set or 0, the credentials will not expire. Default value is 0.
- :paramtype expiry_seconds: int
- :keyword read_write: By default, the registry credentials allow for read-only access. Set this
- query parameter to ``true`` to obtain read-write credentials. Default value is False.
- :paramtype read_write: bool
- :return: JSON object
- :rtype: JSON
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param repository_name: The name of a container registry repository. If the name contains ``/``
+ characters, they must be URL-encoded, e.g. ``%2F``. Required.
+ :type repository_name: str
+ :param manifest_digest: The manifest digest of a container registry repository tag. Required.
+ :type manifest_digest: 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): 200
+ # response body for status code(s): 404
response == {
- "auths": {
- "registry.digitalocean.com": {
- "auth": "str" # Optional. A base64 encoded string containing
- credentials for the container registry.
- }
- }
+ "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]] = {
@@ -183352,11 +187917,12 @@ def get_docker_credentials(
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_registry_get_docker_credentials_request(
- expiry_seconds=expiry_seconds,
- read_write=read_write,
+ _request = build_registry_delete_repository_manifest_request(
+ registry_name=registry_name,
+ repository_name=repository_name,
+ manifest_digest=manifest_digest,
headers=_headers,
params=_params,
)
@@ -183371,56 +187937,93 @@ def get_docker_credentials(
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@overload
- def validate_name(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
- ) -> Optional[JSON]:
+ def run_garbage_collection(
+ self,
+ registry_name: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Validate a Container Registry Name.
+ """Start Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To validate that a container registry name is available for use, send a POST
- request to ``/v2/registry/validate-name``.
+ Garbage collection enables users to clear out unreferenced blobs (layer &
+ manifest data) after deleting one or more manifests from a repository. If
+ there are no unreferenced blobs resulting from the deletion of one or more
+ manifests, garbage collection is effectively a noop.
+ `See here for more information
+ `_
+ about how and why you should clean up your container registry periodically.
- If the name is both formatted correctly and available, the response code will
- be 204 and contain no body. If the name is already in use, the response will
- be a 409 Conflict.
+ To request a garbage collection run on your registry, send a POST request to
+ ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
+ following sequence of events on your registry.
- :param body: Required.
+
+ * Set the registry to read-only mode, meaning no further write-scoped
+ JWTs will be issued to registry clients. Existing write-scoped JWTs will
+ continue to work until they expire which can take up to 15 minutes.
+ * Wait until all existing write-scoped JWTs have expired.
+ * Scan all registry manifests to determine which blobs are unreferenced.
+ * Delete all unreferenced blobs from the registry.
+ * Record the number of blobs deleted and bytes freed, mark the garbage
+ collection status as ``success``.
+ * Remove the read-only mode restriction from the registry, meaning write-scoped
+ JWTs will once again be issued to registry clients.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :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: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -183428,12 +188031,33 @@ def validate_name(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str" # A globally unique name for the container registry. Must be
- lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
- 63 characters. Required.
+ "type": "str" # Optional. Type of the garbage collection to run against this
+ registry. Known values are: "untagged manifests only", "unreferenced blobs only",
+ and "untagged manifests and unreferenced blobs".
}
- # response body for status code(s): 409
+ # response body for status code(s): 201
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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
@@ -183447,34 +188071,79 @@ def validate_name(
"""
@overload
- def validate_name(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
- ) -> Optional[JSON]:
+ def run_garbage_collection(
+ self,
+ registry_name: str,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Validate a Container Registry Name.
+ """Start Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To validate that a container registry name is available for use, send a POST
- request to ``/v2/registry/validate-name``.
+ Garbage collection enables users to clear out unreferenced blobs (layer &
+ manifest data) after deleting one or more manifests from a repository. If
+ there are no unreferenced blobs resulting from the deletion of one or more
+ manifests, garbage collection is effectively a noop.
+ `See here for more information
+ `_
+ about how and why you should clean up your container registry periodically.
- If the name is both formatted correctly and available, the response code will
- be 204 and contain no body. If the name is already in use, the response will
- be a 409 Conflict.
+ To request a garbage collection run on your registry, send a POST request to
+ ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
+ following sequence of events on your registry.
- :param body: Required.
+
+ * Set the registry to read-only mode, meaning no further write-scoped
+ JWTs will be issued to registry clients. Existing write-scoped JWTs will
+ continue to work until they expire which can take up to 15 minutes.
+ * Wait until all existing write-scoped JWTs have expired.
+ * Scan all registry manifests to determine which blobs are unreferenced.
+ * Delete all unreferenced blobs from the registry.
+ * Record the number of blobs deleted and bytes freed, mark the garbage
+ collection status as ``success``.
+ * Remove the read-only mode restriction from the registry, meaning write-scoped
+ JWTs will once again be issued to registry clients.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param body: Default value is None.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 409
+ # response body for status code(s): 201
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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
@@ -183488,25 +188157,47 @@ def validate_name(
"""
@distributed_trace
- def validate_name(
- self, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
+ def run_garbage_collection(
+ self,
+ registry_name: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Validate a Container Registry Name.
+ """Start Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To validate that a container registry name is available for use, send a POST
- request to ``/v2/registry/validate-name``.
+ Garbage collection enables users to clear out unreferenced blobs (layer &
+ manifest data) after deleting one or more manifests from a repository. If
+ there are no unreferenced blobs resulting from the deletion of one or more
+ manifests, garbage collection is effectively a noop.
+ `See here for more information
+ `_
+ about how and why you should clean up your container registry periodically.
- If the name is both formatted correctly and available, the response code will
- be 204 and contain no body. If the name is already in use, the response will
- be a 409 Conflict.
+ To request a garbage collection run on your registry, send a POST request to
+ ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
+ following sequence of events on your registry.
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+
+ * Set the registry to read-only mode, meaning no further write-scoped
+ JWTs will be issued to registry clients. Existing write-scoped JWTs will
+ continue to work until they expire which can take up to 15 minutes.
+ * Wait until all existing write-scoped JWTs have expired.
+ * Scan all registry manifests to determine which blobs are unreferenced.
+ * Delete all unreferenced blobs from the registry.
+ * Record the number of blobs deleted and bytes freed, mark the garbage
+ collection status as ``success``.
+ * Remove the read-only mode restriction from the registry, meaning write-scoped
+ JWTs will once again be issued to registry clients.
+
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
:type body: JSON or IO[bytes]
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -183514,12 +188205,33 @@ def validate_name(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str" # A globally unique name for the container registry. Must be
- lowercase and be composed only of numbers, letters and ``-``"" , up to a limit of
- 63 characters. Required.
+ "type": "str" # Optional. Type of the garbage collection to run against this
+ registry. Known values are: "untagged manifests only", "unreferenced blobs only",
+ and "untagged manifests and unreferenced blobs".
}
- # response body for status code(s): 409
+ # response body for status code(s): 201
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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
@@ -183550,7 +188262,7 @@ def validate_name(
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -183558,9 +188270,13 @@ def validate_name(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_registry_validate_name_request(
+ _request = build_registry_run_garbage_collection_request(
+ registry_name=registry_name,
content_type=content_type,
json=_json,
content=_content,
@@ -183578,15 +188294,14 @@ def validate_name(
response = pipeline_response.http_response
- if response.status_code not in [204, 409]:
+ if response.status_code not in [201, 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:
+ if response.status_code == 201:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -183597,7 +188312,12 @@ def validate_name(
"int", response.headers.get("ratelimit-reset")
)
- if response.status_code == 409:
+ 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")
)
@@ -183614,31 +188334,22 @@ def validate_name(
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def list_repositories(
- self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repositories.
+ """Get Active Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- This endpoint has been deprecated in favor of the *List All Container Registry Repositories
- [V2]* endpoint.
-
- To list all repositories in your container registry, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositories``.
+ To get information about the currently-active garbage collection
+ for a registry, send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collection``.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
- :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:
@@ -183648,37 +188359,24 @@ def list_repositories(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "repositories": [
- {
- "latest_tag": {
- "compressed_size_bytes": 0, # Optional. The
- compressed size of the tag in bytes.
- "manifest_digest": "str", # Optional. The digest of
- the manifest associated with the tag.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the
- repository.
- "size_bytes": 0, # Optional. The uncompressed size
- of the tag in bytes (this size is calculated asynchronously so it may
- not be immediately available).
- "tag": "str", # Optional. The name of the tag.
- "updated_at": "2020-02-20 00:00:00" # Optional. The
- time the tag was last updated.
- },
- "name": "str", # Optional. The name of the repository.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "tag_count": 0 # Optional. The number of tags in the
- repository.
- }
- ]
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
}
# response body for status code(s): 404
response == {
@@ -183710,10 +188408,8 @@ def list_repositories(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_repositories_request(
+ _request = build_registry_get_garbage_collection_request(
registry_name=registry_name,
- per_page=per_page,
- page=page,
headers=_headers,
params=_params,
)
@@ -183773,33 +188469,23 @@ def list_repositories(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def list_repositories_v2(
- self,
- registry_name: str,
- *,
- per_page: int = 20,
- page: int = 1,
- page_token: Optional[str] = None,
- **kwargs: Any,
+ def list_garbage_collections(
+ self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repositories (V2).
+ """List Garbage Collections.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To list all repositories in your container registry, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositoriesV2``.
+ To get information about past garbage collections for a registry,
+ send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collections``.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
: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. Ignored when 'page_token' is
- provided. Default value is 1.
+ :keyword page: Which 'page' of paginated results to return. Default value is 1.
:paramtype page: int
- :keyword page_token: Token to retrieve of the next or previous set of results more quickly than
- using 'page'. Default value is None.
- :paramtype page_token: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -183809,51 +188495,28 @@ def list_repositories_v2(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "repositories": [
+ "garbage_collections": [
{
- "latest_manifest": {
- "blobs": [
- {
- "compressed_size_bytes": 0, #
- Optional. The compressed size of the blob in bytes.
- "digest": "str" # Optional. The
- digest of the blob.
- }
- ],
- "compressed_size_bytes": 0, # Optional. The
- compressed size of the manifest in bytes.
- "digest": "str", # Optional. The manifest digest.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the
- repository.
- "size_bytes": 0, # Optional. The uncompressed size
- of the manifest in bytes (this size is calculated asynchronously so
- it may not be immediately available).
- "tags": [
- "str" # Optional. All tags associated with
- this manifest.
- ],
- "updated_at": "2020-02-20 00:00:00" # Optional. The
- time the manifest was last updated.
- },
- "manifest_count": 0, # Optional. The number of manifests in
- the repository.
- "name": "str", # Optional. The name of the repository.
+ "blobs_deleted": 0, # Optional. The number of blobs deleted
+ as a result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time
+ the garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a
+ result of this garbage collection.
"registry_name": "str", # Optional. The name of the
container registry.
- "tag_count": 0 # Optional. The number of tags in the
- repository.
+ "status": "str", # Optional. The current status of this
+ garbage collection. Known values are: "requested", "waiting for write
+ JWTs to expire", "scanning manifests", "deleting unreferenced blobs",
+ "cancelling", "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time
+ the garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of
+ the garbage collection.
}
]
}
- # response body for status code(s): 400, 404
+ # 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
@@ -183883,11 +188546,10 @@ def list_repositories_v2(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_repositories_v2_request(
+ _request = build_registry_list_garbage_collections_request(
registry_name=registry_name,
per_page=per_page,
page=page,
- page_token=page_token,
headers=_headers,
params=_params,
)
@@ -183902,7 +188564,7 @@ def list_repositories_v2(
response = pipeline_response.http_response
- if response.status_code not in [200, 400, 404]:
+ 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
@@ -183925,22 +188587,6 @@ def list_repositories_v2(
else:
deserialized = None
- if response.status_code == 400:
- 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")
@@ -183962,38 +188608,34 @@ def list_repositories_v2(
return cast(JSON, deserialized) # type: ignore
- @distributed_trace
- def list_repository_tags(
+ @overload
+ def update_garbage_collection(
self,
registry_name: str,
- repository_name: str,
+ garbage_collection_uuid: str,
+ body: JSON,
*,
- per_page: int = 20,
- page: int = 1,
+ content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repository Tags.
+ """Update Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To list all tags in your container registry repository, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags``.
-
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to list tags for
- ``registry.digitalocean.com/example/my/repo``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/tags``.
+ To cancel the currently-active garbage collection for a registry,
+ send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
+ and specify one or more of the attributes below.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :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
+ :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
+ :type garbage_collection_uuid: str
+ :param body: Required.
+ :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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -184001,31 +188643,32 @@ def list_repository_tags(
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cancel": bool # Optional. A boolean value indicating that the garbage
+ collection should be cancelled.
+ }
+
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "tags": [
- {
- "compressed_size_bytes": 0, # Optional. The compressed size
- of the tag in bytes.
- "manifest_digest": "str", # Optional. The digest of the
- manifest associated with the tag.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the repository.
- "size_bytes": 0, # Optional. The uncompressed size of the
- tag in bytes (this size is calculated asynchronously so it may not be
- immediately available).
- "tag": "str", # Optional. The name of the tag.
- "updated_at": "2020-02-20 00:00:00" # Optional. The time the
- tag was last updated.
- }
- ]
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
}
# response body for status code(s): 404
response == {
@@ -184039,125 +188682,133 @@ def list_repository_tags(
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_registry_list_repository_tags_request(
- registry_name=registry_name,
- repository_name=repository_name,
- 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")
- )
+ @overload
+ def update_garbage_collection(
+ self,
+ registry_name: str,
+ garbage_collection_uuid: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Garbage Collection.
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- 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")
- )
+ To cancel the currently-active garbage collection for a registry,
+ send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
+ and specify one or more of the attributes below.
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ :param registry_name: The name of a container registry. Required.
+ :type registry_name: str
+ :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
+ :type garbage_collection_uuid: str
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
- if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ Example:
+ .. code-block:: python
- return cast(JSON, deserialized) # type: ignore
+ # response body for status code(s): 200
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
+ # 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.
+ }
+ """
@distributed_trace
- def delete_repository_tag(
+ def update_garbage_collection(
self,
registry_name: str,
- repository_name: str,
- repository_tag: str,
+ garbage_collection_uuid: str,
+ body: Union[JSON, IO[bytes]],
**kwargs: Any,
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete Container Registry Repository Tag.
+ """Update Garbage Collection.
**Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
- To delete a container repository tag, send a DELETE request to
- ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/tags/$TAG``.
-
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to delete
- ``registry.digitalocean.com/example/my/repo:mytag``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/tags/mytag``.
-
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ To cancel the currently-active garbage collection for a registry,
+ send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
+ and specify one or more of the attributes below.
:param registry_name: The name of a container registry. Required.
:type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :param repository_tag: The name of a container registry repository tag. Required.
- :type repository_tag: str
- :return: JSON object or None
- :rtype: JSON or None
+ :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
+ :type garbage_collection_uuid: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cancel": bool # Optional. A boolean value indicating that the garbage
+ collection should be cancelled.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "garbage_collection": {
+ "blobs_deleted": 0, # Optional. The number of blobs deleted as a
+ result of this garbage collection.
+ "created_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was created.
+ "freed_bytes": 0, # Optional. The number of bytes freed as a result
+ of this garbage collection.
+ "registry_name": "str", # Optional. The name of the container
+ registry.
+ "status": "str", # Optional. The current status of this garbage
+ collection. Known values are: "requested", "waiting for write JWTs to
+ expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
+ "failed", "succeeded", and "cancelled".
+ "updated_at": "2020-02-20 00:00:00", # Optional. The time the
+ garbage collection was last updated.
+ "uuid": "str" # Optional. A string specifying the UUID of the
+ garbage collection.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -184183,15 +188834,28 @@ def delete_repository_tag(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_delete_repository_tag_request(
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_registry_update_garbage_collection_request(
registry_name=registry_name,
- repository_name=repository_name,
- repository_tag=repository_tag,
+ garbage_collection_uuid=garbage_collection_uuid,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -184206,15 +188870,14 @@ def delete_repository_tag(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ 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)
- deserialized = None
response_headers = {}
- if response.status_code == 204:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -184225,6 +188888,11 @@ def delete_repository_tag(
"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")
@@ -184242,42 +188910,32 @@ def delete_repository_tag(
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def list_repository_manifests(
- self,
- registry_name: str,
- repository_name: str,
- *,
- per_page: int = 20,
- page: int = 1,
- **kwargs: Any,
- ) -> JSON:
+ def get_options(self, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Container Registry Repository Manifests.
+ """List Registry Options (Subscription Tiers and Available Regions).
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ **Note: This endpoint is deprecated and may be removed in a future version. There is no
+ alternative.****\\ Note: This endpoint is deprecated. Please use the ``/v2/registries``
+ endpoint instead.**
- To list all manifests in your container registry repository, send a GET
- request to ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests``.
+ This endpoint serves to provide additional information as to which option values
+ are available when creating a container registry.
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to list manifests for
- ``registry.digitalocean.com/example/my/repo``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/digests``.
+ There are multiple subscription tiers available for container registry. Each
+ tier allows a different number of image repositories to be created in your
+ registry, and has a different amount of storage and transfer included.
+
+ There are multiple regions available for container registry and controls
+ where your data is stored.
+
+ To list the available options, send a GET request to
+ ``/v2/registry/options``.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :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:
@@ -184287,50 +188945,43 @@ def list_repository_manifests(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "manifests": [
- {
- "blobs": [
- {
- "compressed_size_bytes": 0, # Optional. The
- compressed size of the blob in bytes.
- "digest": "str" # Optional. The digest of
- the blob.
- }
- ],
- "compressed_size_bytes": 0, # Optional. The compressed size
- of the manifest in bytes.
- "digest": "str", # Optional. The manifest digest.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "repository": "str", # Optional. The name of the repository.
- "size_bytes": 0, # Optional. The uncompressed size of the
- manifest in bytes (this size is calculated asynchronously so it may not
- be immediately available).
- "tags": [
- "str" # Optional. All tags associated with this
- manifest.
- ],
- "updated_at": "2020-02-20 00:00:00" # Optional. The time the
- manifest was last updated.
- }
- ]
- }
- # 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.
+ "options": {
+ "available_regions": [
+ "str" # Optional.
+ ],
+ "subscription_tiers": [
+ {
+ "allow_storage_overage": bool, # Optional. A boolean
+ indicating whether the subscription tier supports additional storage
+ above what is included in the base plan at an additional cost per GiB
+ used.
+ "eligibility_reasons": [
+ "str" # Optional. If your account is not
+ eligible to use a certain subscription tier, this will include a
+ list of reasons that prevent you from using the tier.
+ ],
+ "eligible": bool, # Optional. A boolean indicating
+ whether your account it eligible to use a certain subscription tier.
+ "included_bandwidth_bytes": 0, # Optional. The
+ amount of outbound data transfer included in the subscription tier in
+ bytes.
+ "included_repositories": 0, # Optional. The number
+ of repositories included in the subscription tier. ``0`` indicates
+ that the subscription tier includes unlimited repositories.
+ "included_storage_bytes": 0, # Optional. The amount
+ of storage included in the subscription tier in bytes.
+ "monthly_price_in_cents": 0, # Optional. The monthly
+ cost of the subscription tier in cents.
+ "name": "str", # Optional. The name of the
+ subscription tier.
+ "slug": "str", # Optional. The slug identifier of
+ the subscription tier.
+ "storage_overage_price_in_cents": 0 # Optional. The
+ price paid in cents per GiB for additional storage beyond what is
+ included in the subscription plan.
+ }
+ ]
+ }
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -184351,11 +189002,7 @@ def list_repository_manifests(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_repository_manifests_request(
- registry_name=registry_name,
- repository_name=repository_name,
- per_page=per_page,
- page=page,
+ _request = build_registry_get_options_request(
headers=_headers,
params=_params,
)
@@ -184370,98 +189017,112 @@ def list_repository_manifests(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [200]:
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")
- )
+ 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.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 delete_repository_manifest(
- self,
- registry_name: str,
- repository_name: str,
- manifest_digest: str,
- **kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Delete Container Registry Repository Manifest.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+class ReservedIPsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
- To delete a container repository manifest by digest, send a DELETE request to
- ``/v2/registry/$REGISTRY_NAME/repositories/$REPOSITORY_NAME/digests/$MANIFEST_DIGEST``.
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`reserved_ips` attribute.
+ """
- Note that if your repository name contains ``/`` characters, it must be
- URL-encoded in the request URL. For example, to delete
- ``registry.digitalocean.com/example/my/repo@sha256:abcd``\\ , the path would be
- ``/v2/registry/example/repositories/my%2Frepo/digests/sha256:abcd``.
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ @distributed_trace
+ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Reserved IPs.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param repository_name: The name of a container registry repository. If the name contains ``/``
- characters, they must be URL-encoded, e.g. ``%2F``. Required.
- :type repository_name: str
- :param manifest_digest: The manifest digest of a container registry repository tag. Required.
- :type manifest_digest: str
- :return: JSON object or None
- :rtype: JSON or None
+ To list all of the reserved IPs available on your account, send a GET request to
+ ``/v2/reserved_ips``.
+
+ :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): 404
+ # response body for status code(s): 200
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.
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "reserved_ips": [
+ {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the
+ reserved IP. It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating
+ whether or not the reserved IP has pending actions preventing new ones
+ from being submitted.
+ "project_id": "str", # Optional. The UUID of the project to
+ which the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that
+ represents whether new Droplets can be created in this region.
+ Required.
+ "features": [
+ "str" # This attribute is set to an array
+ which contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region.
+ This will be a full name that is used in the control panel and other
+ interfaces. Required.
+ "sizes": [
+ "str" # This attribute is set to an array
+ which contains the identifying slugs for the sizes available in
+ this region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used
+ as a unique identifier for each region. Required.
+ }
+ }
+ ]
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -184480,12 +189141,11 @@ def delete_repository_manifest(
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_delete_repository_manifest_request(
- registry_name=registry_name,
- repository_name=repository_name,
- manifest_digest=manifest_digest,
+ _request = build_reserved_ips_list_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -184500,87 +189160,52 @@ def delete_repository_manifest(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [200]:
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")
- )
+ 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@overload
- def run_garbage_collection(
- self,
- registry_name: str,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
+ def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Start Garbage Collection.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """Create a New Reserved IP.
- Garbage collection enables users to clear out unreferenced blobs (layer &
- manifest data) after deleting one or more manifests from a repository. If
- there are no unreferenced blobs resulting from the deletion of one or more
- manifests, garbage collection is effectively a noop.
- `See here for more information
- `_
- about how and why you should clean up your container registry periodically.
+ On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
- To request a garbage collection run on your registry, send a POST request to
- ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
- following sequence of events on your registry.
+ *
+ To create a new reserved IP assigned to a Droplet, send a POST
+ request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- * Set the registry to read-only mode, meaning no further write-scoped
- JWTs will be issued to registry clients. Existing write-scoped JWTs will
- continue to work until they expire which can take up to 15 minutes.
- * Wait until all existing write-scoped JWTs have expired.
- * Scan all registry manifests to determine which blobs are unreferenced.
- * Delete all unreferenced blobs from the registry.
- * Record the number of blobs deleted and bytes freed, mark the garbage
- collection status as ``success``.
- * Remove the read-only mode restriction from the registry, meaning write-scoped
- JWTs will once again be issued to registry clients.
+ *
+ To create a new reserved IP reserved to a region, send a POST request to
+ ``/v2/reserved_ips`` with the ``region`` attribute.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param body: Default value is None.
+ :param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
@@ -184593,87 +189218,83 @@ def run_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "type": "str" # Optional. Type of the garbage collection to run against this
- registry. Known values are: "untagged manifests only", "unreferenced blobs only",
- and "untagged manifests and unreferenced blobs".
- }
+ body = {}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "links": {
+ "actions": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ],
+ "droplets": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ]
+ },
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
}
}
- # 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.
- }
"""
@overload
- def run_garbage_collection(
- self,
- registry_name: str,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
+ def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Start Garbage Collection.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """Create a New Reserved IP.
- Garbage collection enables users to clear out unreferenced blobs (layer &
- manifest data) after deleting one or more manifests from a repository. If
- there are no unreferenced blobs resulting from the deletion of one or more
- manifests, garbage collection is effectively a noop.
- `See here for more information
- `_
- about how and why you should clean up your container registry periodically.
+ On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
- To request a garbage collection run on your registry, send a POST request to
- ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
- following sequence of events on your registry.
+ *
+ To create a new reserved IP assigned to a Droplet, send a POST
+ request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- * Set the registry to read-only mode, meaning no further write-scoped
- JWTs will be issued to registry clients. Existing write-scoped JWTs will
- continue to work until they expire which can take up to 15 minutes.
- * Wait until all existing write-scoped JWTs have expired.
- * Scan all registry manifests to determine which blobs are unreferenced.
- * Delete all unreferenced blobs from the registry.
- * Record the number of blobs deleted and bytes freed, mark the garbage
- collection status as ``success``.
- * Remove the read-only mode restriction from the registry, meaning write-scoped
- JWTs will once again be issued to registry clients.
+ *
+ To create a new reserved IP reserved to a region, send a POST request to
+ ``/v2/reserved_ips`` with the ``region`` attribute.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param body: Default value is None.
+ :param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -184685,79 +189306,79 @@ def run_garbage_collection(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "links": {
+ "actions": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ],
+ "droplets": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ]
+ },
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
}
}
- # 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.
- }
"""
@distributed_trace
- def run_garbage_collection(
- self,
- registry_name: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any,
- ) -> JSON:
+ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Start Garbage Collection.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """Create a New Reserved IP.
- Garbage collection enables users to clear out unreferenced blobs (layer &
- manifest data) after deleting one or more manifests from a repository. If
- there are no unreferenced blobs resulting from the deletion of one or more
- manifests, garbage collection is effectively a noop.
- `See here for more information
- `_
- about how and why you should clean up your container registry periodically.
+ On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
- To request a garbage collection run on your registry, send a POST request to
- ``/v2/registry/$REGISTRY_NAME/garbage-collection``. This will initiate the
- following sequence of events on your registry.
+ *
+ To create a new reserved IP assigned to a Droplet, send a POST
+ request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- * Set the registry to read-only mode, meaning no further write-scoped
- JWTs will be issued to registry clients. Existing write-scoped JWTs will
- continue to work until they expire which can take up to 15 minutes.
- * Wait until all existing write-scoped JWTs have expired.
- * Scan all registry manifests to determine which blobs are unreferenced.
- * Delete all unreferenced blobs from the registry.
- * Record the number of blobs deleted and bytes freed, mark the garbage
- collection status as ``success``.
- * Remove the read-only mode restriction from the registry, meaning write-scoped
- JWTs will once again be issued to registry clients.
+ *
+ To create a new reserved IP reserved to a region, send a POST request to
+ ``/v2/reserved_ips`` with the ``region`` attribute.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -184767,44 +189388,62 @@ def run_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "type": "str" # Optional. Type of the garbage collection to run against this
- registry. Known values are: "untagged manifests only", "unreferenced blobs only",
- and "untagged manifests and unreferenced blobs".
- }
+ body = {}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "links": {
+ "actions": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ],
+ "droplets": [
+ {
+ "href": "str", # Optional. A URL that can be used to
+ access the action.
+ "id": 0, # Optional. A unique numeric ID that can be
+ used to identify and reference an action.
+ "rel": "str" # Optional. A string specifying the
+ type of the related action.
+ }
+ ]
+ },
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
}
}
- # 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,
@@ -184833,13 +189472,9 @@ def run_garbage_collection(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_registry_run_garbage_collection_request(
- registry_name=registry_name,
+ _request = build_reserved_ips_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -184857,14 +189492,136 @@ def run_garbage_collection(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ if response.status_code not in [202]:
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 == 201:
+ 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 get(self, reserved_ip: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Existing Reserved IP.
+
+ To show information about a reserved IP, send a GET request to
+ ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "reserved_ip": {
+ "droplet": {},
+ "ip": "str", # Optional. The public IP address of the reserved IP.
+ It also serves as its identifier.
+ "locked": bool, # Optional. A boolean value indicating whether or
+ not the reserved IP has pending actions preventing new ones from being
+ submitted.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.:code:`
`:code:`
`Requires
+ ``project:read`` scope.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ }
+ }
+ }
+ # 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_reserved_ips_get_request(
+ reserved_ip=reserved_ip,
+ 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")
)
@@ -184902,45 +189659,25 @@ def run_garbage_collection(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
+ def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Get Active Garbage Collection.
+ """Delete a Reserved IP.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To delete a reserved IP and remove it from your account, send a DELETE request
+ to ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
- To get information about the currently-active garbage collection
- for a registry, send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collection``.
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :return: JSON object
- :rtype: JSON
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: 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): 200
- response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -184969,10 +189706,10 @@ def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_registry_get_garbage_collection_request(
- registry_name=registry_name,
+ _request = build_reserved_ips_delete_request(
+ reserved_ip=reserved_ip,
headers=_headers,
params=_params,
)
@@ -184987,14 +189724,15 @@ def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ 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 == 200:
+ if response.status_code == 204:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -185005,11 +189743,6 @@ def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
"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")
@@ -185027,28 +189760,40 @@ def get_garbage_collection(self, registry_name: str, **kwargs: Any) -> JSON:
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
+
+
+class ReservedIPsActionsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`reserved_ips_actions` attribute.
+ """
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
@distributed_trace
- def list_garbage_collections(
- self, registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List Garbage Collections.
-
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ """List All Actions for a Reserved IP.
- To get information about past garbage collections for a registry,
- send a GET request to ``/v2/registry/$REGISTRY_NAME/garbage-collections``.
+ To retrieve all actions that have been executed on a reserved IP, send a GET request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``.
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :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
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -185058,26 +189803,56 @@ def list_garbage_collections(
# response body for status code(s): 200
response == {
- "garbage_collections": [
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "actions": [
{
- "blobs_deleted": 0, # Optional. The number of blobs deleted
- as a result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time
- the garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a
- result of this garbage collection.
- "registry_name": "str", # Optional. The name of the
- container registry.
- "status": "str", # Optional. The current status of this
- garbage collection. Known values are: "requested", "waiting for write
- JWTs to expire", "scanning manifests", "deleting unreferenced blobs",
- "cancelling", "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time
- the garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of
- the garbage collection.
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "region": {
+ "available": bool, # This is a boolean value that
+ represents whether new Droplets can be created in this region.
+ Required.
+ "features": [
+ "str" # This attribute is set to an array
+ which contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region.
+ This will be a full name that is used in the control panel and other
+ interfaces. Required.
+ "sizes": [
+ "str" # This attribute is set to an array
+ which contains the identifying slugs for the sizes available in
+ this region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used
+ as a unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string
+ that is used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the
+ resource that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource
+ that the action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the action was initiated.
+ "status": "in-progress", # Optional. Default value is
+ "in-progress". The current status of the action. This can be
+ "in-progress", "completed", or "errored". Known values are:
+ "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that
+ the object represents. For example, this could be "transfer" to represent
+ the state of an image transfer action.
}
- ]
+ ],
+ "links": {
+ "pages": {}
+ }
}
# response body for status code(s): 404
response == {
@@ -185109,10 +189884,8 @@ def list_garbage_collections(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_list_garbage_collections_request(
- registry_name=registry_name,
- per_page=per_page,
- page=page,
+ _request = build_reserved_ips_actions_list_request(
+ reserved_ip=reserved_ip,
headers=_headers,
params=_params,
)
@@ -185172,29 +189945,35 @@ def list_garbage_collections(
return cast(JSON, deserialized) # type: ignore
@overload
- def update_garbage_collection(
+ def post(
self,
- registry_name: str,
- garbage_collection_uuid: str,
- body: JSON,
+ reserved_ip: str,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update Garbage Collection.
+ """Initiate a Reserved IP Action.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To initiate an action on a reserved IP send a POST request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- To cancel the currently-active garbage collection for a registry,
- send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
- and specify one or more of the attributes below.
+ .. list-table::
+ :header-rows: 1
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
- :type garbage_collection_uuid: str
- :param body: Required.
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IP to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IP from a Droplet.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IP. 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".
@@ -185207,30 +189986,51 @@ def update_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "cancel": bool # Optional. A boolean value indicating that the garbage
- collection should be cancelled.
- }
+ body = {}
- # response body for status code(s): 200
+ # response body for status code(s): 201
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -185247,29 +190047,35 @@ def update_garbage_collection(
"""
@overload
- def update_garbage_collection(
+ def post(
self,
- registry_name: str,
- garbage_collection_uuid: str,
- body: IO[bytes],
+ reserved_ip: str,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update Garbage Collection.
+ """Initiate a Reserved IP Action.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To initiate an action on a reserved IP send a POST request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- To cancel the currently-active garbage collection for a registry,
- send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
- and specify one or more of the attributes below.
+ .. list-table::
+ :header-rows: 1
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
- :type garbage_collection_uuid: str
- :param body: Required.
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IP to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IP from a Droplet.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IP. Default value is None.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
@@ -185281,25 +190087,49 @@ def update_garbage_collection(
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # response body for status code(s): 201
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -185316,27 +190146,34 @@ def update_garbage_collection(
"""
@distributed_trace
- def update_garbage_collection(
+ def post(
self,
- registry_name: str,
- garbage_collection_uuid: str,
- body: Union[JSON, IO[bytes]],
+ reserved_ip: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update Garbage Collection.
+ """Initiate a Reserved IP Action.
- **Note: This endpoint is deprecated. Please use the ``/v2/registries`` endpoint instead.**
+ To initiate an action on a reserved IP send a POST request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- To cancel the currently-active garbage collection for a registry,
- send a PUT request to ``/v2/registry/$REGISTRY_NAME/garbage-collection/$GC_UUID``
- and specify one or more of the attributes below.
+ .. list-table::
+ :header-rows: 1
- :param registry_name: The name of a container registry. Required.
- :type registry_name: str
- :param garbage_collection_uuid: The UUID of a garbage collection run. Required.
- :type garbage_collection_uuid: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IP to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IP from a Droplet.
+
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IP. Is either a JSON type or a IO[bytes] type. Default value is
+ None.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -185346,30 +190183,51 @@ def update_garbage_collection(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "cancel": bool # Optional. A boolean value indicating that the garbage
- collection should be cancelled.
- }
+ body = {}
- # response body for status code(s): 200
+ # response body for status code(s): 201
response == {
- "garbage_collection": {
- "blobs_deleted": 0, # Optional. The number of blobs deleted as a
- result of this garbage collection.
- "created_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was created.
- "freed_bytes": 0, # Optional. The number of bytes freed as a result
- of this garbage collection.
- "registry_name": "str", # Optional. The name of the container
- registry.
- "status": "str", # Optional. The current status of this garbage
- collection. Known values are: "requested", "waiting for write JWTs to
- expire", "scanning manifests", "deleting unreferenced blobs", "cancelling",
- "failed", "succeeded", and "cancelled".
- "updated_at": "2020-02-20 00:00:00", # Optional. The time the
- garbage collection was last updated.
- "uuid": "str" # Optional. A string specifying the UUID of the
- garbage collection.
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -185411,11 +190269,13 @@ def update_garbage_collection(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_registry_update_garbage_collection_request(
- registry_name=registry_name,
- garbage_collection_uuid=garbage_collection_uuid,
+ _request = build_reserved_ips_actions_post_request(
+ reserved_ip=reserved_ip,
content_type=content_type,
json=_json,
content=_content,
@@ -185433,14 +190293,14 @@ def update_garbage_collection(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [201, 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:
+ if response.status_code == 201:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -185478,27 +190338,18 @@ def update_garbage_collection(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_options(self, **kwargs: Any) -> JSON:
+ def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List Registry Options (Subscription Tiers and Available Regions).
-
- **Note: This endpoint is deprecated and may be removed in a future version. There is no
- alternative.****\\ Note: This endpoint is deprecated. Please use the ``/v2/registries``
- endpoint instead.**
-
- This endpoint serves to provide additional information as to which option values
- are available when creating a container registry.
-
- There are multiple subscription tiers available for container registry. Each
- tier allows a different number of image repositories to be created in your
- registry, and has a different amount of storage and transfer included.
-
- There are multiple regions available for container registry and controls
- where your data is stored.
+ """Retrieve an Existing Reserved IP Action.
- To list the available options, send a GET request to
- ``/v2/registry/options``.
+ To retrieve the status of a reserved IP action, send a GET request to
+ ``/v2/reserved_ips/$RESERVED_IP/actions/$ACTION_ID``.
+ :param reserved_ip: A reserved IP address. Required.
+ :type reserved_ip: str
+ :param action_id: A unique numeric ID that can be used to identify and reference an action.
+ Required.
+ :type action_id: int
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -185508,44 +190359,60 @@ def get_options(self, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "options": {
- "available_regions": [
- "str" # Optional.
- ],
- "subscription_tiers": [
- {
- "allow_storage_overage": bool, # Optional. A boolean
- indicating whether the subscription tier supports additional storage
- above what is included in the base plan at an additional cost per GiB
- used.
- "eligibility_reasons": [
- "str" # Optional. If your account is not
- eligible to use a certain subscription tier, this will include a
- list of reasons that prevent you from using the tier.
- ],
- "eligible": bool, # Optional. A boolean indicating
- whether your account it eligible to use a certain subscription tier.
- "included_bandwidth_bytes": 0, # Optional. The
- amount of outbound data transfer included in the subscription tier in
- bytes.
- "included_repositories": 0, # Optional. The number
- of repositories included in the subscription tier. ``0`` indicates
- that the subscription tier includes unlimited repositories.
- "included_storage_bytes": 0, # Optional. The amount
- of storage included in the subscription tier in bytes.
- "monthly_price_in_cents": 0, # Optional. The monthly
- cost of the subscription tier in cents.
- "name": "str", # Optional. The name of the
- subscription tier.
- "slug": "str", # Optional. The slug identifier of
- the subscription tier.
- "storage_overage_price_in_cents": 0 # Optional. The
- price paid in cents per GiB for additional storage beyond what is
- included in the subscription plan.
- }
- ]
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "project_id": "str", # Optional. The UUID of the project to which
+ the reserved IP currently belongs.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
+ # 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,
@@ -185565,7 +190432,9 @@ def get_options(self, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_registry_get_options_request(
+ _request = build_reserved_ips_actions_get_request(
+ reserved_ip=reserved_ip,
+ action_id=action_id,
headers=_headers,
params=_params,
)
@@ -185580,27 +190449,44 @@ def get_options(self, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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
@@ -185608,14 +190494,14 @@ def get_options(self, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
-class ReservedIPsOperations:
+class ReservedIPv6Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~pydo.GeneratedClient`'s
- :attr:`reserved_ips` attribute.
+ :attr:`reserved_ipv6` attribute.
"""
def __init__(self, *args, **kwargs):
@@ -185630,10 +190516,10 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """List All Reserved IPs.
+ """List All Reserved IPv6s.
- To list all of the reserved IPs available on your account, send a GET request to
- ``/v2/reserved_ips``.
+ To list all of the reserved IPv6s available on your account, send a GET request to
+ ``/v2/reserved_ipv6``.
:keyword per_page: Number of items returned per page. Default value is 20.
:paramtype per_page: int
@@ -185654,36 +190540,15 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
"links": {
"pages": {}
},
- "reserved_ips": [
+ "reserved_ipv6s": [
{
"droplet": {},
"ip": "str", # Optional. The public IP address of the
- reserved IP. It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating
- whether or not the reserved IP has pending actions preventing new ones
- from being submitted.
- "project_id": "str", # Optional. The UUID of the project to
- which the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
- Required.
- "features": [
- "str" # This attribute is set to an array
- which contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region.
- This will be a full name that is used in the control panel and other
- interfaces. Required.
- "sizes": [
- "str" # This attribute is set to an array
- which contains the identifying slugs for the sizes available in
- this region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used
- as a unique identifier for each region. Required.
- }
+ reserved IPv6. It also serves as its identifier.
+ "region_slug": "str", # Optional. The region that the
+ reserved IPv6 is reserved to. When you query a reserved IPv6,the
+ region_slug will be returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
]
}
@@ -185706,7 +190571,7 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ips_list_request(
+ _request = build_reserved_ipv6_list_request(
per_page=per_page,
page=page,
headers=_headers,
@@ -185755,18 +190620,13 @@ def create(
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IP.
-
- On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
+ """Create a New Reserved IPv6.
+ On creation, a reserved IPv6 must be reserved to a region.
- *
- To create a new reserved IP assigned to a Droplet, send a POST
- request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- *
- To create a new reserved IP reserved to a region, send a POST request to
- ``/v2/reserved_ips`` with the ``region`` attribute.
+ * To create a new reserved IPv6 reserved to a region, send a POST request to
+ ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
:param body: Required.
:type body: JSON
@@ -185781,60 +190641,20 @@ def create(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
+ body = {
+ "region_slug": "str" # The slug identifier for the region the reserved IPv6
+ will be reserved to. Required.
+ }
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "links": {
- "actions": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ],
- "droplets": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ]
- },
- "reserved_ip": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "reserved_ipv6": {
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
}
"""
@@ -185844,18 +190664,13 @@ def create(
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IP.
-
- On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
+ """Create a New Reserved IPv6.
+ On creation, a reserved IPv6 must be reserved to a region.
- *
- To create a new reserved IP assigned to a Droplet, send a POST
- request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- *
- To create a new reserved IP reserved to a region, send a POST request to
- ``/v2/reserved_ips`` with the ``region`` attribute.
+ * To create a new reserved IPv6 reserved to a region, send a POST request to
+ ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
:param body: Required.
:type body: IO[bytes]
@@ -185869,58 +190684,15 @@ def create(
Example:
.. code-block:: python
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "links": {
- "actions": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ],
- "droplets": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ]
- },
- "reserved_ip": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "reserved_ipv6": {
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
}
"""
@@ -185928,18 +190700,13 @@ def create(
@distributed_trace
def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IP.
-
- On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.
+ """Create a New Reserved IPv6.
+ On creation, a reserved IPv6 must be reserved to a region.
- *
- To create a new reserved IP assigned to a Droplet, send a POST
- request to ``/v2/reserved_ips`` with the ``droplet_id`` attribute.
- *
- To create a new reserved IP reserved to a region, send a POST request to
- ``/v2/reserved_ips`` with the ``region`` attribute.
+ * To create a new reserved IPv6 reserved to a region, send a POST request to
+ ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
@@ -185951,60 +190718,20 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
+ body = {
+ "region_slug": "str" # The slug identifier for the region the reserved IPv6
+ will be reserved to. Required.
+ }
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "links": {
- "actions": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ],
- "droplets": [
- {
- "href": "str", # Optional. A URL that can be used to
- access the action.
- "id": 0, # Optional. A unique numeric ID that can be
- used to identify and reference an action.
- "rel": "str" # Optional. A string specifying the
- type of the related action.
- }
- ]
- },
- "reserved_ip": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "reserved_ipv6": {
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional.
}
}
"""
@@ -186037,7 +190764,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_reserved_ips_create_request(
+ _request = build_reserved_ipv6_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -186055,7 +190782,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [202]:
+ if response.status_code not in [201]:
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
@@ -186083,15 +190810,15 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
+ def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Reserved IP.
+ """Retrieve an Existing Reserved IPv6.
- To show information about a reserved IP, send a GET request to
- ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
+ To show information about a reserved IPv6, send a GET request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6``.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -186101,34 +190828,15 @@ def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "reserved_ip": {
+ "reserved_ipv6": {
"droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IP.
+ "ip": "str", # Optional. The public IP address of the reserved IPv6.
It also serves as its identifier.
- "locked": bool, # Optional. A boolean value indicating whether or
- not the reserved IP has pending actions preventing new ones from being
- submitted.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.:code:`
`:code:`
`Requires
- ``project:read`` scope.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- }
+ "region_slug": "str", # Optional. The region that the reserved IPv6
+ is reserved to. When you query a reserved IPv6,the region_slug will be
+ returned.
+ "reserved_at": "2020-02-20 00:00:00" # Optional. The date and time
+ when the reserved IPv6 was reserved.
}
}
# response body for status code(s): 404
@@ -186161,8 +190869,8 @@ def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ips_get_request(
- reserved_ip=reserved_ip,
+ _request = build_reserved_ipv6_get_request(
+ reserved_ipv6=reserved_ipv6,
headers=_headers,
params=_params,
)
@@ -186222,18 +190930,18 @@ def get(self, reserved_ip: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
+ def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Delete a Reserved IP.
+ """Delete a Reserved IPv6.
To delete a reserved IP and remove it from your account, send a DELETE request
- to ``/v2/reserved_ips/$RESERVED_IP_ADDR``.
+ to ``/v2/reserved_ipv6/$RESERVED_IPV6``.
A successful request will receive a 204 status code with no body in response.
This indicates that the request was processed successfully.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -186241,7 +190949,7 @@ def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
Example:
.. code-block:: python
- # response body for status code(s): 404
+ # response body for status code(s): 404, 422
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
@@ -186271,8 +190979,8 @@ def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_reserved_ips_delete_request(
- reserved_ip=reserved_ip,
+ _request = build_reserved_ipv6_delete_request(
+ reserved_ipv6=reserved_ipv6,
headers=_headers,
params=_params,
)
@@ -186287,7 +190995,7 @@ def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [204, 404, 422]:
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
@@ -186322,20 +191030,36 @@ def delete(self, reserved_ip: str, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
+ if response.status_code == 422:
+ 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 ReservedIPsActionsOperations:
+class ReservedIPv6ActionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~pydo.GeneratedClient`'s
- :attr:`reserved_ips_actions` attribute.
+ :attr:`reserved_ipv6_actions` attribute.
"""
def __init__(self, *args, **kwargs):
@@ -186347,16 +191071,40 @@ def __init__(self, *args, **kwargs):
input_args.pop(0) if input_args else kwargs.pop("deserializer")
)
- @distributed_trace
- def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
+ @overload
+ def post(
+ self,
+ reserved_ipv6: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """List All Actions for a Reserved IP.
+ """Initiate a Reserved IPv6 Action.
- To retrieve all actions that have been executed on a reserved IP, send a GET request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``.
+ To initiate an action on a reserved IPv6 send a POST request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
+ set the ``type`` attribute to on of the supported action types:
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ .. list-table::
+ :header-rows: 1
+
+ * - Action
+ - Details
+ * - ``assign``
+ - Assigns a reserved IPv6 to a Droplet
+ * - ``unassign``
+ - Unassign a reserved IPv6 from a Droplet.
+
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
+ :param body: The ``type`` attribute set in the request body will specify the action that
+ will be taken on the reserved IPv6. 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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -186364,57 +191112,50 @@ def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
+ # response body for status code(s): 201
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "actions": [
- {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
- Required.
- "features": [
- "str" # This attribute is set to an array
- which contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region.
- This will be a full name that is used in the control panel and other
- interfaces. Required.
- "sizes": [
- "str" # This attribute is set to an array
- which contains the identifying slugs for the sizes available in
- this region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used
- as a unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string
- that is used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the
- resource that the action is associated with.
- "resource_type": "str", # Optional. The type of resource
- that the action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the action was initiated.
- "status": "in-progress", # Optional. Default value is
- "in-progress". The current status of the action. This can be
- "in-progress", "completed", or "errored". Known values are:
- "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that
- the object represents. For example, this could be "transfer" to represent
- the state of an image transfer action.
- }
- ],
- "links": {
- "pages": {}
+ "action": {
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ action was completed.
+ "id": 0, # Optional. A unique numeric ID that can be used to
+ identify and reference an action.
+ "region": {
+ "available": bool, # This is a boolean value that represents
+ whether new Droplets can be created in this region. Required.
+ "features": [
+ "str" # This attribute is set to an array which
+ contains features available in this region. Required.
+ ],
+ "name": "str", # The display name of the region. This will
+ be a full name that is used in the control panel and other interfaces.
+ Required.
+ "sizes": [
+ "str" # This attribute is set to an array which
+ contains the identifying slugs for the sizes available in this
+ region. sizes:read is required to view. Required.
+ ],
+ "slug": "str" # A human-readable string that is used as a
+ unique identifier for each region. Required.
+ },
+ "region_slug": "str", # Optional. A human-readable string that is
+ used as a unique identifier for each region.
+ "resource_id": 0, # Optional. A unique identifier for the resource
+ that the action is associated with.
+ "resource_type": "str", # Optional. The type of resource that the
+ action is associated with.
+ "started_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the action was
+ initiated.
+ "status": "in-progress", # Optional. Default value is "in-progress".
+ The current status of the action. This can be "in-progress", "completed", or
+ "errored". Known values are: "in-progress", "completed", and "errored".
+ "type": "str" # Optional. This is the type of action that the object
+ represents. For example, this could be "transfer" to represent the state of
+ an image transfer action.
}
}
# response body for status code(s): 404
@@ -186429,98 +191170,21 @@ def list(self, reserved_ip: str, **kwargs: Any) -> JSON:
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_reserved_ips_actions_list_request(
- reserved_ip=reserved_ip,
- 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
@overload
def post(
self,
- reserved_ip: str,
- body: Optional[JSON] = None,
+ reserved_ipv6: str,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IP Action.
+ """Initiate a Reserved IPv6 Action.
- To initiate an action on a reserved IP send a POST request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ To initiate an action on a reserved IPv6 send a POST request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
set the ``type`` attribute to on of the supported action types:
.. list-table::
@@ -186529,16 +191193,16 @@ def post(
* - Action
- Details
* - ``assign``
- - Assigns a reserved IP to a Droplet
+ - Assigns a reserved IPv6 to a Droplet
* - ``unassign``
- - Unassign a reserved IP from a Droplet.
+ - Unassign a reserved IPv6 from a Droplet.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IP. Default value is None.
- :type body: JSON
- :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ will be taken on the reserved IPv6. Default value is None.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:return: JSON object
@@ -186548,9 +191212,6 @@ def post(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
# response body for status code(s): 201
response == {
"action": {
@@ -186559,8 +191220,6 @@ def post(
action was completed.
"id": 0, # Optional. A unique numeric ID that can be used to
identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
"region": {
"available": bool, # This is a boolean value that represents
whether new Droplets can be created in this region. Required.
@@ -186609,20 +191268,18 @@ def post(
}
"""
- @overload
+ @distributed_trace
def post(
self,
- reserved_ip: str,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
+ reserved_ipv6: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IP Action.
+ """Initiate a Reserved IPv6 Action.
- To initiate an action on a reserved IP send a POST request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
+ To initiate an action on a reserved IPv6 send a POST request to
+ ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
set the ``type`` attribute to on of the supported action types:
.. list-table::
@@ -186631,18 +191288,16 @@ def post(
* - Action
- Details
* - ``assign``
- - Assigns a reserved IP to a Droplet
+ - Assigns a reserved IPv6 to a Droplet
* - ``unassign``
- - Unassign a reserved IP from a Droplet.
+ - Unassign a reserved IPv6 from a Droplet.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
+ :param reserved_ipv6: A reserved IPv6 address. Required.
+ :type reserved_ipv6: str
:param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IP. Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
+ will be taken on the reserved IPv6. Is either a JSON type or a IO[bytes] type. Default value
+ is None.
+ :type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -186650,6 +191305,9 @@ def post(
Example:
.. code-block:: python
+ # JSON input template you can fill out and use as your body input.
+ body = {}
+
# response body for status code(s): 201
response == {
"action": {
@@ -186658,8 +191316,6 @@ def post(
action was completed.
"id": 0, # Optional. A unique numeric ID that can be used to
identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
"region": {
"available": bool, # This is a boolean value that represents
whether new Droplets can be created in this region. Required.
@@ -186695,7 +191351,215 @@ def post(
an image transfer action.
}
}
- # response body for status code(s): 404
+ # 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 = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ if body is not None:
+ _json = body
+ else:
+ _json = None
+
+ _request = build_reserved_ipv6_actions_post_request(
+ reserved_ipv6=reserved_ipv6,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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 [201, 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 == 201:
+ 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
+
+
+class ByoipPrefixesOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`byoip_prefixes` attribute.
+ """
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
+ @overload
+ def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a BYOIP Prefix.
+
+ To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
+
+ A successful request will initiate the process of bringing your BYOIP Prefix into your account.
+ The response will include the details of the created prefix, including its UUID and status.
+
+ :param body: Required.
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
+ "region": "str", # The region where the prefix will be created. Required.
+ "signature": "str" # The signature hash for the prefix creation request.
+ Required.
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "region": "str", # Optional. The region where the prefix is created.
+ "status": "str", # Optional. The status of the BYOIP prefix.
+ "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
+ }
+ # response body for status code(s): 422
+ 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.
+ }
+ """
+
+ @overload
+ def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a BYOIP Prefix.
+
+ To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
+
+ A successful request will initiate the process of bringing your BYOIP Prefix into your account.
+ The response will include the details of the created prefix, including its UUID and status.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 202
+ response == {
+ "region": "str", # Optional. The region where the prefix is created.
+ "status": "str", # Optional. The status of the BYOIP prefix.
+ "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
+ }
+ # response body for status code(s): 422
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
@@ -186709,34 +191573,16 @@ def post(
"""
@distributed_trace
- def post(
- self,
- reserved_ip: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any,
- ) -> JSON:
+ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IP Action.
-
- To initiate an action on a reserved IP send a POST request to
- ``/v2/reserved_ips/$RESERVED_IP/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
+ """Create a BYOIP Prefix.
- .. list-table::
- :header-rows: 1
+ To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IP to a Droplet
- * - ``unassign``
- - Unassign a reserved IP from a Droplet.
+ A successful request will initiate the process of bringing your BYOIP Prefix into your account.
+ The response will include the details of the created prefix, including its UUID and status.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IP. Is either a JSON type or a IO[bytes] type. Default value is
- None.
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
:rtype: JSON
@@ -186746,54 +191592,20 @@ def post(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {}
+ body = {
+ "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
+ "region": "str", # The region where the prefix will be created. Required.
+ "signature": "str" # The signature hash for the prefix creation request.
+ Required.
+ }
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
- }
+ "region": "str", # Optional. The region where the prefix is created.
+ "status": "str", # Optional. The status of the BYOIP prefix.
+ "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
}
- # response body for status code(s): 404
+ # response body for status code(s): 422
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
@@ -186832,13 +191644,9 @@ def post(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_reserved_ips_actions_post_request(
- reserved_ip=reserved_ip,
+ _request = build_byoip_prefixes_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -186856,14 +191664,14 @@ def post(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ if response.status_code not in [202, 422]:
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 == 201:
+ if response.status_code == 202:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -186879,7 +191687,7 @@ def post(
else:
deserialized = None
- if response.status_code == 404:
+ if response.status_code == 422:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -186901,18 +191709,135 @@ def post(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
+ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ """List BYOIP Prefixes.
+
+ To list all BYOIP prefixes, send a GET request to ``/v2/byoip_prefixes``.
+ A successful response will return a list of all BYOIP prefixes associated with the account.
+
+ :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.
+ },
+ "byoip_prefixes": [
+ {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is
+ being advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is
+ locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project
+ associated with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix
+ is located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP
+ prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the
+ validation.
+ "note": "str", # Optional. Additional notes
+ or details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
+ }
+ ],
+ "links": {
+ "pages": {}
+ }
+ }
+ """
+ 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_byoip_prefixes_list_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]:
+ 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 = {}
+ 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 get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Reserved IP Action.
+ """Get a BYOIP Prefix.
- To retrieve the status of a reserved IP action, send a GET request to
- ``/v2/reserved_ips/$RESERVED_IP/actions/$ACTION_ID``.
+ To get a BYOIP prefix, send a GET request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- :param reserved_ip: A reserved IP address. Required.
- :type reserved_ip: str
- :param action_id: A unique numeric ID that can be used to identify and reference an action.
- Required.
- :type action_id: int
+ A successful response will return the details of the specified BYOIP prefix.
+
+ :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
+ :type byoip_prefix_uuid: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -186922,50 +191847,32 @@ def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "project_id": "str", # Optional. The UUID of the project to which
- the reserved IP currently belongs.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
- # response body for status code(s): 404
+ # response body for status code(s): 404, 422
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
@@ -186995,9 +191902,8 @@ def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ips_actions_get_request(
- reserved_ip=reserved_ip,
- action_id=action_id,
+ _request = build_byoip_prefixes_get_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
headers=_headers,
params=_params,
)
@@ -187012,7 +191918,7 @@ def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [200, 404, 422]:
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
@@ -187051,69 +191957,57 @@ def get(self, reserved_ip: str, action_id: int, **kwargs: Any) -> JSON:
else:
deserialized = None
+ if response.status_code == 422:
+ 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
-
-class ReservedIPv6Operations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.GeneratedClient`'s
- :attr:`reserved_ipv6` attribute.
- """
-
- def __init__(self, *args, **kwargs):
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
-
@distributed_trace
- def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
+ def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List All Reserved IPv6s.
+ """Delete a BYOIP Prefix.
- To list all of the reserved IPv6s available on your account, send a GET request to
- ``/v2/reserved_ipv6``.
+ To delete a BYOIP prefix and remove it from your account, send a DELETE request
+ to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- :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
+ A successful request will receive a 202 status code with no body in response.
+ This indicates that the request was accepted and the prefix is being deleted.
+
+ :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
+ :type byoip_prefix_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): 200
+ # response body for status code(s): 404, 422
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "links": {
- "pages": {}
- },
- "reserved_ipv6s": [
- {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the
- reserved IPv6. It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the
- reserved IPv6 is reserved to. When you query a reserved IPv6,the
- region_slug will be returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
- }
- ]
+ "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]] = {
@@ -187132,11 +192026,10 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_reserved_ipv6_list_request(
- per_page=per_page,
- page=page,
+ _request = build_byoip_prefixes_delete_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
headers=_headers,
params=_params,
)
@@ -187151,46 +192044,81 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ if response.status_code not in [202, 404, 422]:
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 = {}
- 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 == 202:
+ 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 response.status_code == 422:
+ 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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@overload
- def create(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ def patch(
+ self,
+ byoip_prefix_uuid: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IPv6.
-
- On creation, a reserved IPv6 must be reserved to a region.
+ """Update a BYOIP Prefix.
+ To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- * To create a new reserved IPv6 reserved to a region, send a POST request to
- ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
+ Currently, you can update the advertisement status of the prefix.
+ The response will include the updated details of the prefix.
+ :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
+ :type byoip_prefix_uuid: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -187205,36 +192133,68 @@ def create(
# JSON input template you can fill out and use as your body input.
body = {
- "region_slug": "str" # The slug identifier for the region the reserved IPv6
- will be reserved to. Required.
+ "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "reserved_ipv6": {
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
+ # response body for status code(s): 404, 422
+ 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.
+ }
"""
@overload
- def create(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ def patch(
+ self,
+ byoip_prefix_uuid: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IPv6.
-
- On creation, a reserved IPv6 must be reserved to a region.
+ """Update a BYOIP Prefix.
+ To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- * To create a new reserved IPv6 reserved to a region, send a POST request to
- ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
+ Currently, you can update the advertisement status of the prefix.
+ The response will include the updated details of the prefix.
+ :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
+ :type byoip_prefix_uuid: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -187247,30 +192207,60 @@ def create(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "reserved_ipv6": {
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
+ # response body for status code(s): 404, 422
+ 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.
+ }
"""
@distributed_trace
- def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ def patch(
+ self, byoip_prefix_uuid: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Create a New Reserved IPv6.
-
- On creation, a reserved IPv6 must be reserved to a region.
+ """Update a BYOIP Prefix.
+ To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
- * To create a new reserved IPv6 reserved to a region, send a POST request to
- ``/v2/reserved_ipv6`` with the ``region_slug`` attribute.
+ Currently, you can update the advertisement status of the prefix.
+ The response will include the updated details of the prefix.
+ :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
+ :type byoip_prefix_uuid: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -187282,21 +192272,47 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# JSON input template you can fill out and use as your body input.
body = {
- "region_slug": "str" # The slug identifier for the region the reserved IPv6
- will be reserved to. Required.
+ "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
}
- # response body for status code(s): 201
+ # response body for status code(s): 202
response == {
- "reserved_ipv6": {
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional.
+ "byoip_prefix": {
+ "advertised": bool, # Optional. Whether the BYOIP prefix is being
+ advertised.
+ "failure_reason": "str", # Optional. Reason for failure, if
+ applicable.
+ "locked": bool, # Optional. Whether the BYOIP prefix is locked.
+ "name": "str", # Optional. Name of the BYOIP prefix.
+ "prefix": "str", # Optional. The IP prefix in CIDR notation.
+ "project_id": "str", # Optional. The ID of the project associated
+ with the BYOIP prefix.
+ "region": "str", # Optional. Region where the BYOIP prefix is
+ located.
+ "status": "str", # Optional. Status of the BYOIP prefix.
+ "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
+ "validations": [
+ {
+ "name": "str", # Optional. Name of the validation.
+ "note": "str", # Optional. Additional notes or
+ details about the validation.
+ "status": "str" # Optional. Status of the
+ validation.
+ }
+ ]
}
}
+ # response body for status code(s): 404, 422
+ 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,
@@ -187327,7 +192343,8 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_reserved_ipv6_create_request(
+ _request = build_byoip_prefixes_patch_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
content_type=content_type,
json=_json,
content=_content,
@@ -187345,27 +192362,60 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [201]:
+ if response.status_code not in [202, 404, 422]:
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 = {}
- 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 == 202:
+ 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.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 response.status_code == 422:
+ 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
@@ -187373,15 +192423,29 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
+ def list_resources(
+ self,
+ byoip_prefix_uuid: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Reserved IPv6.
+ """List BYOIP Prefix Resources.
- To show information about a reserved IPv6, send a GET request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6``.
+ To list resources associated with BYOIP prefixes, send a GET request to
+ ``/v2/byoip_prefixes/{byoip_prefix_uuid}/ips``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
+ A successful response will return a list of resources associated with the specified BYOIP
+ prefix.
+
+ :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
+ :type byoip_prefix_uuid: str
+ :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:
@@ -187391,15 +192455,23 @@ def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "reserved_ipv6": {
- "droplet": {},
- "ip": "str", # Optional. The public IP address of the reserved IPv6.
- It also serves as its identifier.
- "region_slug": "str", # Optional. The region that the reserved IPv6
- is reserved to. When you query a reserved IPv6,the region_slug will be
- returned.
- "reserved_at": "2020-02-20 00:00:00" # Optional. The date and time
- when the reserved IPv6 was reserved.
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "ips": [
+ {
+ "assigned_at": "2020-02-20 00:00:00", # Optional. Time when
+ the allocation was assigned.
+ "byoip": "str", # Optional. The BYOIP prefix UUID.
+ "id": 0, # Optional. Unique identifier for the allocation.
+ "region": "str", # Optional. Region where the allocation is
+ made.
+ "resource": "str" # Optional. The resource associated with
+ the allocation.
+ }
+ ],
+ "links": {
+ "pages": {}
}
}
# response body for status code(s): 404
@@ -187432,8 +192504,10 @@ def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ipv6_get_request(
- reserved_ipv6=reserved_ipv6,
+ _request = build_byoip_prefixes_list_resources_request(
+ byoip_prefix_uuid=byoip_prefix_uuid,
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -187492,27 +192566,94 @@ def get(self, reserved_ipv6: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
+
+class SecurityOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`security` attribute.
+ """
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
@distributed_trace
- def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
+ def list_scans(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Reserved IPv6.
-
- To delete a reserved IP and remove it from your account, send a DELETE request
- to ``/v2/reserved_ipv6/$RESERVED_IPV6``.
+ """List Scans.
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ To list all CSPM scans, send a GET request to ``/v2/security/scans``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :return: JSON object or None
- :rtype: JSON or None
+ :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): 404, 422
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "links": {
+ "pages": {}
+ },
+ "scans": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan
+ was created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional.
+ The number of affected resources for the finding.
+ "business_impact": "str", # Optional. A
+ description of the business impact of the finding.
+ "details": "str", # Optional. A description
+ of the risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", #
+ Optional. When the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", #
+ Optional. description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional.
+ title.
+ }
+ ],
+ "name": "str", # Optional. The name of the
+ rule that triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity
+ of the finding. Known values are: "CRITICAL", "HIGH", "MEDIUM",
+ and "LOW".
+ "technical_details": "str" # Optional. A
+ description of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known
+ values are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
+ }
+ ]
+ }
+ # 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
@@ -187540,10 +192681,11 @@ def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_reserved_ipv6_delete_request(
- reserved_ipv6=reserved_ipv6,
+ _request = build_security_list_scans_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -187558,26 +192700,14 @@ def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [204, 404, 422]:
+ 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)
- 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:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -187593,7 +192723,7 @@ def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -187610,64 +192740,17 @@ def delete(self, reserved_ipv6: str, **kwargs: Any) -> Optional[JSON]:
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
-
- return deserialized # type: ignore
-
-
-class ReservedIPv6ActionsOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.GeneratedClient`'s
- :attr:`reserved_ipv6_actions` attribute.
- """
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- def __init__(self, *args, **kwargs):
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
+ return cast(JSON, deserialized) # type: ignore
- @overload
- def post(
- self,
- reserved_ipv6: str,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> JSON:
+ @distributed_trace
+ def create_scan(self, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IPv6 Action.
-
- To initiate an action on a reserved IPv6 send a POST request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
-
- .. list-table::
- :header-rows: 1
+ """Create Scan.
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IPv6 to a Droplet
- * - ``unassign``
- - Unassign a reserved IPv6 from a Droplet.
+ To create a CSPM scan, send a POST request to ``/v2/security/scans``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IPv6. 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: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -187675,53 +192758,46 @@ def post(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
# response body for status code(s): 201
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "scan": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan was
+ created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional. The
+ number of affected resources for the finding.
+ "business_impact": "str", # Optional. A description
+ of the business impact of the finding.
+ "details": "str", # Optional. A description of the
+ risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", # Optional. When
+ the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", # Optional.
+ description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional. title.
+ }
+ ],
+ "name": "str", # Optional. The name of the rule that
+ triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity of the
+ finding. Known values are: "CRITICAL", "HIGH", "MEDIUM", and "LOW".
+ "technical_details": "str" # Optional. A description
+ of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known values
+ are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
}
}
- # response body for status code(s): 404
+ # response body for status code(s): 400, 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
@@ -187733,41 +192809,126 @@ def post(
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_security_create_scan_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 [201, 400, 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 == 201:
+ 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")
+ )
- @overload
- def post(
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ 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 get_scan(
self,
- reserved_ipv6: str,
- body: Optional[IO[bytes]] = None,
+ scan_id: str,
*,
- content_type: str = "application/json",
+ severity: Optional[str] = None,
+ per_page: int = 20,
+ page: int = 1,
+ type: Optional[str] = None,
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IPv6 Action.
-
- To initiate an action on a reserved IPv6 send a POST request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
-
- .. list-table::
- :header-rows: 1
+ """Get Scan.
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IPv6 to a Droplet
- * - ``unassign``
- - Unassign a reserved IPv6 from a Droplet.
+ To get a CSPM scan by ID, send a GET request to ``/v2/security/scans/{scan_id}``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IPv6. Default value is None.
- :type body: IO[bytes]
- :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
- Default value is "application/json".
- :paramtype content_type: str
+ :param scan_id: The scan UUID. Required.
+ :type scan_id: str
+ :keyword severity: The finding severity level to include. Known values are: "LOW", "MEDIUM",
+ "HIGH", and "CRITICAL". Default value is None.
+ :paramtype severity: str
+ :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
+ :keyword type: The finding type to include. Default value is None.
+ :paramtype type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -187775,47 +192936,43 @@ def post(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "scan": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan was
+ created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional. The
+ number of affected resources for the finding.
+ "business_impact": "str", # Optional. A description
+ of the business impact of the finding.
+ "details": "str", # Optional. A description of the
+ risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", # Optional. When
+ the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", # Optional.
+ description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional. title.
+ }
+ ],
+ "name": "str", # Optional. The name of the rule that
+ triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity of the
+ finding. Known values are: "CRITICAL", "HIGH", "MEDIUM", and "LOW".
+ "technical_details": "str" # Optional. A description
+ of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known values
+ are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
}
}
# response body for status code(s): 404
@@ -187830,37 +192987,112 @@ def post(
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_security_get_scan_request(
+ scan_id=scan_id,
+ severity=severity,
+ per_page=per_page,
+ page=page,
+ type=type,
+ 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 post(
+ def get_latest_scan(
self,
- reserved_ipv6: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ severity: Optional[str] = None,
+ type: Optional[str] = None,
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Initiate a Reserved IPv6 Action.
+ """Get Latest Scan.
- To initiate an action on a reserved IPv6 send a POST request to
- ``/v2/reserved_ipv6/$RESERVED_IPV6/actions``. In the JSON body to the request,
- set the ``type`` attribute to on of the supported action types:
-
- .. list-table::
- :header-rows: 1
-
- * - Action
- - Details
- * - ``assign``
- - Assigns a reserved IPv6 to a Droplet
- * - ``unassign``
- - Unassign a reserved IPv6 from a Droplet.
+ To get the latest CSPM scan, send a GET request to ``/v2/security/scans/latest``.
- :param reserved_ipv6: A reserved IPv6 address. Required.
- :type reserved_ipv6: str
- :param body: The ``type`` attribute set in the request body will specify the action that
- will be taken on the reserved IPv6. Is either a JSON type or a IO[bytes] type. Default value
- is None.
- :type body: JSON or IO[bytes]
+ :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
+ :keyword severity: The finding severity level to include. Known values are: "LOW", "MEDIUM",
+ "HIGH", and "CRITICAL". Default value is None.
+ :paramtype severity: str
+ :keyword type: The finding type to include. Default value is None.
+ :paramtype type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -187868,50 +193100,43 @@ def post(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "action": {
- "completed_at": "2020-02-20 00:00:00", # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- action was completed.
- "id": 0, # Optional. A unique numeric ID that can be used to
- identify and reference an action.
- "region": {
- "available": bool, # This is a boolean value that represents
- whether new Droplets can be created in this region. Required.
- "features": [
- "str" # This attribute is set to an array which
- contains features available in this region. Required.
- ],
- "name": "str", # The display name of the region. This will
- be a full name that is used in the control panel and other interfaces.
- Required.
- "sizes": [
- "str" # This attribute is set to an array which
- contains the identifying slugs for the sizes available in this
- region. sizes:read is required to view. Required.
- ],
- "slug": "str" # A human-readable string that is used as a
- unique identifier for each region. Required.
- },
- "region_slug": "str", # Optional. A human-readable string that is
- used as a unique identifier for each region.
- "resource_id": 0, # Optional. A unique identifier for the resource
- that the action is associated with.
- "resource_type": "str", # Optional. The type of resource that the
- action is associated with.
- "started_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the action was
- initiated.
- "status": "in-progress", # Optional. Default value is "in-progress".
- The current status of the action. This can be "in-progress", "completed", or
- "errored". Known values are: "in-progress", "completed", and "errored".
- "type": "str" # Optional. This is the type of action that the object
- represents. For example, this could be "transfer" to represent the state of
- an image transfer action.
+ "scan": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When scan was
+ created.
+ "findings": [
+ {
+ "affected_resources_count": 0, # Optional. The
+ number of affected resources for the finding.
+ "business_impact": "str", # Optional. A description
+ of the business impact of the finding.
+ "details": "str", # Optional. A description of the
+ risk associated with the finding.
+ "found_at": "2020-02-20 00:00:00", # Optional. When
+ the finding was discovered.
+ "mitigation_steps": [
+ {
+ "description": "str", # Optional.
+ description.
+ "step": 0, # Optional. step.
+ "title": "str" # Optional. title.
+ }
+ ],
+ "name": "str", # Optional. The name of the rule that
+ triggered the finding.
+ "rule_uuid": "str", # Optional. The unique
+ identifier for the rule that triggered the finding.
+ "severity": "str", # Optional. The severity of the
+ finding. Known values are: "CRITICAL", "HIGH", "MEDIUM", and "LOW".
+ "technical_details": "str" # Optional. A description
+ of the technical details related to the finding.
+ }
+ ],
+ "id": "str", # Optional. The unique identifier for the scan.
+ "status": "str" # Optional. The status of the scan. Known values
+ are: "IN_PROGRESS", "COMPLETED", "FAILED", "CSPM_NOT_ENABLED", and
+ "SCAN_NOT_RUN".
}
}
# response body for status code(s): 404
@@ -187939,30 +193164,16 @@ def post(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- content_type: Optional[str] = kwargs.pop(
- "content_type", _headers.pop("Content-Type", None)
- )
cls: ClsType[JSON] = kwargs.pop("cls", None)
- content_type = content_type or "application/json"
- _json = None
- _content = None
- if isinstance(body, (IOBase, bytes)):
- _content = body
- else:
- if body is not None:
- _json = body
- else:
- _json = None
-
- _request = build_reserved_ipv6_actions_post_request(
- reserved_ipv6=reserved_ipv6,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_security_get_latest_scan_request(
+ per_page=per_page,
+ page=page,
+ severity=severity,
+ type=type,
headers=_headers,
params=_params,
)
@@ -187977,14 +193188,14 @@ def post(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ 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 == 201:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188021,45 +193232,23 @@ def post(
return cast(JSON, deserialized) # type: ignore
-
-class ByoipPrefixesOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.GeneratedClient`'s
- :attr:`byoip_prefixes` attribute.
- """
-
- def __init__(self, *args, **kwargs):
- input_args = list(args)
- self._client = input_args.pop(0) if input_args else kwargs.pop("client")
- self._config = input_args.pop(0) if input_args else kwargs.pop("config")
- self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
- self._deserialize = (
- input_args.pop(0) if input_args else kwargs.pop("deserializer")
- )
-
@overload
- def create(
+ def create_scan_rule(
self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a BYOIP Prefix.
+ """Create Scan Rule.
- To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
-
- A successful request will initiate the process of bringing your BYOIP Prefix into your account.
- The response will include the details of the created prefix, including its UUID and status.
+ To mark a scan finding as a false positive, send a POST request to
+ ``/v2/security/scans/rules`` to create a new scan rule.
:param body: Required.
: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: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -188067,19 +193256,11 @@ def create(
# JSON input template you can fill out and use as your body input.
body = {
- "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
- "region": "str", # The region where the prefix will be created. Required.
- "signature": "str" # The signature hash for the prefix creation request.
- Required.
+ "resource": "str" # Optional. The URN of a resource to exclude from future
+ scans.
}
- # response body for status code(s): 202
- response == {
- "region": "str", # Optional. The region where the prefix is created.
- "status": "str", # Optional. The status of the BYOIP prefix.
- "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
- }
- # response body for status code(s): 422
+ # response body for status code(s): 400, 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
@@ -188093,36 +193274,28 @@ def create(
"""
@overload
- def create(
+ def create_scan_rule(
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a BYOIP Prefix.
+ """Create Scan Rule.
- To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
-
- A successful request will initiate the process of bringing your BYOIP Prefix into your account.
- The response will include the details of the created prefix, including its UUID and status.
+ To mark a scan finding as a false positive, send a POST request to
+ ``/v2/security/scans/rules`` to create a new scan rule.
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 202
- response == {
- "region": "str", # Optional. The region where the prefix is created.
- "status": "str", # Optional. The status of the BYOIP prefix.
- "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
- }
- # response body for status code(s): 422
+ # response body for status code(s): 400, 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
@@ -188136,19 +193309,19 @@ def create(
"""
@distributed_trace
- def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ def create_scan_rule(
+ self, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a BYOIP Prefix.
+ """Create Scan Rule.
- To create a BYOIP prefix, send a POST request to ``/v2/byoip_prefixes``.
-
- A successful request will initiate the process of bringing your BYOIP Prefix into your account.
- The response will include the details of the created prefix, including its UUID and status.
+ To mark a scan finding as a false positive, send a POST request to
+ ``/v2/security/scans/rules`` to create a new scan rule.
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -188156,19 +193329,11 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# JSON input template you can fill out and use as your body input.
body = {
- "prefix": "str", # The IP prefix in CIDR notation to bring. Required.
- "region": "str", # The region where the prefix will be created. Required.
- "signature": "str" # The signature hash for the prefix creation request.
- Required.
+ "resource": "str" # Optional. The URN of a resource to exclude from future
+ scans.
}
- # response body for status code(s): 202
- response == {
- "region": "str", # Optional. The region where the prefix is created.
- "status": "str", # Optional. The status of the BYOIP prefix.
- "uuid": "str" # Optional. The unique identifier for the BYOIP prefix.
- }
- # response body for status code(s): 422
+ # response body for status code(s): 400, 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
@@ -188199,7 +193364,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -188209,7 +193374,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_byoip_prefixes_create_request(
+ _request = build_security_create_scan_rule_request(
content_type=content_type,
json=_json,
content=_content,
@@ -188227,14 +193392,26 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [202, 422]:
+ if response.status_code not in [201, 400, 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 == 202:
+ if response.status_code == 201:
+ 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 == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188250,7 +193427,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188267,17 +193444,30 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
@distributed_trace
- def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
- """List BYOIP Prefixes.
+ def list_scan_finding_affected_resources(
+ self,
+ scan_id: str,
+ finding_uuid: str,
+ *,
+ per_page: int = 20,
+ page: int = 1,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Finding Affected Resources.
- To list all BYOIP prefixes, send a GET request to ``/v2/byoip_prefixes``.
- A successful response will return a list of all BYOIP prefixes associated with the account.
+ To get affected resources for a scan finding, send a GET request to
+ ``/v2/security/scans/{scan_id}/findings/{finding_uuid}/affected_resources``.
+ :param scan_id: The scan UUID. Required.
+ :type scan_id: str
+ :param finding_uuid: The finding UUID. Required.
+ :type finding_uuid: str
: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.
@@ -188291,41 +193481,26 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "byoip_prefixes": [
+ "affected_resources": [
{
- "advertised": bool, # Optional. Whether the BYOIP prefix is
- being advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is
- locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project
- associated with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix
- is located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP
- prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the
- validation.
- "note": "str", # Optional. Additional notes
- or details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
+ "name": "str", # Optional. The name of the affected
+ resource.
+ "type": "str", # Optional. The type of the affected
+ resource.
+ "urn": "str" # Optional. The URN for the affected resource.
}
- ],
- "links": {
- "pages": {}
- }
+ ]
+ }
+ # 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]] = {
@@ -188346,7 +193521,9 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_list_request(
+ _request = build_security_list_scan_finding_affected_resources_request(
+ scan_id=scan_id,
+ finding_uuid=finding_uuid,
per_page=per_page,
page=page,
headers=_headers,
@@ -188363,27 +193540,44 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ 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 = {}
- 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 == 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.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
@@ -188391,16 +193585,18 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
+ def list_settings(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Get a BYOIP Prefix.
-
- To get a BYOIP prefix, send a GET request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """List Settings.
- A successful response will return the details of the specified BYOIP prefix.
+ To list CSPM scan settings, send a GET request to ``/v2/security/settings``.
- :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
- :type byoip_prefix_uuid: str
+ :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:
@@ -188410,32 +193606,61 @@ def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
+ "plan_downgrades": {
+ "str": {
+ "effective_at": "2020-02-20 00:00:00", # Optional. When the
+ coverage downgrade takes effect.
+ "resources": [
+ "str" # Optional. URNs of resources that will be
+ downgraded.
+ ]
+ }
+ },
+ "settings": {
+ "suppressions": {
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier
+ for the suppressed resource.
+ "resource_id": "str", # Optional. Unique
+ identifier for the resource suppressed.
+ "resource_type": "str", # Optional. Resource
+ type for the resource suppressed.
+ "rule_name": "str", # Optional.
+ Human-readable rule name for the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique
+ identifier for the suppressed rule.
+ }
+ ]
+ }
+ },
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
}
}
- # response body for status code(s): 404, 422
+ # 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
@@ -188465,8 +193690,9 @@ def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_get_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
+ _request = build_security_list_settings_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -188481,7 +193707,7 @@ def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404, 422]:
+ 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
@@ -188520,48 +193746,173 @@ def get(self, byoip_prefix_uuid: str, **kwargs: Any) -> JSON:
else:
deserialized = None
- if response.status_code == 422:
- 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 delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
+ @overload
+ def update_settings_plan(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Delete a BYOIP Prefix.
+ """Update Plan.
- To delete a BYOIP prefix and remove it from your account, send a DELETE request
- to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ To update CSPM plan coverage, send a PUT request to ``/v2/security/settings/plan``.
- A successful request will receive a 202 status code with no body in response.
- This indicates that the request was accepted and the prefix is being deleted.
+ :param body: Required.
+ :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: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
- :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
- :type byoip_prefix_uuid: str
- :return: JSON object or None
- :rtype: JSON or None
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. The URNs of resources to scan for
+ the tier.
+ ],
+ "tags": [
+ "str" # Optional. Resource tags to scan for the
+ tier.
+ ]
+ }
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
+ }
+ }
+ # response body for status code(s): 400, 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.
+ }
+ """
+
+ @overload
+ def update_settings_plan(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Plan.
+
+ To update CSPM plan coverage, send a PUT request to ``/v2/security/settings/plan``.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 404, 422
+ # response body for status code(s): 200
+ response == {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
+ }
+ }
+ # response body for status code(s): 400, 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.
+ }
+ """
+
+ @distributed_trace
+ def update_settings_plan(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Plan.
+
+ To update CSPM plan coverage, send a PUT request to ``/v2/security/settings/plan``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. The URNs of resources to scan for
+ the tier.
+ ],
+ "tags": [
+ "str" # Optional. Resource tags to scan for the
+ tier.
+ ]
+ }
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "tier_coverage": {
+ "str": {
+ "resources": [
+ "str" # Optional. Dictionary of
+ .
+ ],
+ "tags": [
+ "str" # Optional. Dictionary of
+ .
+ ]
+ }
+ }
+ }
+ # response body for status code(s): 400, 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
@@ -188586,13 +193937,26 @@ def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_delete_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_security_update_settings_plan_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -188607,15 +193971,14 @@ def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response
- if response.status_code not in [202, 404, 422]:
+ if response.status_code not in [200, 400, 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 == 202:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188626,7 +193989,12 @@ def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
"int", response.headers.get("ratelimit-reset")
)
- if response.status_code == 404:
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188642,7 +194010,7 @@ def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188659,29 +194027,19 @@ def delete(self, byoip_prefix_uuid: str, **kwargs: Any) -> Optional[JSON]:
deserialized = None
if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- return deserialized # type: ignore
+ return cast(JSON, deserialized) # type: ignore
@overload
- def patch(
- self,
- byoip_prefix_uuid: str,
- body: JSON,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
+ def create_suppression(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a BYOIP Prefix.
-
- To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """Create Suppression.
- Currently, you can update the advertisement status of the prefix.
- The response will include the updated details of the prefix.
+ To suppress scan findings, send a POST request to ``/v2/security/settings/suppressions``.
- :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
- :type byoip_prefix_uuid: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -188696,37 +194054,44 @@ def patch(
# JSON input template you can fill out and use as your body input.
body = {
- "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
+ "resources": [
+ "str" # Optional. The URNs of resources to suppress for the rule.
+ ],
+ "rule_uuid": "str" # Optional. The rule UUID to suppress for the listed
+ resources.
}
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
- }
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier for the
+ suppressed resource.
+ "resource_id": "str", # Optional. Unique identifier for the
+ resource suppressed.
+ "resource_type": "str", # Optional. Resource type for the
+ resource suppressed.
+ "rule_name": "str", # Optional. Human-readable rule name for
+ the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique identifier for the
+ suppressed rule.
+ }
+ ]
}
- # response body for status code(s): 404, 422
+ # response body for status code(s): 400, 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
@@ -188740,24 +194105,14 @@ def patch(
"""
@overload
- def patch(
- self,
- byoip_prefix_uuid: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any,
+ def create_suppression(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a BYOIP Prefix.
-
- To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """Create Suppression.
- Currently, you can update the advertisement status of the prefix.
- The response will include the updated details of the prefix.
+ To suppress scan findings, send a POST request to ``/v2/security/settings/suppressions``.
- :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
- :type byoip_prefix_uuid: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -188770,34 +194125,37 @@ def patch(
Example:
.. code-block:: python
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
- }
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier for the
+ suppressed resource.
+ "resource_id": "str", # Optional. Unique identifier for the
+ resource suppressed.
+ "resource_type": "str", # Optional. Resource type for the
+ resource suppressed.
+ "rule_name": "str", # Optional. Human-readable rule name for
+ the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique identifier for the
+ suppressed rule.
+ }
+ ]
}
- # response body for status code(s): 404, 422
+ # response body for status code(s): 400, 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
@@ -188811,19 +194169,12 @@ def patch(
"""
@distributed_trace
- def patch(
- self, byoip_prefix_uuid: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> JSON:
+ def create_suppression(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Update a BYOIP Prefix.
-
- To update a BYOIP prefix, send a PATCH request to ``/v2/byoip_prefixes/$byoip_prefix_uuid``.
+ """Create Suppression.
- Currently, you can update the advertisement status of the prefix.
- The response will include the updated details of the prefix.
+ To suppress scan findings, send a POST request to ``/v2/security/settings/suppressions``.
- :param byoip_prefix_uuid: A unique identifier for a BYOIP prefix. Required.
- :type byoip_prefix_uuid: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -188835,37 +194186,44 @@ def patch(
# JSON input template you can fill out and use as your body input.
body = {
- "advertise": bool # Optional. Whether the BYOIP prefix should be advertised.
+ "resources": [
+ "str" # Optional. The URNs of resources to suppress for the rule.
+ ],
+ "rule_uuid": "str" # Optional. The rule UUID to suppress for the listed
+ resources.
}
- # response body for status code(s): 202
+ # response body for status code(s): 201
response == {
- "byoip_prefix": {
- "advertised": bool, # Optional. Whether the BYOIP prefix is being
- advertised.
- "failure_reason": "str", # Optional. Reason for failure, if
- applicable.
- "locked": bool, # Optional. Whether the BYOIP prefix is locked.
- "name": "str", # Optional. Name of the BYOIP prefix.
- "prefix": "str", # Optional. The IP prefix in CIDR notation.
- "project_id": "str", # Optional. The ID of the project associated
- with the BYOIP prefix.
- "region": "str", # Optional. Region where the BYOIP prefix is
- located.
- "status": "str", # Optional. Status of the BYOIP prefix.
- "uuid": "str", # Optional. Unique identifier for the BYOIP prefix.
- "validations": [
- {
- "name": "str", # Optional. Name of the validation.
- "note": "str", # Optional. Additional notes or
- details about the validation.
- "status": "str" # Optional. Status of the
- validation.
- }
- ]
- }
+ "links": {
+ "pages": {
+ "first": "str", # Optional.
+ "last": "str", # Optional.
+ "next": "str", # Optional.
+ "prev": "str" # Optional.
+ }
+ },
+ "meta": {
+ "page": 0, # Optional.
+ "pages": 0, # Optional.
+ "total": 0 # Optional.
+ },
+ "resources": [
+ {
+ "id": "str", # Optional. Unique identifier for the
+ suppressed resource.
+ "resource_id": "str", # Optional. Unique identifier for the
+ resource suppressed.
+ "resource_type": "str", # Optional. Resource type for the
+ resource suppressed.
+ "rule_name": "str", # Optional. Human-readable rule name for
+ the suppressed rule.
+ "rule_uuid": "str" # Optional. Unique identifier for the
+ suppressed rule.
+ }
+ ]
}
- # response body for status code(s): 404, 422
+ # response body for status code(s): 400, 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
@@ -188906,8 +194264,7 @@ def patch(
else:
_json = body
- _request = build_byoip_prefixes_patch_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
+ _request = build_security_create_suppression_request(
content_type=content_type,
json=_json,
content=_content,
@@ -188925,14 +194282,14 @@ def patch(
response = pipeline_response.http_response
- if response.status_code not in [202, 404, 422]:
+ if response.status_code not in [201, 400, 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 == 202:
+ if response.status_code == 201:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188948,7 +194305,7 @@ def patch(
else:
deserialized = None
- if response.status_code == 404:
+ if response.status_code == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188964,7 +194321,7 @@ def patch(
else:
deserialized = None
- if response.status_code == 422:
+ if response.status_code == 404:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -188986,57 +194343,24 @@ def patch(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def list_resources(
- self,
- byoip_prefix_uuid: str,
- *,
- per_page: int = 20,
- page: int = 1,
- **kwargs: Any,
- ) -> JSON:
+ def delete_suppression(
+ self, suppression_uuid: str, **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List BYOIP Prefix Resources.
+ """Delete Suppression.
- To list resources associated with BYOIP prefixes, send a GET request to
- ``/v2/byoip_prefixes/{byoip_prefix_uuid}/ips``.
-
- A successful response will return a list of resources associated with the specified BYOIP
- prefix.
+ To remove a suppression, send a DELETE request to
+ ``/v2/security/settings/suppressions/{suppression_uuid}``.
- :param byoip_prefix_uuid: The unique identifier for the BYOIP Prefix. Required.
- :type byoip_prefix_uuid: str
- :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
+ :param suppression_uuid: The suppression UUID to remove. Required.
+ :type suppression_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): 200
- response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
- },
- "ips": [
- {
- "assigned_at": "2020-02-20 00:00:00", # Optional. Time when
- the allocation was assigned.
- "byoip": "str", # Optional. The BYOIP prefix UUID.
- "id": 0, # Optional. Unique identifier for the allocation.
- "region": "str", # Optional. Region where the allocation is
- made.
- "resource": "str" # Optional. The resource associated with
- the allocation.
- }
- ],
- "links": {
- "pages": {}
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -189065,12 +194389,10 @@ def list_resources(
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_byoip_prefixes_list_resources_request(
- byoip_prefix_uuid=byoip_prefix_uuid,
- per_page=per_page,
- page=page,
+ _request = build_security_delete_suppression_request(
+ suppression_uuid=suppression_uuid,
headers=_headers,
params=_params,
)
@@ -189085,14 +194407,15 @@ def list_resources(
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ 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 == 200:
+ if response.status_code == 204:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -189103,11 +194426,6 @@ def list_resources(
"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")
@@ -189125,9 +194443,9 @@ def list_resources(
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return deserialized # type: ignore
class SizesOperations: