diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt
index 67d44682..3fd0cbe6 100644
--- a/DO_OPENAPI_COMMIT_SHA.txt
+++ b/DO_OPENAPI_COMMIT_SHA.txt
@@ -1 +1 @@
-97dca99
+b3d74c7
diff --git a/src/pydo/_client.py b/src/pydo/_client.py
index c59a0d6d..5312165e 100644
--- a/src/pydo/_client.py
+++ b/src/pydo/_client.py
@@ -45,6 +45,8 @@
KubernetesOperations,
LoadBalancersOperations,
McpServersOperations,
+ MicrovmCheckpointsOperations,
+ MicrovmsOperations,
MonitoringOperations,
NfsOperations,
OneClicksOperations,
@@ -63,6 +65,7 @@
ReservedIPv6Operations,
SecurityOperations,
SessionsOperations,
+ SignalsOperations,
SizesOperations,
SnapshotsOperations,
SpacesKeyOperations,
@@ -160,10 +163,16 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype image_actions: pydo.operations.ImageActionsOperations
:ivar insights: InsightsOperations operations
:vartype insights: pydo.operations.InsightsOperations
+ :ivar signals: SignalsOperations operations
+ :vartype signals: pydo.operations.SignalsOperations
:ivar kubernetes: KubernetesOperations operations
:vartype kubernetes: pydo.operations.KubernetesOperations
:ivar load_balancers: LoadBalancersOperations operations
:vartype load_balancers: pydo.operations.LoadBalancersOperations
+ :ivar microvms: MicrovmsOperations operations
+ :vartype microvms: pydo.operations.MicrovmsOperations
+ :ivar microvm_checkpoints: MicrovmCheckpointsOperations operations
+ :vartype microvm_checkpoints: pydo.operations.MicrovmCheckpointsOperations
:ivar monitoring: MonitoringOperations operations
:vartype monitoring: pydo.operations.MonitoringOperations
:ivar nfs: NfsOperations operations
@@ -372,12 +381,21 @@ def __init__(
self.insights = InsightsOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.signals = SignalsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.kubernetes = KubernetesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.load_balancers = LoadBalancersOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.microvms = MicrovmsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.microvm_checkpoints = MicrovmCheckpointsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.monitoring = MonitoringOperations(
self._client, self._config, self._serialize, self._deserialize
)
diff --git a/src/pydo/aio/_client.py b/src/pydo/aio/_client.py
index cb653108..e74b602b 100644
--- a/src/pydo/aio/_client.py
+++ b/src/pydo/aio/_client.py
@@ -45,6 +45,8 @@
KubernetesOperations,
LoadBalancersOperations,
McpServersOperations,
+ MicrovmCheckpointsOperations,
+ MicrovmsOperations,
MonitoringOperations,
NfsOperations,
OneClicksOperations,
@@ -63,6 +65,7 @@
ReservedIPv6Operations,
SecurityOperations,
SessionsOperations,
+ SignalsOperations,
SizesOperations,
SnapshotsOperations,
SpacesKeyOperations,
@@ -160,10 +163,16 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype image_actions: pydo.aio.operations.ImageActionsOperations
:ivar insights: InsightsOperations operations
:vartype insights: pydo.aio.operations.InsightsOperations
+ :ivar signals: SignalsOperations operations
+ :vartype signals: pydo.aio.operations.SignalsOperations
:ivar kubernetes: KubernetesOperations operations
:vartype kubernetes: pydo.aio.operations.KubernetesOperations
:ivar load_balancers: LoadBalancersOperations operations
:vartype load_balancers: pydo.aio.operations.LoadBalancersOperations
+ :ivar microvms: MicrovmsOperations operations
+ :vartype microvms: pydo.aio.operations.MicrovmsOperations
+ :ivar microvm_checkpoints: MicrovmCheckpointsOperations operations
+ :vartype microvm_checkpoints: pydo.aio.operations.MicrovmCheckpointsOperations
:ivar monitoring: MonitoringOperations operations
:vartype monitoring: pydo.aio.operations.MonitoringOperations
:ivar nfs: NfsOperations operations
@@ -372,12 +381,21 @@ def __init__(
self.insights = InsightsOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.signals = SignalsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.kubernetes = KubernetesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.load_balancers = LoadBalancersOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.microvms = MicrovmsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.microvm_checkpoints = MicrovmCheckpointsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.monitoring = MonitoringOperations(
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 163af5e7..ba9e9863 100644
--- a/src/pydo/aio/operations/__init__.py
+++ b/src/pydo/aio/operations/__init__.py
@@ -38,8 +38,11 @@
from ._operations import ImagesOperations
from ._operations import ImageActionsOperations
from ._operations import InsightsOperations
+from ._operations import SignalsOperations
from ._operations import KubernetesOperations
from ._operations import LoadBalancersOperations
+from ._operations import MicrovmsOperations
+from ._operations import MicrovmCheckpointsOperations
from ._operations import MonitoringOperations
from ._operations import NfsOperations
from ._operations import OrganizationsOperations
@@ -112,8 +115,11 @@
"ImagesOperations",
"ImageActionsOperations",
"InsightsOperations",
+ "SignalsOperations",
"KubernetesOperations",
"LoadBalancersOperations",
+ "MicrovmsOperations",
+ "MicrovmCheckpointsOperations",
"MonitoringOperations",
"NfsOperations",
"OrganizationsOperations",
diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py
index 3273a2ff..ab67f236 100644
--- a/src/pydo/aio/operations/_operations.py
+++ b/src/pydo/aio/operations/_operations.py
@@ -442,10 +442,13 @@
build_insights_get_prom_query_range_request,
build_insights_get_prom_query_request,
build_insights_get_prom_series_request,
+ build_insights_get_trace_request,
build_insights_list_alert_instances_request,
build_insights_list_alert_rules_request,
build_insights_list_notification_channels_request,
build_insights_post_logs_search_request,
+ build_insights_post_spans_search_request,
+ build_insights_post_traces_search_request,
build_insights_update_alert_rule_request,
build_insights_update_notification_channel_request,
build_invoices_get_by_uuid_request,
@@ -499,6 +502,19 @@
build_mcp_servers_patch_request,
build_mcp_servers_run_resync_request,
build_mcp_servers_update_tools_request,
+ build_microvm_checkpoints_create_request,
+ build_microvm_checkpoints_delete_request,
+ build_microvm_checkpoints_get_request,
+ build_microvm_checkpoints_list_request,
+ build_microvms_create_request,
+ build_microvms_delete_request,
+ build_microvms_get_console_request,
+ build_microvms_get_options_request,
+ build_microvms_get_request,
+ build_microvms_list_request,
+ build_microvms_post_pause_request,
+ build_microvms_post_resume_request,
+ build_microvms_run_command_request,
build_monitoring_create_alert_policy_request,
build_monitoring_create_destination_request,
build_monitoring_create_sink_request,
@@ -680,6 +696,19 @@
build_sessions_delete_request,
build_sessions_list_request,
build_sessions_list_search_request,
+ build_signals_create_deletion_request,
+ build_signals_create_export_request,
+ build_signals_get_consent_request,
+ build_signals_get_deletion_request,
+ build_signals_get_export_download_request,
+ build_signals_get_export_options_request,
+ build_signals_get_export_request,
+ build_signals_list_agent_sessions_request,
+ build_signals_list_consents_request,
+ build_signals_list_deletions_request,
+ build_signals_list_exports_request,
+ build_signals_list_session_dialogues_request,
+ build_signals_update_consent_request,
build_sizes_list_request,
build_snapshots_delete_request,
build_snapshots_get_request,
@@ -23816,7 +23845,8 @@ async def create(
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -40539,7 +40569,8 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -166341,42 +166372,249 @@ async def post_logs_search(
return cast(JSON, deserialized) # type: ignore
+ @overload
+ async def post_traces_search(
+ self,
+ region: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Union[JSON, str]:
+ # pylint: disable=line-too-long
+ """Search traces.
-class KubernetesOperations: # pylint: disable=too-many-public-methods
- """
- .. warning::
- **DO NOT** instantiate this class directly.
+ To search traces in a region, send a POST request to
+ ``/v2/insights/query/{region}/traces/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ Each result is one trace, aggregated from all of its spans in the time range. A trace is
+ included when at least one of its spans matches ``filter``. The time range must not exceed 7
+ days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is
+ ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless
+ ``orderBy`` is set.
+ JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ ,
+ ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are
+ rejected with ``400``.
+ Each request searches a single region; there is no multi-region search. Supported regions are
+ ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ ,
+ ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ , ``sfo2``\\ , ``sfo3``\\ ,
+ ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60 seconds.
+ Errors produced by the traces service (\\ ``400``\\ ) have a ``text/plain`` body containing a
+ short message. Authentication and authorization errors (\\ ``401``\\ , ``403``\\ ), rate
+ limiting (\\ ``429``\\ ), and routing errors (for example, ``404`` for an unknown region) come
+ from the API gateway and use the standard JSON error object with ``id`` and ``message``.
+ ``403`` is also returned for accounts that are in a trial or not in good standing. If the
+ regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body.
- Instead, you should access the following operations through
- :class:`~pydo.aio.GeneratedClient`'s
- :attr:`kubernetes` attribute.
- """
+ :param region: The datacenter region slug for the query. Required.
+ :type region: 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 or str
+ :rtype: JSON or str
+ :raises ~azure.core.exceptions.HttpResponseError:
- 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")
- )
+ Example:
+ .. code-block:: python
- @distributed_trace_async
- async def list_clusters(
- self, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ }
+ },
+ "filter": {
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Without ``scope``"" , these
+ names (case-insensitive) resolve to built-in span columns: `traceId`
+ (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId`
+ (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`,
+ `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in
+ nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode`
+ (`status.code`, `status_code`), `statusMessage` (`status.message`,
+ `status_message`), and `serviceName` (`service.name`, `service_name`).
+ Any other name is looked up as a span attribute, falling back to a
+ resource attribute. With `scope` set, `name` is always treated as an
+ attribute key. Attribute keys may contain only letters, digits, and `.`,
+ `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field description.
+ Required.
+ "scope": "str" # Optional. Restricts the lookup to one
+ attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or
+ ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to
+ use the built-in column mapping described for ``name``. Ignored in traces
+ ``orderBy``. Known values are: "resource", "resource.attributes",
+ "attribute", "attributes", and "span.attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Matching is case-insensitive, and the symbol forms
+ ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted
+ as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and
+ ``lte``. ``exists`` matches spans where the field is present and non-empty
+ and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100
+ entries. ``neq`` on string fields also matches spans where the field is
+ absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and
+ "lte".
+ "query": "str", # Optional. The search string for a ``text_search``
+ node. Leading and trailing whitespace is trimmed; the trimmed string must be
+ non-empty.
+ "type": "condition", # Optional. Default value is "condition". The
+ node type. Matching is case-insensitive. Known values are: "condition",
+ "and", "or", "not", and "text_search".
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Without ``scope``""
+ , these names (case-insensitive) resolve to built-in span columns:
+ `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`),
+ `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime`
+ (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs`
+ (`duration`, in nanoseconds), `name` (`span.name`), `kind`
+ (`span.kind`), `statusCode` (`status.code`, `status_code`),
+ `statusMessage` (`status.message`, `status_message`), and
+ `serviceName` (`service.name`, `service_name`). Any other name is
+ looked up as a span attribute, falling back to a resource attribute.
+ With `scope` set, `name` is always treated as an attribute key.
+ Attribute keys may contain only letters, digits, and `.`, `_`, `-`,
+ `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field
+ description. Required.
+ "scope": "str" # Optional. Restricts the lookup to
+ one attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute``
+ (or ``attributes``"" , ``span.attributes``"" ) reads span attributes.
+ Omit to use the built-in column mapping described for ``name``.
+ Ignored in traces ``orderBy``. Known values are: "resource",
+ "resource.attributes", "attribute", "attributes", and
+ "span.attributes".
+ },
+ "direction": "desc" # Optional. Default value is "desc". The
+ sort direction (case-insensitive). Defaults to ``desc``. Known values
+ are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ traces to return. Omitted or ``0`` uses the default of 100. Negative values
+ or values above 1000 return ``400``"" ; they are not clamped.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "traceId": "str", # The trace identifier. Required.
+ "durationNs": 0, # Optional. Wall-clock duration of the
+ trace in nanoseconds.
+ "errorCount": 0, # Optional. The number of spans in the
+ trace with an ``Error`` status code. Omitted when zero.
+ "serviceName": "str", # Optional. The service that emitted
+ the root span. Omitted when the root span has no service.name resource
+ attribute.
+ "spanCount": 0, # Optional. The number of spans in the
+ trace.
+ "spanNames": [
+ "str" # Optional. The distinct span names present in
+ the trace.
+ ],
+ "started": "2020-02-20 00:00:00", # Optional. The start time
+ of the earliest span in the trace, in RFC 3339 format.
+ "status": "str" # Optional. The rolled-up status of the
+ trace. ``Error`` if any span has an ``Error`` status code, otherwise
+ ``Ok``. Known values are: "Ok" and "Error".
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Whether more results matched the query than were
+ returned. Required.
+ }
+ }
+ # response body for status code(s): 403, 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 post_traces_search(
+ self,
+ region: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Union[JSON, str]:
# pylint: disable=line-too-long
- """List All Kubernetes Clusters.
+ """Search traces.
- To list all of the Kubernetes clusters on your account, send a GET request
- to ``/v2/kubernetes/clusters``.
+ To search traces in a region, send a POST request to
+ ``/v2/insights/query/{region}/traces/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ Each result is one trace, aggregated from all of its spans in the time range. A trace is
+ included when at least one of its spans matches ``filter``. The time range must not exceed 7
+ days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is
+ ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless
+ ``orderBy`` is set.
+ JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ ,
+ ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are
+ rejected with ``400``.
+ Each request searches a single region; there is no multi-region search. Supported regions are
+ ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ ,
+ ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ , ``sfo2``\\ , ``sfo3``\\ ,
+ ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60 seconds.
+ Errors produced by the traces service (\\ ``400``\\ ) have a ``text/plain`` body containing a
+ short message. Authentication and authorization errors (\\ ``401``\\ , ``403``\\ ), rate
+ limiting (\\ ``429``\\ ), and routing errors (for example, ``404`` for an unknown region) come
+ from the API gateway and use the standard JSON error object with ``id`` and ``message``.
+ ``403`` is also returned for accounts that are in a trial or not in good standing. If the
+ regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body.
- :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 region: The datacenter region slug for the query. Required.
+ :type region: 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 or str
+ :rtype: JSON or str
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -166384,272 +166622,237 @@ async def list_clusters(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
+ "data": [
+ {
+ "traceId": "str", # The trace identifier. Required.
+ "durationNs": 0, # Optional. Wall-clock duration of the
+ trace in nanoseconds.
+ "errorCount": 0, # Optional. The number of spans in the
+ trace with an ``Error`` status code. Omitted when zero.
+ "serviceName": "str", # Optional. The service that emitted
+ the root span. Omitted when the root span has no service.name resource
+ attribute.
+ "spanCount": 0, # Optional. The number of spans in the
+ trace.
+ "spanNames": [
+ "str" # Optional. The distinct span names present in
+ the trace.
+ ],
+ "started": "2020-02-20 00:00:00", # Optional. The start time
+ of the earliest span in the trace, in RFC 3339 format.
+ "status": "str" # Optional. The rolled-up status of the
+ trace. ``Error`` if any span has an ``Error`` status code, otherwise
+ ``Ok``. Known values are: "Ok" and "Error".
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Whether more results matched the query than were
+ returned. Required.
+ }
+ }
+ # response body for status code(s): 403, 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 post_traces_search(
+ self, region: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Union[JSON, str]:
+ # pylint: disable=line-too-long
+ """Search traces.
+
+ To search traces in a region, send a POST request to
+ ``/v2/insights/query/{region}/traces/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ Each result is one trace, aggregated from all of its spans in the time range. A trace is
+ included when at least one of its spans matches ``filter``. The time range must not exceed 7
+ days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is
+ ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless
+ ``orderBy`` is set.
+ JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ ,
+ ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are
+ rejected with ``400``.
+ Each request searches a single region; there is no multi-region search. Supported regions are
+ ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ ,
+ ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ , ``sfo2``\\ , ``sfo3``\\ ,
+ ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60 seconds.
+ Errors produced by the traces service (\\ ``400``\\ ) have a ``text/plain`` body containing a
+ short message. Authentication and authorization errors (\\ ``401``\\ , ``403``\\ ), rate
+ limiting (\\ ``429``\\ ), and routing errors (for example, ``404`` for an unknown region) come
+ from the API gateway and use the standard JSON error object with ``id`` and ``message``.
+ ``403`` is also returned for accounts that are in a trial or not in good standing. If the
+ regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object or str
+ :rtype: JSON or str
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ }
},
- "kubernetes_clusters": [
+ "filter": {
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Without ``scope``"" , these
+ names (case-insensitive) resolve to built-in span columns: `traceId`
+ (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId`
+ (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`,
+ `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in
+ nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode`
+ (`status.code`, `status_code`), `statusMessage` (`status.message`,
+ `status_message`), and `serviceName` (`service.name`, `service_name`).
+ Any other name is looked up as a span attribute, falling back to a
+ resource attribute. With `scope` set, `name` is always treated as an
+ attribute key. Attribute keys may contain only letters, digits, and `.`,
+ `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field description.
+ Required.
+ "scope": "str" # Optional. Restricts the lookup to one
+ attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or
+ ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to
+ use the built-in column mapping described for ``name``. Ignored in traces
+ ``orderBy``. Known values are: "resource", "resource.attributes",
+ "attribute", "attributes", and "span.attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Matching is case-insensitive, and the symbol forms
+ ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted
+ as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and
+ ``lte``. ``exists`` matches spans where the field is present and non-empty
+ and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100
+ entries. ``neq`` on string fields also matches spans where the field is
+ absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and
+ "lte".
+ "query": "str", # Optional. The search string for a ``text_search``
+ node. Leading and trailing whitespace is trimmed; the trimmed string must be
+ non-empty.
+ "type": "condition", # Optional. Default value is "condition". The
+ node type. Matching is case-insensitive. Known values are: "condition",
+ "and", "or", "not", and "text_search".
+ "value": {}
+ },
+ "orderBy": [
{
- "name": "str", # A human-readable name for a Kubernetes
- cluster. Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean
- value indicating whether auto-scaling is enabled for this node
- pool.
- "count": 0, # Optional. The number of
- Droplet instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The
- AMD GPU partition mode for this node pool. Only applicable to AMD
- GPU sizes that support partitioning. Immutable after the node
- pool is created. When omitted, the GPUs in the pool are left
- unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1"
- and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that
- can be used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of
- key/value mappings specifying labels to apply to all nodes in a
- pool. Labels will automatically be applied to all existing nodes
- and any subsequent nodes added to the pool. Note that when a
- label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum
- number of nodes that this node pool can be auto-scaled to. The
- value will be ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum
- number of nodes that this node pool can be auto-scaled to. The
- value will be ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable
- name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20
- 00:00:00", # Optional. A time value given in ISO8601
- combined date and time format that represents when the
- node was created.
- "droplet_id": "str", #
- Optional. The ID of the Droplet used for the worker node.
- "id": "str", # Optional. A
- unique ID that can be used to identify and reference the
- node.
- "name": "str", # Optional.
- An automatically generated, human-readable name for the
- node.
- "status": {
- "state": "str" #
- Optional. A string indicating the current status of
- the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20
- 00:00:00" # Optional. A time value given in ISO8601
- combined date and time format that represents when the
- node was last updated.
- }
- ],
- "size": "str", # Optional. The slug
- identifier for the type of Droplet used as workers in the node
- pool.
- "tags": [
- "str" # Optional. An array
- containing the tags applied to the node pool. All node pools
- are automatically tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional.
- How the node reacts to pods that it won't tolerate.
- Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values
- are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if
- the value of the ``key`` field is "special" and the value
- of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional.
- An arbitrary string. The ``key`` and ``value`` fields of
- the ``taint`` object form a key-value pair. For example,
- if the value of the ``key`` field is "special" and the
- value of the ``value`` field is "gpu", the key value pair
- would be ``special=gpu``.
- }
- ]
- }
- ],
- "region": "str", # The slug identifier for the region where
- the Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"),
- the latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available
- versions. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the
- AMD Device Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the
- AMD GPU Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the
- AMD GPU DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether the cluster will be automatically
- upgraded to new patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used
- by cluster-autoscaler. The autoscaler will apply each expander
- from the provided list to narrow down the selection of node types
- created to scale up, until either a single node type is left, or
- the list of expanders is exhausted. If this flag is unset,
- autoscaler will use its default expander ``random``. Passing an
- empty list ("" *not* ``null``"" ) will unset any previous
- expander customizations. Available expanders: * ``random``"" :
- Randomly selects a node group to scale. * `priority`: Selects the
- node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in
- the least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used
- to customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional.
- Used to customize when cluster autoscaler scales down non-empty nodes
- by setting the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP
- addresses for the overlay network of the Kubernetes cluster in CIDR
- notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public
- addresses (IPv4 or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the
- control plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the
- CoreDNS Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the Kubernetes cluster was created.
- "endpoint": "str", # Optional. The base URL of the API
- server on the Kubernetes master node.
- "ha": False, # Optional. Default value is False. A boolean
- value indicating whether the control plane is run in a highly available
- configuration in the cluster. Highly available control planes incur less
- downtime. The property cannot be disabled. When omitted on create, the
- default is version-dependent; for DOKS 1.36.0 and later, the default is
- true; for earlier versions, the default is false.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the
- Kubernetes master node. This will not be set if high availability is
- configured on the cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is
- False. A boolean value indicating whether worker nodes in the cluster are
- not assigned public IP addresses. When omitted on create, the default
- value is false. When enabled, a NAT gateway must exist in the VPC where
- the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance
- window policy. May be one of ``monday`` through ``sunday``"" , or
- ``any`` to indicate an arbitrary week day. Known values are: "any",
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday",
- and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in
- UTC of the maintenance window policy in 24-hour clock format / HH:MM
- notation (e.g., ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the
- NFS CSI plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Nvidia GPU Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the
- NVIDIA GPU DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the
- RDMA shared device plugin is enabled.
- },
- "registries": [
- "str" # Optional. An array of integrated DOCR
- registries.
- ],
- "registry_enabled": bool, # Optional. A read-only boolean
- value indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable
- IP addresses for services running in the Kubernetes cluster in CIDR
- notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is
- False. Indicates whether SSO authentication is enabled for the
- cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL
- for the identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is
- False. Indicates whether any non-SSO forms of authentication are
- disallowed. Can only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message
- providing additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the
- current status of the cluster. Known values are: "running",
- "provisioning", "degraded", "error", "deleted", "upgrading", and
- "deleting".
+ "field": {
+ "name": "str", # The field name. Without ``scope``""
+ , these names (case-insensitive) resolve to built-in span columns:
+ `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`),
+ `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime`
+ (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs`
+ (`duration`, in nanoseconds), `name` (`span.name`), `kind`
+ (`span.kind`), `statusCode` (`status.code`, `status_code`),
+ `statusMessage` (`status.message`, `status_message`), and
+ `serviceName` (`service.name`, `service_name`). Any other name is
+ looked up as a span attribute, falling back to a resource attribute.
+ With `scope` set, `name` is always treated as an attribute key.
+ Attribute keys may contain only letters, digits, and `.`, `_`, `-`,
+ `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field
+ description. Required.
+ "scope": "str" # Optional. Restricts the lookup to
+ one attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute``
+ (or ``attributes``"" , ``span.attributes``"" ) reads span attributes.
+ Omit to use the built-in column mapping described for ``name``.
+ Ignored in traces ``orderBy``. Known values are: "resource",
+ "resource.attributes", "attribute", "attributes", and
+ "span.attributes".
},
- "surge_upgrade": False, # Optional. Default value is False.
- A boolean value indicating whether surge upgrade is enabled/disabled for
- the cluster. Surge upgrade makes cluster upgrades fast and reliable by
- bringing up new nodes before destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags applied to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the Kubernetes cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID
- of the VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC
- subnet worker nodes are attached to. When unset, the default subnet for
- the VPC is used.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "direction": "desc" # Optional. Default value is "desc". The
+ sort direction (case-insensitive). Defaults to ``desc``. Known values
+ are: "asc" and "desc".
}
],
- "links": {
- "pages": {}
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ traces to return. Omitted or ``0`` uses the default of 100. Negative values
+ or values above 1000 return ``400``"" ; they are not clamped.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "traceId": "str", # The trace identifier. Required.
+ "durationNs": 0, # Optional. Wall-clock duration of the
+ trace in nanoseconds.
+ "errorCount": 0, # Optional. The number of spans in the
+ trace with an ``Error`` status code. Omitted when zero.
+ "serviceName": "str", # Optional. The service that emitted
+ the root span. Omitted when the root span has no service.name resource
+ attribute.
+ "spanCount": 0, # Optional. The number of spans in the
+ trace.
+ "spanNames": [
+ "str" # Optional. The distinct span names present in
+ the trace.
+ ],
+ "started": "2020-02-20 00:00:00", # Optional. The start time
+ of the earliest span in the trace, in RFC 3339 format.
+ "status": "str" # Optional. The rolled-up status of the
+ trace. ``Error`` if any span has an ``Error`` status code, otherwise
+ ``Ok``. Known values are: "Ok" and "Error".
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Whether more results matched the query than were
+ returned. Required.
}
}
+ # response body for status code(s): 403, 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,
@@ -166664,14 +166867,27 @@ async def list_clusters(
}
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[JSON] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[Union[JSON, str]] = kwargs.pop("cls", None)
- _request = build_kubernetes_list_clusters_request(
- 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:
+ _json = body
+
+ _request = build_insights_post_traces_search_request(
+ region=region,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -166686,50 +166902,389 @@ async def list_clusters(
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ if response.status_code not in [200, 400, 403, 404, 404, 502]:
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")
+ 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 == 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 == 403:
+ 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 == 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 == 502:
+ 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(Union[JSON, str], deserialized), response_headers) # type: ignore
+
+ return cast(Union[JSON, str], deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def get_trace(
+ self,
+ region: str,
+ trace_id: str,
+ *,
+ from_parameter: Optional[str] = None,
+ to: Optional[str] = None,
+ **kwargs: Any
+ ) -> Union[JSON, str]:
+ # pylint: disable=line-too-long
+ """Retrieve an existing trace.
+
+ To retrieve a single trace and all of its spans, send a GET request to
+ ``/v2/insights/query/{region}/traces/{trace_id}``.
+ Only spans that started within the lookup window are returned. The window defaults to the last
+ 7 days and can be narrowed with the ``from`` and ``to`` query parameters; it must not exceed 7
+ days, and ``from`` must not be after ``to``. Spans are returned ordered by start time. At most
+ 10,000 spans are returned; ``truncated`` is ``true`` when the trace has more.
+ A trace ID with no spans in the window returns ``404``\\ , as do malformed or uppercase trace
+ IDs. A trace is only resolvable in the region that ingested it; querying another region also
+ returns ``404``.
+ Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ ,
+ ``lon1``\\ , ``mem1``\\ , ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ ,
+ ``sfo2``\\ , ``sfo3``\\ , ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60
+ seconds.
+ Errors produced by the traces service (\\ ``400``\\ , and ``404`` when no trace is found) have
+ a ``text/plain`` body containing a short message. Authentication and authorization errors (\\
+ ``401``\\ , ``403``\\ ), rate limiting (\\ ``429``\\ ), and routing errors (for example,
+ ``404`` for an unknown region) come from the API gateway and use the standard JSON error object
+ with ``id`` and ``message``. ``403`` is also returned for accounts that are in a trial or not
+ in good standing. If the regional traces backend cannot be reached, the response is ``502``
+ with a ``text/plain`` body.
+ JSON field names are camelCase (\\ ``traceId``\\ , ``spanId``\\ , ``startTime``\\ ,
+ ``endTime``\\ , ``durationNs``\\ , ``serviceName``\\ , ``statusCode``\\ , ``parentSpanId``\\ ).
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param trace_id: The OpenTelemetry trace ID to retrieve, as 32 lowercase hexadecimal
+ characters. IDs are matched exactly; an ID with no spans in the lookup window returns ``404``.
+ Malformed or uppercase IDs are not rejected with ``400``\\ ; they also return ``404``.
+ Required.
+ :type trace_id: str
+ :keyword from_parameter: Start of the trace lookup window. Accepts a relative time (\\
+ ``now``\\ , a bare duration such as ``24h`` to look back from now, or ``now-2h``\\ ) or an
+ absolute time (RFC3339, or a Unix epoch integer in seconds, milliseconds, microseconds, or
+ nanoseconds). Defaults to 7 days before now. Default value is None.
+ :paramtype from_parameter: str
+ :keyword to: End of the trace lookup window, in the same formats as ``from``. Defaults to now.
+ Default value is None.
+ :paramtype to: str
+ :return: JSON object or str
+ :rtype: JSON or str
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "spans": [
+ {
+ "spanId": "str", # The span identifier. Required.
+ "traceId": "str", # The trace this span belongs to.
+ Required.
+ "attributes": {
+ "str": "str" # Optional. Span attributes. Omitted
+ when empty.
+ },
+ "durationNs": 0, # Optional. Span duration in nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The OpenTelemetry span kind as a
+ string, for example ``Server``"" , ``Client``"" , or ``Internal``.
+ "name": "str", # Optional. The span name, typically the
+ operation being performed.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for the root span.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The service that emitted
+ the span. Omitted when the span has no service.name resource attribute.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The OpenTelemetry span
+ status code as a string: ``Unset``"" , ``Ok``"" , or ``Error``.
+ "statusMessage": "str" # Optional. The status description.
+ Omitted when empty.
+ }
+ ],
+ "traceId": "str", # Optional. The trace identifier.
+ "truncated": bool # Optional. True when the trace has more spans than were
+ returned in this response. Omitted when false.
+ }
+ # response body for status code(s): 403, 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[Union[JSON, str]] = kwargs.pop("cls", None)
+
+ _request = build_insights_get_trace_request(
+ region=region,
+ trace_id=trace_id,
+ from_parameter=from_parameter,
+ to=to,
+ headers=_headers,
+ params=_params,
)
- response_headers["ratelimit-reset"] = self._deserialize(
- "int", response.headers.get("ratelimit-reset")
+ _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
+ )
)
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 400, 403, 404, 404, 502]:
+ 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 == 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 == 403:
+ 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 == 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 == 502:
+ 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, cast(Union[JSON, str], deserialized), response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return cast(Union[JSON, str], deserialized) # type: ignore
@overload
- async def create_cluster(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ async def post_spans_search(
+ self,
+ region: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Kubernetes Cluster.
-
- To create a new Kubernetes cluster, send a POST request to
- ``/v2/kubernetes/clusters``. The request must contain at least one node pool
- with at least one worker.
+ """Search spans.
- The request may contain a maintenance window policy describing a time period
- when disruptive maintenance tasks may be carried out. Omitting the policy
- implies that a window will be chosen automatically. See
- `here `_
- for details.
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -166744,505 +167299,802 @@ async def create_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A human-readable name for a Kubernetes cluster. Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value indicating
- whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in
- the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes that
- support partitioning. Immutable after the node pool is created. When
- omitted, the GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings
- specifying labels to apply to all nodes in a pool. Labels will
- automatically be applied to all existing nodes and any subsequent nodes
- added to the pool. Note that when a label is removed, it is not deleted
- from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for the
- node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was created.
- "droplet_id": "str", # Optional. The ID of
- the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that
- can be used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type
- of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags
- applied to the node pool. All node pools are automatically tagged
- ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node
- reacts to pods that it won't tolerate. Available effect values
- are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- "value": "str" # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- }
- ]
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
}
- ],
- "region": "str", # The slug identifier for the region where the Kubernetes
- cluster is located. Required.
- "version": "str", # The slug identifier for the version of Kubernetes used
- for the cluster. If set to a minor version (e.g. "1.14"), the latest version
- within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
- published version will be used. See the ``/v2/kubernetes/options`` endpoint to
- find all currently available versions. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
},
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for the
- overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
- node. This will not be set if high availability is configured on the cluster
- (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A boolean
- value indicating whether worker nodes in the cluster are not assigned public IP
- addresses. When omitted on create, the default value is false. When enabled, a
- NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value indicating
- if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP addresses
- for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current status of
- the cluster. Known values are: "running", "provisioning", "degraded",
- "error", "deleted", "upgrading", and "deleting".
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
},
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags to apply to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
- ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
- removed.
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
- which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
- ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
- worker nodes to. When omitted on create, the default subnet for the VPC is used.
- This value cannot be changed after the cluster is created. ``vpc_uuid`` must
- also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
}
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
- ],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 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 post_spans_search(
+ self,
+ region: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: 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:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 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 post_spans_search(
+ self, region: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: 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 = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
},
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ }
+ },
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
}
}
+ # response body for status code(s): 400, 403, 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:
+ _json = body
+
+ _request = build_insights_post_spans_search_request(
+ region=region,
+ 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, 400, 403, 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 == 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 == 403:
+ 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 SignalsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`signals` 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_consents(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Consent Records.
+
+ To list all signals consent records for your team, send a GET request to
+ ``/v1/consent``. Each record indicates whether signals collection is enabled
+ for a specific agent.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "consents": [
+ {
+ "agent_id": "str", # The unique identifier of the agent. For
+ Harness Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for
+ this agent. Required.
+ "id": 0, # The unique numeric identifier for the consent
+ record. Required.
+ "team_id": 0, # The team ID that owns this consent record.
+ Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in
+ ISO8601 combined date and time format. Required.
+ }
+ ]
+ }
+ """
+ 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_signals_list_consents_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
+
+ @distributed_trace_async
+ async def get_consent(self, agent_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Consent for an Agent.
+
+ To retrieve the consent record for a specific agent, send a GET
+ request to ``/v1/consent/{agent_id}``. The response includes an ``allowed``
+ field indicating whether the team is permitted to use signals for this agent.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "allowed": bool, # Whether the team is permitted to use signals for this
+ agent. This is determined by the platform and cannot be set by the user.
+ Required.
+ "enabled": bool, # Whether signals collection is enabled for this agent.
+ Required.
+ "id": 0, # The unique numeric identifier for the consent record. Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601 combined
+ date and time format. 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_signals_get_consent_request(
+ agent_id=agent_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 create_cluster(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ async def update_consent(
+ self,
+ agent_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Kubernetes Cluster.
+ """Update Consent for an Agent.
- To create a new Kubernetes cluster, send a POST request to
- ``/v2/kubernetes/clusters``. The request must contain at least one node pool
- with at least one worker.
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
- The request may contain a maintenance window policy describing a time period
- when disruptive maintenance tasks may be carried out. Omitting the policy
- implies that a window will be chosen automatically. See
- `here `_
- for details.
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_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".
+ :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 = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. 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 update_consent(
+ self,
+ agent_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -167255,274 +168107,6409 @@ async def create_cluster(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
- ],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
- ],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. 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 update_consent(
+ self, agent_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_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
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. 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 = 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_signals_update_consent_request(
+ agent_id=agent_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 [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_agent_sessions(
+ self,
+ agent_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Sessions for an Agent.
+
+ To list signals sessions for a specific agent, send a GET request to
+ ``/v1/signals/agents/{agent_id}/sessions``. Results are paginated using cursor-based
+ pagination with ``limit`` and ``after`` parameters.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "session_id": "str", # The unique identifier for the
+ session. Required.
+ "duration_seconds": 0.0, # Optional. The duration of
+ the session in seconds.
+ "signal_count": 0, # Optional. The number of signals
+ detected in this session.
+ "started_at": "2020-02-20 00:00:00", # Optional.
+ When the session started.
+ "total_turns": 0 # Optional. The total number of
+ conversation turns in this session.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # 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_signals_list_agent_sessions_request(
+ agent_id=agent_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_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 list_session_dialogues(
+ self,
+ session_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Dialogues for a Session.
+
+ To list the dialogue turns within a specific session, send a GET request to
+ ``/v1/signals/sessions/{session_id}/dialogues``. Each dialogue represents a
+ single turn of conversation between a user and the agent, along with
+ any signals detected. Results are paginated using cursor-based pagination.
+
+ :param session_id: A unique identifier for a signals session. Required.
+ :type session_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "id": "str", # The unique identifier for the
+ dialogue. Required.
+ "run_status": "str", # Optional. The execution
+ status of this dialogue turn.
+ "sequence": 0, # Optional. The sequence number of
+ this dialogue within the session.
+ "signals": [
+ "str" # Optional. A list of signal types
+ detected in this dialogue.
+ ],
+ "user_message": "str" # Optional. The user's message
+ in this dialogue turn.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # 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_signals_list_session_dialogues_request(
+ session_id=session_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_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 list_exports(
+ self, *, limit: int = 20, after: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Export Jobs.
+
+ To list signals export jobs for your team, send a GET request to
+ ``/v1/signals/exports``. Results are paginated using cursor-based pagination
+ with ``limit`` and ``after`` parameters.
+
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "agent_id": "str", # The agent whose data is being
+ exported. For Harness Runtime, this is the Environment Config ID.
+ Required.
+ "created_at": 0, # Unix timestamp when the export
+ was created. Required.
+ "export_id": "str", # The unique identifier for the
+ export job. Required.
+ "status": "str", # The current status of the export
+ job. Required. Known values are: "pending", "processing", "complete",
+ and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when
+ the export completed, or null if still in progress.
+ "error_message": "str", # Optional. Error message if
+ the export failed, or null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the
+ export download link expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session
+ IDs included in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types
+ included in the export.
+ ]
+ }
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ """
+ 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_signals_list_exports_request(
+ limit=limit,
+ after=after,
+ 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 create_export(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :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 = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 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_export(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :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 == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 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_export(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :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 = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 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,
+ 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_signals_create_export_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, 400, 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:
+ 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 == 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 == 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 get_export_options(self, **kwargs: Any) -> JSON:
+ """Get Export Options.
+
+ To retrieve the available filter options for creating an export, send a GET
+ request to ``/v1/signals/exports/options``. The response lists valid signal
+ types that can be used in the ``signal_type`` filter when creating an export.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "filters": {
+ "signal_type": [
+ "str" # The list of valid signal type values that can be
+ used when creating an export. Required.
+ ]
+ }
+ }
+ """
+ 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_signals_get_export_options_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
+
+ @distributed_trace_async
+ async def get_export(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Export Job.
+
+ To retrieve the status and details of a signals export job, send a GET
+ request to ``/v1/signals/exports/{export_id}``.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # 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_signals_get_export_request(
+ export_id=export_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 get_export_download(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Get Export Download URL.
+
+ To retrieve a pre-signed download URL for a completed export, send a GET
+ request to ``/v1/signals/exports/{export_id}/download``. The export must have
+ a ``complete`` status. The URL is temporary and will expire.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "download_url": "str", # A temporary pre-signed URL to download the export
+ archive. Required.
+ "expires_at": 0 # Unix timestamp when the download URL expires. The URL is
+ valid for 15 minutes. 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_signals_get_export_download_request(
+ export_id=export_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_deletions(
+ self, *, limit: int = 20, after: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Data Deletion Jobs.
+
+ To list signals data deletion jobs for your team, newest first, send a GET
+ request to ``/v1/signals/deletions``. Results are paginated using
+ cursor-based pagination with ``limit`` and ``after`` parameters.
+
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "created_at": 0, # Unix timestamp when the deletion
+ job was created. Required.
+ "deletion_id": "str", # The unique identifier for
+ the deletion job (ULID). Required.
+ "status": "str", # The current status of the
+ deletion job. Required. Known values are: "queued", "running",
+ "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job.
+ Required.
+ "type": "str", # The scope of the deletion.
+ ``agent`` deletes data for one agent. ``inference`` deletes data for
+ the team's Serverless Inference requests. Required. Known values are:
+ "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data
+ is being deleted. For Harness Runtime, this is the Environment Config
+ ID. Only present for ``agent`` deletions.
+ "completed_at": 0, # Optional. Unix timestamp when
+ the deletion finished, or null if still in progress.
+ "error_message": "str", # Optional. Error message if
+ the deletion failed, or null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when
+ processing started, or null if still queued.
+ }
+ }
+ ],
+ "page_info": {
+ "end_cursor": "str", # Optional. Cursor of the last item. Pass as
+ ``after`` to fetch the next page. Present only when there are more results.
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # response body for status code(s): 400
+ 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_signals_list_deletions_request(
+ limit=limit,
+ after=after,
+ 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, 400]:
+ 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 == 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 cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ async def create_deletion(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Data Deletion Job.
+
+ To permanently delete signals data, send a POST request to
+ ``/v1/signals/deletions``.
+
+ Two deletion types are supported:
+
+
+ * ``agent`` — deletes sessions, dialogues, and signal reports for one agent.
+ Requires ``agent_id``. The agent's data is hidden immediately and signals
+ collection is disabled for the agent, even if the job later fails. Wait
+ until the job is complete before enabling signals for the agent again.
+ * ``inference`` — deletes sessions, dialogues, and signal reports for the
+ team's Serverless Inference requests made before the deletion. Signals
+ continues to analyze new requests.
+
+ Deletion is permanent and cannot be undone. The job runs asynchronously;
+ poll the get endpoint to check status. To retry a failed job, send the same
+ request again. Export files created earlier are not deleted and remain
+ available until they expire.
+
+ The endpoint is idempotent: if a queued or running job already exists for
+ the same target, it is returned with ``200 OK``. A new job returns
+ ``202 Accepted``. Each team can have a limited number of active jobs;
+ requests beyond that limit return ``429 Too Many Requests``.
+
+ :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 = {
+ "team_id": 0, # The team whose data should be deleted. Must match the
+ authenticated team. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent and requires ``agent_id``. ``inference`` deletes data for the team's
+ Serverless Inference requests. Required. Known values are: "agent" and
+ "inference".
+ "agent_id": "str" # Optional. The agent whose data should be deleted. For
+ Harness Runtime, this is the Environment Config ID. Required when ``type`` is
+ ``agent``"" ; must be omitted when ``type`` is ``inference``.
+ }
+
+ # response body for status code(s): 200, 202
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # response body for status code(s): 400, 403, 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_deletion(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Data Deletion Job.
+
+ To permanently delete signals data, send a POST request to
+ ``/v1/signals/deletions``.
+
+ Two deletion types are supported:
+
+
+ * ``agent`` — deletes sessions, dialogues, and signal reports for one agent.
+ Requires ``agent_id``. The agent's data is hidden immediately and signals
+ collection is disabled for the agent, even if the job later fails. Wait
+ until the job is complete before enabling signals for the agent again.
+ * ``inference`` — deletes sessions, dialogues, and signal reports for the
+ team's Serverless Inference requests made before the deletion. Signals
+ continues to analyze new requests.
+
+ Deletion is permanent and cannot be undone. The job runs asynchronously;
+ poll the get endpoint to check status. To retry a failed job, send the same
+ request again. Export files created earlier are not deleted and remain
+ available until they expire.
+
+ The endpoint is idempotent: if a queued or running job already exists for
+ the same target, it is returned with ``200 OK``. A new job returns
+ ``202 Accepted``. Each team can have a limited number of active jobs;
+ requests beyond that limit return ``429 Too Many Requests``.
+
+ :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): 200, 202
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # response body for status code(s): 400, 403, 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_deletion(
+ self, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Data Deletion Job.
+
+ To permanently delete signals data, send a POST request to
+ ``/v1/signals/deletions``.
+
+ Two deletion types are supported:
+
+
+ * ``agent`` — deletes sessions, dialogues, and signal reports for one agent.
+ Requires ``agent_id``. The agent's data is hidden immediately and signals
+ collection is disabled for the agent, even if the job later fails. Wait
+ until the job is complete before enabling signals for the agent again.
+ * ``inference`` — deletes sessions, dialogues, and signal reports for the
+ team's Serverless Inference requests made before the deletion. Signals
+ continues to analyze new requests.
+
+ Deletion is permanent and cannot be undone. The job runs asynchronously;
+ poll the get endpoint to check status. To retry a failed job, send the same
+ request again. Export files created earlier are not deleted and remain
+ available until they expire.
+
+ The endpoint is idempotent: if a queued or running job already exists for
+ the same target, it is returned with ``200 OK``. A new job returns
+ ``202 Accepted``. Each team can have a limited number of active jobs;
+ requests beyond that limit return ``429 Too Many Requests``.
+
+ :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 = {
+ "team_id": 0, # The team whose data should be deleted. Must match the
+ authenticated team. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent and requires ``agent_id``. ``inference`` deletes data for the team's
+ Serverless Inference requests. Required. Known values are: "agent" and
+ "inference".
+ "agent_id": "str" # Optional. The agent whose data should be deleted. For
+ Harness Runtime, this is the Environment Config ID. Required when ``type`` is
+ ``agent``"" ; must be omitted when ``type`` is ``inference``.
+ }
+
+ # response body for status code(s): 200, 202
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # response body for status code(s): 400, 403, 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:
+ _json = body
+
+ _request = build_signals_create_deletion_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, 202, 400, 403, 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 == 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 == 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 == 403:
+ 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_deletion(self, deletion_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve a Data Deletion Job.
+
+ To retrieve the status of a signals data deletion job, send a GET request
+ to ``/v1/signals/deletions/{deletion_id}``.
+
+ :param deletion_id: A unique identifier for a data deletion job. Required.
+ :type deletion_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # 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_signals_get_deletion_request(
+ deletion_id=deletion_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
+
+
+class KubernetesOperations: # pylint: disable=too-many-public-methods
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`kubernetes` 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_clusters(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Kubernetes Clusters.
+
+ To list all of the Kubernetes clusters on your account, send a GET request
+ to ``/v2/kubernetes/clusters``.
+
+ :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.
+ },
+ "kubernetes_clusters": [
+ {
+ "name": "str", # A human-readable name for a Kubernetes
+ cluster. Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean
+ value indicating whether auto-scaling is enabled for this node
+ pool.
+ "count": 0, # Optional. The number of
+ Droplet instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The
+ AMD GPU partition mode for this node pool. Only applicable to AMD
+ GPU sizes that support partitioning. Immutable after the node
+ pool is created. When omitted, the GPUs in the pool are left
+ unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1"
+ and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that
+ can be used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of
+ key/value mappings specifying labels to apply to all nodes in a
+ pool. Labels will automatically be applied to all existing nodes
+ and any subsequent nodes added to the pool. Note that when a
+ label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum
+ number of nodes that this node pool can be auto-scaled to. The
+ value will be ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum
+ number of nodes that this node pool can be auto-scaled to. The
+ value will be ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable
+ name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20
+ 00:00:00", # Optional. A time value given in ISO8601
+ combined date and time format that represents when the
+ node was created.
+ "droplet_id": "str", #
+ Optional. The ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A
+ unique ID that can be used to identify and reference the
+ node.
+ "name": "str", # Optional.
+ An automatically generated, human-readable name for the
+ node.
+ "status": {
+ "state": "str" #
+ Optional. A string indicating the current status of
+ the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20
+ 00:00:00" # Optional. A time value given in ISO8601
+ combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug
+ identifier for the type of Droplet used as workers in the node
+ pool.
+ "tags": [
+ "str" # Optional. An array
+ containing the tags applied to the node pool. All node pools
+ are automatically tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional.
+ How the node reacts to pods that it won't tolerate.
+ Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values
+ are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if
+ the value of the ``key`` field is "special" and the value
+ of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional.
+ An arbitrary string. The ``key`` and ``value`` fields of
+ the ``taint`` object form a key-value pair. For example,
+ if the value of the ``key`` field is "special" and the
+ value of the ``value`` field is "gpu", the key value pair
+ would be ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where
+ the Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"),
+ the latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available
+ versions. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ AMD Device Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ AMD GPU Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the
+ AMD GPU DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether the cluster will be automatically
+ upgraded to new patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used
+ by cluster-autoscaler. The autoscaler will apply each expander
+ from the provided list to narrow down the selection of node types
+ created to scale up, until either a single node type is left, or
+ the list of expanders is exhausted. If this flag is unset,
+ autoscaler will use its default expander ``random``. Passing an
+ empty list ("" *not* ``null``"" ) will unset any previous
+ expander customizations. Available expanders: * ``random``"" :
+ Randomly selects a node group to scale. * `priority`: Selects the
+ node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in
+ the least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used
+ to customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional.
+ Used to customize when cluster autoscaler scales down non-empty nodes
+ by setting the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP
+ addresses for the overlay network of the Kubernetes cluster in CIDR
+ notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public
+ addresses (IPv4 or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the
+ control plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the
+ CoreDNS Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the Kubernetes cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API
+ server on the Kubernetes master node.
+ "ha": False, # Optional. Default value is False. A boolean
+ value indicating whether the control plane is run in a highly available
+ configuration in the cluster. Highly available control planes incur less
+ downtime. The property cannot be disabled. When omitted on create, the
+ default is version-dependent; for DOKS 1.36.0 and later, the default is
+ true; for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the
+ Kubernetes master node. This will not be set if high availability is
+ configured on the cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is
+ False. A boolean value indicating whether worker nodes in the cluster are
+ not assigned public IP addresses. When omitted on create, the default
+ value is false. When enabled, a NAT gateway must exist in the VPC where
+ the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance
+ window policy. May be one of ``monday`` through ``sunday``"" , or
+ ``any`` to indicate an arbitrary week day. Known values are: "any",
+ "monday", "tuesday", "wednesday", "thursday", "friday", "saturday",
+ and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in
+ UTC of the maintenance window policy in 24-hour clock format / HH:MM
+ notation (e.g., ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ NFS CSI plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Nvidia GPU Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the
+ NVIDIA GPU DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ RDMA shared device plugin is enabled.
+ },
+ "registries": [
+ "str" # Optional. An array of integrated DOCR
+ registries.
+ ],
+ "registry_enabled": bool, # Optional. A read-only boolean
+ value indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable
+ IP addresses for services running in the Kubernetes cluster in CIDR
+ notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is
+ False. Indicates whether SSO authentication is enabled for the
+ cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL
+ for the identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is
+ False. Indicates whether any non-SSO forms of authentication are
+ disallowed. Can only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message
+ providing additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the
+ current status of the cluster. Known values are: "running",
+ "provisioning", "degraded", "error", "deleted", "upgrading", and
+ "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False.
+ A boolean value indicating whether surge upgrade is enabled/disabled for
+ the cluster. Surge upgrade makes cluster upgrades fast and reliable by
+ bringing up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the Kubernetes cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID
+ of the VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC
+ subnet worker nodes are attached to. When unset, the default subnet for
+ the VPC is used.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ }
+ ],
+ "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_kubernetes_list_clusters_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
+
+ @overload
+ async def create_cluster(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Kubernetes Cluster.
+
+ To create a new Kubernetes cluster, send a POST request to
+ ``/v2/kubernetes/clusters``. The request must contain at least one node pool
+ with at least one worker.
+
+ The request may contain a maintenance window policy describing a time period
+ when disruptive maintenance tasks may be carried out. Omitting the policy
+ implies that a window will be chosen automatically. See
+ `here `_
+ for details.
+
+ :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 = {
+ "name": "str", # A human-readable name for a Kubernetes cluster. Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value indicating
+ whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in
+ the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes that
+ support partitioning. Immutable after the node pool is created. When
+ omitted, the GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings
+ specifying labels to apply to all nodes in a pool. Labels will
+ automatically be applied to all existing nodes and any subsequent nodes
+ added to the pool. Note that when a label is removed, it is not deleted
+ from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for the
+ node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of
+ the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that
+ can be used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type
+ of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags
+ applied to the node pool. All node pools are automatically tagged
+ ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node
+ reacts to pods that it won't tolerate. Available effect values
+ are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the Kubernetes
+ cluster is located. Required.
+ "version": "str", # The slug identifier for the version of Kubernetes used
+ for the cluster. If set to a minor version (e.g. "1.14"), the latest version
+ within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
+ published version will be used. See the ``/v2/kubernetes/options`` endpoint to
+ find all currently available versions. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for the
+ overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
+ node. This will not be set if high availability is configured on the cluster
+ (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A boolean
+ value indicating whether worker nodes in the cluster are not assigned public IP
+ addresses. When omitted on create, the default value is false. When enabled, a
+ NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value indicating
+ if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP addresses
+ for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current status of
+ the cluster. Known values are: "running", "provisioning", "degraded",
+ "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
+ ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
+ removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
+ which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
+ ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
+ worker nodes to. When omitted on create, the default subnet for the VPC is used.
+ This value cannot be changed after the cluster is created. ``vpc_uuid`` must
+ also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
+ scope.
+ }
+ }
+ """
+
+ @overload
+ async def create_cluster(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Kubernetes Cluster.
+
+ To create a new Kubernetes cluster, send a POST request to
+ ``/v2/kubernetes/clusters``. The request must contain at least one node pool
+ with at least one worker.
+
+ The request may contain a maintenance window policy describing a time period
+ when disruptive maintenance tasks may be carried out. Omitting the policy
+ implies that a window will be chosen automatically. See
+ `here `_
+ for details.
+
+ :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 == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
+ scope.
+ }
+ }
+ """
+
+ @distributed_trace_async
+ async def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Kubernetes Cluster.
+
+ To create a new Kubernetes cluster, send a POST request to
+ ``/v2/kubernetes/clusters``. The request must contain at least one node pool
+ with at least one worker.
+
+ The request may contain a maintenance window policy describing a time period
+ when disruptive maintenance tasks may be carried out. Omitting the policy
+ implies that a window will be chosen automatically. See
+ `here `_
+ for details.
+
+ :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 human-readable name for a Kubernetes cluster. Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value indicating
+ whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in
+ the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes that
+ support partitioning. Immutable after the node pool is created. When
+ omitted, the GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings
+ specifying labels to apply to all nodes in a pool. Labels will
+ automatically be applied to all existing nodes and any subsequent nodes
+ added to the pool. Note that when a label is removed, it is not deleted
+ from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for the
+ node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of
+ the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that
+ can be used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type
+ of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags
+ applied to the node pool. All node pools are automatically tagged
+ ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node
+ reacts to pods that it won't tolerate. Available effect values
+ are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the Kubernetes
+ cluster is located. Required.
+ "version": "str", # The slug identifier for the version of Kubernetes used
+ for the cluster. If set to a minor version (e.g. "1.14"), the latest version
+ within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
+ published version will be used. See the ``/v2/kubernetes/options`` endpoint to
+ find all currently available versions. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for the
+ overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
+ node. This will not be set if high availability is configured on the cluster
+ (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A boolean
+ value indicating whether worker nodes in the cluster are not assigned public IP
+ addresses. When omitted on create, the default value is false. When enabled, a
+ NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value indicating
+ if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP addresses
+ for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current status of
+ the cluster. Known values are: "running", "provisioning", "degraded",
+ "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
+ ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
+ removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
+ which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
+ ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
+ worker nodes to. When omitted on create, the default subnet for the VPC is used.
+ This value cannot be changed after the cluster is created. ``vpc_uuid`` must
+ also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
+ scope.
+ }
+ }
+ """
+ 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_kubernetes_create_cluster_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 get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Existing Kubernetes Cluster.
+
+ To show information about an existing Kubernetes cluster, send a GET request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": False, # Optional. Default value is False. A boolean value
+ indicating whether the control plane is run in a highly available
+ configuration in the cluster. Highly available control planes incur less
+ downtime. The property cannot be disabled. When omitted on create, the
+ default is version-dependent; for DOKS 1.36.0 and later, the default is true;
+ for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registries": [
+ "str" # Optional. An array of integrated DOCR registries.
+ ],
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ worker nodes are attached to. When unset, the default subnet for the VPC is
+ used.:code:`
`: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_kubernetes_get_cluster_request(
+ cluster_id=cluster_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 update_cluster(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Kubernetes Cluster.
+
+ To update a Kubernetes cluster, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
+ attributes below.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "name": "str", # A human-readable name for a Kubernetes cluster. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`: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.
+ }
+ """
+
+ @overload
+ async def update_cluster(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Kubernetes Cluster.
+
+ To update a Kubernetes cluster, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
+ attributes below.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`: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.
+ }
+ """
+
+ @distributed_trace_async
+ async def update_cluster(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Kubernetes Cluster.
+
+ To update a Kubernetes cluster, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
+ attributes below.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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
+ :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 human-readable name for a Kubernetes cluster. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`: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 = 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_kubernetes_update_cluster_request(
+ cluster_id=cluster_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)
+
+ 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.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_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete a Kubernetes Cluster.
+
+ To delete a Kubernetes cluster and all services deployed to it, send a DELETE
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+
+ A 204 status code with no body will be returned in response to a successful
+ request.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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): 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_kubernetes_delete_cluster_request(
+ cluster_id=cluster_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 [204, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 204:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def list_associated_resources(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List Associated Resources for Cluster Deletion.
+
+ To list the associated billable resources that can be destroyed along with a cluster, send a
+ GET request to the
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources`` endpoint.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "load_balancers": [
+ {
+ "id": "str", # Optional. The ID of a resource associated
+ with a Kubernetes cluster.
+ "name": "str" # Optional. The name of a resource associated
+ with a Kubernetes cluster.
+ }
+ ],
+ "volume_snapshots": [
+ {
+ "id": "str", # Optional. The ID of a resource associated
+ with a Kubernetes cluster.
+ "name": "str" # Optional. The name of a resource associated
+ with a Kubernetes cluster.
+ }
+ ],
+ "volumes": [
+ {
+ "id": "str", # Optional. The ID of a resource associated
+ with a Kubernetes cluster.
+ "name": "str" # Optional. The name of a resource associated
+ with a Kubernetes cluster.
+ }
+ ]
+ }
+ # 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_kubernetes_list_associated_resources_request(
+ cluster_id=cluster_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_associated_resources_selective(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Delete a Cluster and its Associated Resources.
+
+ To delete a Kubernetes cluster along with a subset of its associated resources,
+ send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
+
+ The JSON body of the request should include ``load_balancers``\\ , ``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 cluster's associated resources endpoint.
+ Any associated resource not included in the request will remain and continue
+ to accrue changes on your account.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "load_balancers": [
+ "str" # Optional. A list of IDs for associated load balancers to
+ destroy along with the cluster.
+ ],
+ "volume_snapshots": [
+ "str" # Optional. A list of IDs for associated volume snapshots to
+ destroy along with the cluster.
+ ],
+ "volumes": [
+ "str" # Optional. A list of IDs for associated volumes to destroy
+ along with the cluster.
+ ]
+ }
+
+ # 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_associated_resources_selective(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Delete a Cluster and its Associated Resources.
+
+ To delete a Kubernetes cluster along with a subset of its associated resources,
+ send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
+
+ The JSON body of the request should include ``load_balancers``\\ , ``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 cluster's associated resources endpoint.
+ Any associated resource not included in the request will remain and continue
+ to accrue changes on your account.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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_associated_resources_selective(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Delete a Cluster and its Associated Resources.
+
+ To delete a Kubernetes cluster along with a subset of its associated resources,
+ send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
+
+ The JSON body of the request should include ``load_balancers``\\ , ``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 cluster's associated resources endpoint.
+ Any associated resource not included in the request will remain and continue
+ to accrue changes on your account.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :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 = {
+ "load_balancers": [
+ "str" # Optional. A list of IDs for associated load balancers to
+ destroy along with the cluster.
+ ],
+ "volume_snapshots": [
+ "str" # Optional. A list of IDs for associated volume snapshots to
+ destroy along with the cluster.
+ ],
+ "volumes": [
+ "str" # Optional. A list of IDs for associated volumes to destroy
+ along with the cluster.
+ ]
+ }
+
+ # 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:
+ _json = body
+
+ _request = build_kubernetes_destroy_associated_resources_selective_request(
+ cluster_id=cluster_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 [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 destroy_associated_resources_dangerous(
+ self, cluster_id: str, **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete a Cluster and All of its Associated Resources (Dangerous).
+
+ To delete a Kubernetes cluster with all of its associated resources, send a
+ DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/dangerous``.
+ A 204 status code with no body will be returned in response to a successful request.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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): 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_kubernetes_destroy_associated_resources_dangerous_request(
+ cluster_id=cluster_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 [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 get_kubeconfig(
+ self,
+ cluster_id: str,
+ *,
+ expiry_seconds: int = 0,
+ type: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Retrieve the kubeconfig for a Kubernetes Cluster.
+
+ This endpoint returns a kubeconfig file in YAML format. It can be used to
+ connect to and administer the cluster using the Kubernetes command line tool,
+ ``kubectl``\\ , or other programs supporting kubeconfig files (e.g., client libraries).
+
+ The resulting kubeconfig file uses token-based authentication for clusters
+ supporting it, and certificate-based authentication otherwise. For a list of
+ supported versions and more information, see "\\ `How to Connect to a DigitalOcean
+ Kubernetes Cluster
+ `_\\ ".
+
+ To retrieve a kubeconfig file for use with a Kubernetes cluster, send a GET
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig``.
+
+ Clusters supporting token-based authentication may define an expiration by
+ passing a duration in seconds as a query parameter to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig?expiry_seconds=$DURATION_IN_SECONDS``.
+ If not set or 0, then the token will have a 7 day expiry. The query parameter
+ has no impact for other kubeconfig types.
+
+ Using an ``sso`` kubeconfig type requires ``doctl`` to be installed to handle the client side
+ of the OAuth2 flow.
+
+ Kubernetes Roles granted to a user are derived from that user's
+ DigitalOcean role. Predefined roles (Owner, Member, Modifier etc.) have an automatic mapping
+ to Kubernetes roles. Custom roles are not automatically mapped to any Kubernetes roles,
+ and require `additional configuration
+ `_
+ by a cluster administrator.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
+ be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
+ :paramtype expiry_seconds: int
+ :keyword type: The type of credentials to return in the kubeconfig. When omitted, the
+ default credential type for the cluster is used: ``sso`` for clusters with SSO enabled,
+ ``token`` for clusters without SSO enabled. Known values are: "token" and "sso". Default value
+ is None.
+ :paramtype 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.
+ }
+ """
+ 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_kubernetes_get_kubeconfig_request(
+ cluster_id=cluster_id,
+ expiry_seconds=expiry_seconds,
+ 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)
+
+ deserialized = None
+ 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.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_credentials(
+ self, cluster_id: str, *, expiry_seconds: int = 0, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Credentials for a Kubernetes Cluster.
+
+ This endpoint returns a JSON object . It can be used to programmatically
+ construct Kubernetes clients which cannot parse kubeconfig files.
+
+ The resulting JSON object contains token-based authentication for clusters
+ supporting it, and certificate-based authentication otherwise. For a list of
+ supported versions and more information, see "\\ `How to Connect to a DigitalOcean
+ Kubernetes Cluster
+ `_\\ ".
+
+ To retrieve credentials for accessing a Kubernetes cluster, send a GET
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials``.
+
+ Clusters supporting token-based authentication may define an expiration by
+ passing a duration in seconds as a query parameter to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials?expiry_seconds=$DURATION_IN_SECONDS``.
+ If not set or 0, then the token will have a 7 day expiry. The query parameter
+ has no impact in certificate-based authentication.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
+ be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
+ :paramtype expiry_seconds: int
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "certificate_authority_data": bytes("bytes", encoding="utf-8"), # Optional.
+ A base64 encoding of bytes representing the certificate authority data for
+ accessing the cluster.
+ "client_certificate_data": bytes("bytes", encoding="utf-8"), # Optional. A
+ base64 encoding of bytes representing the x509 client certificate data for access
+ the cluster. This is only returned for clusters without support for token-based
+ authentication. Newly created Kubernetes clusters do not return credentials
+ using certificate-based authentication. For additional information, `see here
+ `_.
+ "client_key_data": bytes("bytes", encoding="utf-8"), # Optional. A base64
+ encoding of bytes representing the x509 client key data for access the cluster.
+ This is only returned for clusters without support for token-based
+ authentication. Newly created Kubernetes clusters do not return credentials
+ using certificate-based authentication. For additional information, `see here
+ `_.
+ "expires_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the access token
+ expires.
+ "server": "str", # Optional. The URL used to access the cluster API server.
+ "token": "str" # Optional. An access token used to authenticate with the
+ cluster. This is only returned for clusters with support for token-based
+ authentication.
+ }
+ # 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_kubernetes_get_credentials_request(
+ cluster_id=cluster_id,
+ expiry_seconds=expiry_seconds,
+ 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 get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Available Upgrades for an Existing Kubernetes Cluster.
+
+ To determine whether a cluster can be upgraded, and the versions to which it
+ can be upgraded, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "available_upgrade_versions": [
+ {
+ "kubernetes_version": "str", # Optional. The upstream
+ version string for the version of Kubernetes provided by a given slug.
+ "slug": "str", # Optional. The slug identifier for an
+ available version of Kubernetes for use when creating or updating a
+ cluster. The string contains both the upstream version of Kubernetes as
+ well as the DigitalOcean revision.
+ "supported_features": [
+ "str" # Optional. The features available with the
+ version of Kubernetes provided by a given slug.
+ ]
+ }
+ ]
+ }
+ # 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_kubernetes_get_available_upgrades_request(
+ cluster_id=cluster_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 upgrade_cluster(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Upgrade a Kubernetes Cluster.
+
+ To immediately upgrade a Kubernetes cluster to a newer patch release of
+ Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
+ The body of the request must specify a version attribute.
+
+ Available upgrade versions for a cluster can be fetched from
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "version": "str" # Optional. The slug identifier for the version of
+ Kubernetes that the cluster will be upgraded to.
+ }
+
+ # 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 upgrade_cluster(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Upgrade a Kubernetes Cluster.
+
+ To immediately upgrade a Kubernetes cluster to a newer patch release of
+ Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
+ The body of the request must specify a version attribute.
+
+ Available upgrade versions for a cluster can be fetched from
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ async def upgrade_cluster(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a New Kubernetes Cluster.
+ """Upgrade a Kubernetes Cluster.
- To create a new Kubernetes cluster, send a POST request to
- ``/v2/kubernetes/clusters``. The request must contain at least one node pool
- with at least one worker.
+ To immediately upgrade a Kubernetes cluster to a newer patch release of
+ Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
+ The body of the request must specify a version attribute.
- The request may contain a maintenance window policy describing a time period
- when disruptive maintenance tasks may be carried out. Omitting the policy
- implies that a window will be chosen automatically. See
- `here `_
- for details.
+ Available upgrade versions for a cluster can be fetched from
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -167530,7 +174517,129 @@ async def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A human-readable name for a Kubernetes cluster. Required.
+ "version": "str" # Optional. The slug identifier for the version of
+ Kubernetes that the cluster will be upgraded to.
+ }
+
+ # 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:
+ _json = body
+
+ _request = build_kubernetes_upgrade_cluster_request(
+ cluster_id=cluster_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 list_node_pools(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Node Pools in a Kubernetes Clusters.
+
+ To list all of the node pools in a Kubernetes clusters, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
"node_pools": [
{
"auto_scale": bool, # Optional. A boolean value indicating
@@ -167606,410 +174715,583 @@ async def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J
}
]
}
- ],
- "region": "str", # The slug identifier for the region where the Kubernetes
- cluster is located. Required.
- "version": "str", # The slug identifier for the version of Kubernetes used
- for the cluster. If set to a minor version (e.g. "1.14"), the latest version
- within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
- published version will be used. See the ``/v2/kubernetes/options`` endpoint to
- find all currently available versions. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for the
- overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
+ ]
+ }
+ # 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_kubernetes_list_node_pools_request(
+ cluster_id=cluster_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 add_node_pool(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Add a Node Pool to a Kubernetes Cluster.
+
+ To add an additional node pool to a Kubernetes clusters, send a POST request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
+ attributes.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
+ node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
+ after the node pool is created. When omitted, the GPUs in the pool are left
+ unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
"id": "str", # Optional. A unique ID that can be used to identify and
- reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
- node. This will not be set if high availability is configured on the cluster
- (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A boolean
- value indicating whether worker nodes in the cluster are not assigned public IP
- addresses. When omitted on create, the default value is false. When enabled, a
- NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value indicating
- if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP addresses
- for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current status of
- the cluster. Known values are: "running", "provisioning", "degraded",
- "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of Droplet used
+ as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
- ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
- removed.
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
- which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
- ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
- worker nodes to. When omitted on create, the default subnet for the VPC is used.
- This value cannot be changed after the cluster is created. ``vpc_uuid`` must
- also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
}
# response body for status code(s): 201
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
+ }
+ }
+ # 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 add_node_pool(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Add a Node Pool to a Kubernetes Cluster.
+
+ To add an additional node pool to a Kubernetes clusters, send a POST request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
+ attributes.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 == {
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
+ }
+ }
+ # 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 add_node_pool(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Add a Node Pool to a Kubernetes Cluster.
+
+ To add an additional node pool to a Kubernetes clusters, send a POST request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
+ attributes.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
+ node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
+ after the node pool is created. When omitted, the GPUs in the pool are left
+ unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of Droplet used
+ as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
"id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
+ # 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,
@@ -168040,7 +175322,8 @@ async def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J
else:
_json = body
- _request = build_kubernetes_create_cluster_request(
+ _request = build_kubernetes_add_node_pool_request(
+ cluster_id=cluster_id,
content_type=content_type,
json=_json,
content=_content,
@@ -168058,27 +175341,44 @@ async def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J
response = pipeline_response.http_response
- if response.status_code not in [201]:
+ 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 = {}
- 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 == 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.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
@@ -168086,15 +175386,20 @@ async def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
+ async def get_node_pool(
+ self, cluster_id: str, node_pool_id: str, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Kubernetes Cluster.
+ """Retrieve a Node Pool for a Kubernetes Cluster.
- To show information about an existing Kubernetes cluster, send a GET request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+ To show information about a specific node pool in a Kubernetes cluster, send
+ a GET request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -168104,249 +175409,76 @@ async def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": False, # Optional. Default value is False. A boolean value
- indicating whether the control plane is run in a highly available
- configuration in the cluster. Highly available control planes incur less
- downtime. The property cannot be disabled. When omitted on create, the
- default is version-dependent; for DOKS 1.36.0 and later, the default is true;
- for earlier versions, the default is false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registries": [
- "str" # Optional. An array of integrated DOCR registries.
- ],
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags applied to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- worker nodes are attached to. When unset, the default subnet for the VPC is
- used.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -168379,8 +175511,9 @@ async def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_cluster_request(
+ _request = build_kubernetes_get_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
headers=_headers,
params=_params,
)
@@ -168440,23 +175573,28 @@ async def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@overload
- async def update_cluster(
+ async def update_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Kubernetes Cluster.
+ """Update a Node Pool in a Kubernetes Cluster.
- To update a Kubernetes cluster, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
- attributes below.
+ To update the name of a node pool, edit the tags applied to it, or adjust its
+ number of nodes, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
+ following attributes.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -168471,362 +175609,141 @@ async def update_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A human-readable name for a Kubernetes cluster. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
"tags": [
- "str" # Optional. An array of tags applied to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``.
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
]
}
# response body for status code(s): 202
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -168843,23 +175760,28 @@ async def update_cluster(
"""
@overload
- async def update_cluster(
+ async def update_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Kubernetes Cluster.
+ """Update a Node Pool in a Kubernetes Cluster.
- To update a Kubernetes cluster, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
- attributes below.
+ To update the name of a node pool, edit the tags applied to it, or adjust its
+ number of nodes, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
+ following attributes.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -168874,249 +175796,76 @@ async def update_cluster(
# response body for status code(s): 202
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -169133,18 +175882,26 @@ async def update_cluster(
"""
@distributed_trace_async
- async def update_cluster(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ async def update_node_pool(
+ self,
+ cluster_id: str,
+ node_pool_id: str,
+ body: Union[JSON, IO[bytes]],
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Update a Kubernetes Cluster.
+ """Update a Node Pool in a Kubernetes Cluster.
- To update a Kubernetes cluster, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
- attributes below.
+ To update the name of a node pool, edit the tags applied to it, or adjust its
+ number of nodes, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
+ following attributes.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -169156,362 +175913,141 @@ async def update_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A human-readable name for a Kubernetes cluster. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
"tags": [
- "str" # Optional. An array of tags applied to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``.
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
]
}
# response body for status code(s): 202
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -169555,8 +176091,9 @@ async def update_cluster(
else:
_json = body
- _request = build_kubernetes_update_cluster_request(
+ _request = build_kubernetes_update_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
content_type=content_type,
json=_json,
content=_content,
@@ -169619,18 +176156,23 @@ async def update_cluster(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def delete_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]:
+ async def delete_node_pool(
+ self, cluster_id: str, node_pool_id: str, **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Delete a Kubernetes Cluster.
+ """Delete a Node Pool in a Kubernetes Cluster.
- To delete a Kubernetes cluster and all services deployed to it, send a DELETE
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+ To delete a node pool, send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
A 204 status code with no body will be returned in response to a successful
- request.
+ request. Nodes in the pool will subsequently be drained and deleted.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -169668,8 +176210,9 @@ async def delete_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_kubernetes_delete_cluster_request(
+ _request = build_kubernetes_delete_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
headers=_headers,
params=_params,
)
@@ -169725,50 +176268,53 @@ async def delete_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]
return deserialized # type: ignore
@distributed_trace_async
- async def list_associated_resources(self, cluster_id: str, **kwargs: Any) -> JSON:
+ async def delete_node(
+ self,
+ cluster_id: str,
+ node_pool_id: str,
+ node_id: str,
+ *,
+ skip_drain: int = 0,
+ replace: int = 0,
+ **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List Associated Resources for Cluster Deletion.
+ """Delete a Node in a Kubernetes Cluster.
- To list the associated billable resources that can be destroyed along with a cluster, send a
- GET request to the
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources`` endpoint.
+ To delete a single node in a pool, send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``.
+
+ Appending the ``skip_drain=1`` query parameter to the request causes node
+ draining to be skipped. Omitting the query parameter or setting its value to
+ ``0`` carries out draining prior to deletion.
+
+ Appending the ``replace=1`` query parameter to the request causes the node to
+ be replaced by a new one after deletion. Omitting the query parameter or
+ setting its value to ``0`` deletes without replacement.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
- :return: JSON object
- :rtype: JSON
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
+ :param node_id: A unique ID that can be used to reference a node in a Kubernetes node pool.
+ Required.
+ :type node_id: str
+ :keyword skip_drain: Specifies whether or not to drain workloads from a node before it is
+ deleted. Setting it to ``1`` causes node draining to be skipped. Omitting the query parameter
+ or setting its value to ``0`` carries out draining prior to deletion. Default value is 0.
+ :paramtype skip_drain: int
+ :keyword replace: Specifies whether or not to replace a node after it has been deleted. Setting
+ it to ``1`` causes the node to be replaced by a new one after deletion. Omitting the query
+ parameter or setting its value to ``0`` deletes without replacement. Default value is 0.
+ :paramtype replace: 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 == {
- "load_balancers": [
- {
- "id": "str", # Optional. The ID of a resource associated
- with a Kubernetes cluster.
- "name": "str" # Optional. The name of a resource associated
- with a Kubernetes cluster.
- }
- ],
- "volume_snapshots": [
- {
- "id": "str", # Optional. The ID of a resource associated
- with a Kubernetes cluster.
- "name": "str" # Optional. The name of a resource associated
- with a Kubernetes cluster.
- }
- ],
- "volumes": [
- {
- "id": "str", # Optional. The ID of a resource associated
- with a Kubernetes cluster.
- "name": "str" # Optional. The name of a resource associated
- with a Kubernetes cluster.
- }
- ]
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -169797,10 +176343,14 @@ async def list_associated_resources(self, cluster_id: 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_kubernetes_list_associated_resources_request(
+ _request = build_kubernetes_delete_node_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
+ node_id=node_id,
+ skip_drain=skip_drain,
+ replace=replace,
headers=_headers,
params=_params,
)
@@ -169815,14 +176365,15 @@ async def list_associated_resources(self, cluster_id: str, **kwargs: Any) -> JSO
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)
+ 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")
)
@@ -169833,11 +176384,6 @@ async def list_associated_resources(self, cluster_id: 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")
@@ -169855,36 +176401,32 @@ async def list_associated_resources(self, cluster_id: 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
@overload
- async def destroy_associated_resources_selective(
+ async def recycle_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Selectively Delete a Cluster and its Associated Resources.
-
- To delete a Kubernetes cluster along with a subset of its associated resources,
- send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
-
- The JSON body of the request should include ``load_balancers``\\ , ``volumes``\\ , or
- ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed.
+ """Recycle a Kubernetes Node Pool.
- The IDs can be found by querying the cluster's associated resources endpoint.
- Any associated resource not included in the request will remain and continue
- to accrue changes on your account.
+ The endpoint has been deprecated. Please use the DELETE
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
+ method instead.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -169899,17 +176441,8 @@ async def destroy_associated_resources_selective(
# JSON input template you can fill out and use as your body input.
body = {
- "load_balancers": [
- "str" # Optional. A list of IDs for associated load balancers to
- destroy along with the cluster.
- ],
- "volume_snapshots": [
- "str" # Optional. A list of IDs for associated volume snapshots to
- destroy along with the cluster.
- ],
- "volumes": [
- "str" # Optional. A list of IDs for associated volumes to destroy
- along with the cluster.
+ "nodes": [
+ "str" # Optional.
]
}
@@ -169927,31 +176460,27 @@ async def destroy_associated_resources_selective(
"""
@overload
- async def destroy_associated_resources_selective(
+ async def recycle_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Selectively Delete a Cluster and its Associated Resources.
-
- To delete a Kubernetes cluster along with a subset of its associated resources,
- send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
-
- The JSON body of the request should include ``load_balancers``\\ , ``volumes``\\ , or
- ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed.
+ """Recycle a Kubernetes Node Pool.
- The IDs can be found by querying the cluster's associated resources endpoint.
- Any associated resource not included in the request will remain and continue
- to accrue changes on your account.
+ The endpoint has been deprecated. Please use the DELETE
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
+ method instead.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -169978,26 +176507,25 @@ async def destroy_associated_resources_selective(
"""
@distributed_trace_async
- async def destroy_associated_resources_selective(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ async def recycle_node_pool(
+ self,
+ cluster_id: str,
+ node_pool_id: str,
+ body: Union[JSON, IO[bytes]],
+ **kwargs: Any
) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Selectively Delete a Cluster and its Associated Resources.
-
- To delete a Kubernetes cluster along with a subset of its associated resources,
- send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
-
- The JSON body of the request should include ``load_balancers``\\ , ``volumes``\\ , or
- ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed.
+ """Recycle a Kubernetes Node Pool.
- The IDs can be found by querying the cluster's associated resources endpoint.
- Any associated resource not included in the request will remain and continue
- to accrue changes on your account.
+ The endpoint has been deprecated. Please use the DELETE
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
+ method instead.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object or None
@@ -170006,20 +176534,11 @@ async def destroy_associated_resources_selective(
Example:
.. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "load_balancers": [
- "str" # Optional. A list of IDs for associated load balancers to
- destroy along with the cluster.
- ],
- "volume_snapshots": [
- "str" # Optional. A list of IDs for associated volume snapshots to
- destroy along with the cluster.
- ],
- "volumes": [
- "str" # Optional. A list of IDs for associated volumes to destroy
- along with the cluster.
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "nodes": [
+ "str" # Optional.
]
}
@@ -170064,8 +176583,9 @@ async def destroy_associated_resources_selective(
else:
_json = body
- _request = build_kubernetes_destroy_associated_resources_selective_request(
+ _request = build_kubernetes_recycle_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
content_type=content_type,
json=_json,
content=_content,
@@ -170083,7 +176603,7 @@ async def destroy_associated_resources_selective(
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
@@ -170091,7 +176611,7 @@ async def destroy_associated_resources_selective(
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")
)
@@ -170124,26 +176644,33 @@ async def destroy_associated_resources_selective(
return deserialized # type: ignore
@distributed_trace_async
- async def destroy_associated_resources_dangerous(
- self, cluster_id: str, **kwargs: Any
- ) -> Optional[JSON]:
+ async def get_cluster_user(self, cluster_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Cluster and All of its Associated Resources (Dangerous).
+ """Retrieve User Information for a Kubernetes Cluster.
- To delete a Kubernetes cluster with all of its associated resources, send a
- DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/dangerous``.
- A 204 status code with no body will be returned in response to a successful request.
+ To show information the user associated with a Kubernetes cluster, send a GET
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/user``.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: 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): 200
+ response == {
+ "kubernetes_cluster_user": {
+ "groups": [
+ "str" # Optional. A list of in-cluster groups that the user
+ belongs to.
+ ],
+ "username": "str" # Optional. The username for the cluster admin
+ user.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -170172,9 +176699,9 @@ async def destroy_associated_resources_dangerous(
_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_kubernetes_destroy_associated_resources_dangerous_request(
+ _request = build_kubernetes_get_cluster_user_request(
cluster_id=cluster_id,
headers=_headers,
params=_params,
@@ -170190,15 +176717,14 @@ async def destroy_associated_resources_dangerous(
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")
)
@@ -170209,6 +176735,11 @@ async def destroy_associated_resources_dangerous(
"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")
@@ -170226,68 +176757,61 @@ async def destroy_associated_resources_dangerous(
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_kubeconfig(
- self,
- cluster_id: str,
- *,
- expiry_seconds: int = 0,
- type: Optional[str] = None,
- **kwargs: Any
- ) -> Optional[JSON]:
+ async def list_options(self, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve the kubeconfig for a Kubernetes Cluster.
-
- This endpoint returns a kubeconfig file in YAML format. It can be used to
- connect to and administer the cluster using the Kubernetes command line tool,
- ``kubectl``\\ , or other programs supporting kubeconfig files (e.g., client libraries).
-
- The resulting kubeconfig file uses token-based authentication for clusters
- supporting it, and certificate-based authentication otherwise. For a list of
- supported versions and more information, see "\\ `How to Connect to a DigitalOcean
- Kubernetes Cluster
- `_\\ ".
-
- To retrieve a kubeconfig file for use with a Kubernetes cluster, send a GET
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig``.
-
- Clusters supporting token-based authentication may define an expiration by
- passing a duration in seconds as a query parameter to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig?expiry_seconds=$DURATION_IN_SECONDS``.
- If not set or 0, then the token will have a 7 day expiry. The query parameter
- has no impact for other kubeconfig types.
-
- Using an ``sso`` kubeconfig type requires ``doctl`` to be installed to handle the client side
- of the OAuth2 flow.
+ """List Available Regions, Node Sizes, and Versions of Kubernetes.
- Kubernetes Roles granted to a user are derived from that user's
- DigitalOcean role. Predefined roles (Owner, Member, Modifier etc.) have an automatic mapping
- to Kubernetes roles. Custom roles are not automatically mapped to any Kubernetes roles,
- and require `additional configuration
- `_
- by a cluster administrator.
+ To list the versions of Kubernetes available for use, the regions that support Kubernetes, and
+ the available node sizes, send a GET request to ``/v2/kubernetes/options``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
- be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
- :paramtype expiry_seconds: int
- :keyword type: The type of credentials to return in the kubeconfig. When omitted, the
- default credential type for the cluster is used: ``sso`` for clusters with SSO enabled,
- ``token`` for clusters without SSO enabled. Known values are: "token" and "sso". Default value
- is None.
- :paramtype 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): 200
+ response == {
+ "options": {
+ "regions": [
+ {
+ "name": "str", # Optional. A DigitalOcean region
+ where Kubernetes is available.
+ "slug": "str" # Optional. The identifier for a
+ region for use when creating a new cluster.
+ }
+ ],
+ "sizes": [
+ {
+ "name": "str", # Optional. A Droplet size available
+ for use in a Kubernetes node pool.
+ "slug": "str" # Optional. The identifier for a size
+ for use when creating a new cluster.
+ }
+ ],
+ "versions": [
+ {
+ "kubernetes_version": "str", # Optional. The
+ upstream version string for the version of Kubernetes provided by a
+ given slug.
+ "slug": "str", # Optional. The slug identifier for
+ an available version of Kubernetes for use when creating or updating
+ a cluster. The string contains both the upstream version of
+ Kubernetes as well as the DigitalOcean revision.
+ "supported_features": [
+ "str" # Optional. The features available
+ with the version of Kubernetes provided by a given slug.
+ ]
+ }
+ ]
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -170316,12 +176840,9 @@ async def get_kubeconfig(
_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_kubernetes_get_kubeconfig_request(
- cluster_id=cluster_id,
- expiry_seconds=expiry_seconds,
- type=type,
+ _request = build_kubernetes_list_options_request(
headers=_headers,
params=_params,
)
@@ -170342,7 +176863,6 @@ async def get_kubeconfig(
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:
response_headers["ratelimit-limit"] = self._deserialize(
@@ -170355,6 +176875,11 @@ async def get_kubeconfig(
"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")
@@ -170372,40 +176897,119 @@ async def get_kubeconfig(
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_credentials(
- self, cluster_id: str, *, expiry_seconds: int = 0, **kwargs: Any
+ @overload
+ async def run_cluster_lint(
+ self,
+ cluster_id: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Retrieve Credentials for a Kubernetes Cluster.
+ """Run Clusterlint Checks on a Kubernetes Cluster.
- This endpoint returns a JSON object . It can be used to programmatically
- construct Kubernetes clients which cannot parse kubeconfig files.
+ Clusterlint helps operators conform to Kubernetes best practices around
+ resources, security and reliability to avoid common problems while operating
+ or upgrading the clusters.
- The resulting JSON object contains token-based authentication for clusters
- supporting it, and certificate-based authentication otherwise. For a list of
- supported versions and more information, see "\\ `How to Connect to a DigitalOcean
- Kubernetes Cluster
- `_\\ ".
+ To request a clusterlint run on your cluster, send a POST request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
+ checks present in the ``doks`` group by default, if a request body is not
+ specified. Optionally specify the below attributes.
- To retrieve credentials for accessing a Kubernetes cluster, send a GET
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials``.
+ For information about the available checks, please refer to
+ `the clusterlint check documentation
+ `_.
- Clusters supporting token-based authentication may define an expiration by
- passing a duration in seconds as a query parameter to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials?expiry_seconds=$DURATION_IN_SECONDS``.
- If not set or 0, then the token will have a 7 day expiry. The query parameter
- has no impact in certificate-based authentication.
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: 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 = {
+ "exclude_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "exclude_groups": [
+ "str" # Optional. An array of check groups that will be omitted when
+ clusterlint executes checks.
+ ],
+ "include_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "include_groups": [
+ "str" # Optional. An array of check groups that will be run when
+ clusterlint executes checks.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "run_id": "str" # Optional. ID of the clusterlint run that can be used later
+ to fetch the diagnostics.
+ }
+ # 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_cluster_lint(
+ self,
+ cluster_id: str,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Run Clusterlint Checks on a Kubernetes Cluster.
+
+ Clusterlint helps operators conform to Kubernetes best practices around
+ resources, security and reliability to avoid common problems while operating
+ or upgrading the clusters.
+
+ To request a clusterlint run on your cluster, send a POST request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
+ checks present in the ``doks`` group by default, if a request body is not
+ specified. Optionally specify the below attributes.
+
+ For information about the available checks, please refer to
+ `the clusterlint check documentation
+ `_.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
- :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
- be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
- :paramtype expiry_seconds: 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:
@@ -170413,30 +177017,82 @@ async def get_credentials(
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "certificate_authority_data": bytes("bytes", encoding="utf-8"), # Optional.
- A base64 encoding of bytes representing the certificate authority data for
- accessing the cluster.
- "client_certificate_data": bytes("bytes", encoding="utf-8"), # Optional. A
- base64 encoding of bytes representing the x509 client certificate data for access
- the cluster. This is only returned for clusters without support for token-based
- authentication. Newly created Kubernetes clusters do not return credentials
- using certificate-based authentication. For additional information, `see here
- `_.
- "client_key_data": bytes("bytes", encoding="utf-8"), # Optional. A base64
- encoding of bytes representing the x509 client key data for access the cluster.
- This is only returned for clusters without support for token-based
- authentication. Newly created Kubernetes clusters do not return credentials
- using certificate-based authentication. For additional information, `see here
- `_.
- "expires_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the access token
- expires.
- "server": "str", # Optional. The URL used to access the cluster API server.
- "token": "str" # Optional. An access token used to authenticate with the
- cluster. This is only returned for clusters with support for token-based
- authentication.
+ "run_id": "str" # Optional. ID of the clusterlint run that can be used later
+ to fetch the diagnostics.
+ }
+ # 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_cluster_lint(
+ self,
+ cluster_id: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Run Clusterlint Checks on a Kubernetes Cluster.
+
+ Clusterlint helps operators conform to Kubernetes best practices around
+ resources, security and reliability to avoid common problems while operating
+ or upgrading the clusters.
+
+ To request a clusterlint run on your cluster, send a POST request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
+ checks present in the ``doks`` group by default, if a request body is not
+ specified. Optionally specify the below attributes.
+
+ For information about the available checks, please refer to
+ `the clusterlint check documentation
+ `_.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: 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 = {
+ "exclude_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "exclude_groups": [
+ "str" # Optional. An array of check groups that will be omitted when
+ clusterlint executes checks.
+ ],
+ "include_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "include_groups": [
+ "str" # Optional. An array of check groups that will be run when
+ clusterlint executes checks.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "run_id": "str" # Optional. ID of the clusterlint run that can be used later
+ to fetch the diagnostics.
}
# response body for status code(s): 404
response == {
@@ -170463,14 +177119,30 @@ async def get_credentials(
}
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_kubernetes_get_credentials_request(
+ 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_kubernetes_run_cluster_lint_request(
cluster_id=cluster_id,
- expiry_seconds=expiry_seconds,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -170485,14 +177157,14 @@ async def get_credentials(
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")
)
@@ -170530,16 +177202,26 @@ async def get_credentials(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
+ async def get_cluster_lint_results(
+ self, cluster_id: str, *, run_id: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve Available Upgrades for an Existing Kubernetes Cluster.
+ """Fetch Clusterlint Diagnostics for a Kubernetes Cluster.
- To determine whether a cluster can be upgraded, and the versions to which it
- can be upgraded, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ To request clusterlint diagnostics for your cluster, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. If the ``run_id`` query
+ parameter is provided, then the diagnostics for the specific run is fetched.
+ By default, the latest results are shown.
+
+ To find out how to address clusterlint feedback, please refer to
+ `the clusterlint check documentation
+ `_.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :keyword run_id: Specifies the clusterlint run whose results will be retrieved. Default value
+ is None.
+ :paramtype run_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -170549,20 +177231,31 @@ async def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "available_upgrade_versions": [
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the schedule
+ clusterlint run request was completed.
+ "diagnostics": [
{
- "kubernetes_version": "str", # Optional. The upstream
- version string for the version of Kubernetes provided by a given slug.
- "slug": "str", # Optional. The slug identifier for an
- available version of Kubernetes for use when creating or updating a
- cluster. The string contains both the upstream version of Kubernetes as
- well as the DigitalOcean revision.
- "supported_features": [
- "str" # Optional. The features available with the
- version of Kubernetes provided by a given slug.
- ]
+ "check_name": "str", # Optional. The clusterlint check that
+ resulted in the diagnostic.
+ "message": "str", # Optional. Feedback about the object for
+ users to fix.
+ "object": {
+ "kind": "str", # Optional. The kind of Kubernetes
+ API object.
+ "name": "str", # Optional. Name of the object.
+ "namespace": "str" # Optional. The namespace the
+ object resides in the cluster.
+ },
+ "severity": "str" # Optional. Can be one of error, warning
+ or suggestion.
}
- ]
+ ],
+ "requested_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the schedule
+ clusterlint run request was made.
+ "run_id": "str" # Optional. Id of the clusterlint run that can be used later
+ to fetch the diagnostics.
}
# response body for status code(s): 404
response == {
@@ -170594,8 +177287,9 @@ async def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_available_upgrades_request(
+ _request = build_kubernetes_get_cluster_lint_results_request(
cluster_id=cluster_id,
+ run_id=run_id,
headers=_headers,
params=_params,
)
@@ -170655,33 +177349,25 @@ async def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@overload
- async def upgrade_cluster(
+ async def add_registry( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: JSON,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Upgrade a Kubernetes Cluster.
-
- To immediately upgrade a Kubernetes cluster to a newer patch release of
- Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
- The body of the request must specify a version attribute.
+ ) -> None:
+ """Add Container Registry to Kubernetes Clusters.
- Available upgrade versions for a cluster can be fetched from
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ To integrate the container registry with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registry``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -170689,89 +177375,152 @@ async def upgrade_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "version": "str" # Optional. The slug identifier for the version of
- Kubernetes that the cluster will be upgraded to.
- }
-
- # 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.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
"""
@overload
- async def upgrade_cluster(
+ async def add_registry( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: IO[bytes],
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Upgrade a Kubernetes Cluster.
-
- To immediately upgrade a Kubernetes cluster to a newer patch release of
- Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
- The body of the request must specify a version attribute.
+ ) -> None:
+ """Add Container Registry to Kubernetes Clusters.
- Available upgrade versions for a cluster can be fetched from
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ To integrate the container registry with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registry``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def add_registry( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Add Container Registry to Kubernetes Clusters.
+
+ To integrate the container registry with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registry``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: None
+ :rtype: 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.
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
"""
+ 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 {})
- @distributed_trace_async
- async def upgrade_cluster(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Upgrade a Kubernetes Cluster.
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
- To immediately upgrade a Kubernetes cluster to a newer patch release of
- Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
- The body of the request must specify a version attribute.
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[None] = kwargs.pop("cls", None)
- Available upgrade versions for a cluster can be fetched from
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ 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
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
- :return: JSON object or None
- :rtype: JSON or None
+ _request = build_kubernetes_add_registry_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 [204]:
+ 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 cls:
+ return cls(pipeline_response, None, response_headers) # type: ignore
+
+ @overload
+ async def remove_registry( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> None:
+ """Remove Container Registry from Kubernetes Clusters.
+
+ To remove the container registry from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registry``.
+
+ :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: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -170779,20 +177528,60 @@ async def upgrade_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "version": "str" # Optional. The slug identifier for the version of
- Kubernetes that the cluster will be upgraded to.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
+ """
- # 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 remove_registry( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> None:
+ """Remove Container Registry from Kubernetes Clusters.
+
+ To remove the container registry from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registry``.
+
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def remove_registry( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Remove Container Registry from Kubernetes Clusters.
+
+ To remove the container registry from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registry``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -170814,7 +177603,7 @@ async def upgrade_cluster(
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -170822,10 +177611,12 @@ async def upgrade_cluster(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_kubernetes_upgrade_cluster_request(
- cluster_id=cluster_id,
+ _request = build_kubernetes_remove_registry_request(
content_type=content_type,
json=_json,
content=_content,
@@ -170843,153 +177634,114 @@ async def upgrade_cluster(
response = pipeline_response.http_response
- if response.status_code not in [202, 404]:
+ if response.status_code not in [204]:
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")
- )
+ 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 cls:
+ return cls(pipeline_response, None, response_headers) # type: ignore
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ @overload
+ async def add_registries( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> None:
+ """Add Container Registries to Kubernetes Clusters.
- if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ To integrate the container registries with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registries``.
- return deserialized # type: ignore
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ],
+ "registries": [
+ "str" # Optional. An array containing the registry names.
+ ]
+ }
+ """
+
+ @overload
+ async def add_registries( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> None:
+ """Add Container Registries to Kubernetes Clusters.
+
+ To integrate the container registries with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registries``.
+
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
@distributed_trace_async
- async def list_node_pools(self, cluster_id: str, **kwargs: Any) -> JSON:
- # pylint: disable=line-too-long
- """List All Node Pools in a Kubernetes Clusters.
+ async def add_registries( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Add Container Registries to Kubernetes Clusters.
- To list all of the node pools in a Kubernetes clusters, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools``.
+ To integrate the container registries with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :return: JSON object
- :rtype: JSON
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 200
- response == {
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value indicating
- whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in
- the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes that
- support partitioning. Immutable after the node pool is created. When
- omitted, the GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings
- specifying labels to apply to all nodes in a pool. Labels will
- automatically be applied to all existing nodes and any subsequent nodes
- added to the pool. Note that when a label is removed, it is not deleted
- from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for the
- node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was created.
- "droplet_id": "str", # Optional. The ID of
- the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that
- can be used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type
- of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags
- applied to the node pool. All node pools are automatically tagged
- ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node
- reacts to pods that it won't tolerate. Available effect values
- are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- "value": "str" # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- }
- ]
- }
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ],
+ "registries": [
+ "str" # Optional. An array containing the registry names.
]
}
- # 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,
@@ -171004,13 +177756,29 @@ async def list_node_pools(self, cluster_id: str, **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 {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[None] = kwargs.pop("cls", None)
- _request = build_kubernetes_list_node_pools_request(
- cluster_id=cluster_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_kubernetes_add_registries_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -171025,75 +177793,46 @@ async def list_node_pools(self, cluster_id: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [204]:
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
+ 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 cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
-
- return cast(JSON, deserialized) # type: ignore
+ return cls(pipeline_response, None, response_headers) # type: ignore
@overload
- async def add_node_pool(
+ async def remove_registries( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: JSON,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Add a Node Pool to a Kubernetes Cluster.
+ ) -> None:
+ """Remove Container Registries from Kubernetes Clusters.
- To add an additional node pool to a Kubernetes clusters, send a POST request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
- attributes.
+ To remove the container registries from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -171101,297 +177840,52 @@ async def add_node_pool(
# JSON input template you can fill out and use as your body input.
body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
- node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
- after the node pool is created. When omitted, the GPUs in the pool are left
- unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of Droplet used
- as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
+ "registries": [
+ "str" # Optional. An array containing the registry names.
]
}
-
- # response body for status code(s): 201
- response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
- }
- # 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 add_node_pool(
+ async def remove_registries( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: IO[bytes],
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Add a Node Pool to a Kubernetes Cluster.
+ ) -> None:
+ """Remove Container Registries from Kubernetes Clusters.
- To add an additional node pool to a Kubernetes clusters, send a POST request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
- attributes.
+ To remove the container registries from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # response body for status code(s): 201
- response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
- }
- # 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 add_node_pool(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Add a Node Pool to a Kubernetes Cluster.
+ async def remove_registries( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Remove Container Registries from Kubernetes Clusters.
- To add an additional node pool to a Kubernetes clusters, send a POST request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
- attributes.
+ To remove the container registries from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :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
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -171399,161 +177893,14 @@ async def add_node_pool(
# JSON input template you can fill out and use as your body input.
body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
- node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
- after the node pool is created. When omitted, the GPUs in the pool are left
- unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of Droplet used
- as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
+ "registries": [
+ "str" # Optional. An array containing the registry names.
]
}
-
- # response body for status code(s): 201
- response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
- }
- # 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,
@@ -171574,7 +177921,7 @@ async def add_node_pool(
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -171582,10 +177929,12 @@ async def add_node_pool(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_kubernetes_add_node_pool_request(
- cluster_id=cluster_id,
+ _request = build_kubernetes_remove_registries_request(
content_type=content_type,
json=_json,
content=_content,
@@ -171603,65 +177952,46 @@ async def add_node_pool(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ if response.status_code not in [204]:
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
+ 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 cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
-
- return cast(JSON, deserialized) # type: ignore
+ return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace_async
- async def get_node_pool(
- self, cluster_id: str, node_pool_id: str, **kwargs: Any
+ async def get_status_messages(
+ self,
+ cluster_id: str,
+ *,
+ since: Optional[datetime.datetime] = None,
+ **kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
- """Retrieve a Node Pool for a Kubernetes Cluster.
+ """Fetch Status Messages for a Kubernetes Cluster.
- To show information about a specific node pool in a Kubernetes cluster, send
- a GET request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
+ To retrieve status messages for a Kubernetes cluster, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/status_messages``. Status messages inform users of
+ any issues that come up during the cluster lifecycle.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :keyword since: A timestamp used to return status messages emitted since the specified time.
+ The timestamp should be in ISO8601 format. Default value is None.
+ :paramtype since: ~datetime.datetime
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -171671,77 +178001,14 @@ async def get_node_pool(
# response body for status code(s): 200
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
+ "messages": [
+ {
+ "message": "str", # Optional. Status information about the
+ cluster which impacts it's lifecycle.
+ "timestamp": "2020-02-20 00:00:00" # Optional. A timestamp
+ in ISO8601 format that represents when the status message was emitted.
+ }
+ ]
}
# response body for status code(s): 404
response == {
@@ -171773,9 +178040,9 @@ async def get_node_pool(
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_node_pool_request(
+ _request = build_kubernetes_get_status_messages_request(
cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ since=since,
headers=_headers,
params=_params,
)
@@ -171834,29 +178101,47 @@ async def get_node_pool(
return cast(JSON, deserialized) # type: ignore
+
+class LoadBalancersOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`load_balancers` 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 update_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: JSON,
- *,
- 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
- """Update a Node Pool in a Kubernetes Cluster.
+ """Create a New Load Balancer.
- To update the name of a node pool, edit the tags applied to it, or adjust its
- number of nodes, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
- following attributes.
+ To create a new load balancer instance, send a POST request to
+ ``/v2/load_balancers``.
+
+ You can specify the Droplets that will sit behind the load balancer using one
+ of two methods:
+
+
+ * Set ``droplet_ids`` to a list of specific Droplet IDs.
+ * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
+ assigned to the load balancer. Additional Droplets will be automatically
+ assigned as they are tagged.
+
+ These methods are mutually exclusive.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -171870,180 +178155,247 @@ async def update_node_pool(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
+ body = {}
# response body for status code(s): 202
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
+ "load_balancer": {
+ "forwarding_rules": [
{
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
}
],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
{
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
}
- ]
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
}
}
- # 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_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: IO[bytes],
- *,
- 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
- """Update a Node Pool in a Kubernetes Cluster.
+ """Create a New Load Balancer.
- To update the name of a node pool, edit the tags applied to it, or adjust its
- number of nodes, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
- following attributes.
+ To create a new load balancer instance, send a POST request to
+ ``/v2/load_balancers``.
+
+ You can specify the Droplets that will sit behind the load balancer using one
+ of two methods:
+
+
+ * Set ``droplet_ids`` to a list of specific Droplet IDs.
+ * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
+ assigned to the load balancer. Additional Droplets will be automatically
+ assigned as they are tagged.
+
+ These methods are mutually exclusive.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -172058,112 +178410,241 @@ async def update_node_pool(
# response body for status code(s): 202
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
+ "load_balancer": {
+ "forwarding_rules": [
{
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
}
],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
{
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
}
- ]
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
}
}
- # 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 update_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: Union[JSON, IO[bytes]],
- **kwargs: Any
- ) -> JSON:
+ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Update a Node Pool in a Kubernetes Cluster.
+ """Create a New Load Balancer.
- To update the name of a node pool, edit the tags applied to it, or adjust its
- number of nodes, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
- following attributes.
+ To create a new load balancer instance, send a POST request to
+ ``/v2/load_balancers``.
+
+ You can specify the Droplets that will sit behind the load balancer using one
+ of two methods:
+
+
+ * Set ``droplet_ids`` to a list of specific Droplet IDs.
+ * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
+ assigned to the load balancer. Additional Droplets will be automatically
+ assigned as they are tagged.
+
+ These methods are mutually exclusive.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -172174,155 +178655,224 @@ async def update_node_pool(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
+ body = {}
# response body for status code(s): 202
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
+ "load_balancer": {
+ "forwarding_rules": [
{
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
}
],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
{
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
}
- ]
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
}
}
- # 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,
@@ -172353,9 +178903,7 @@ async def update_node_pool(
else:
_json = body
- _request = build_kubernetes_update_node_pool_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ _request = build_load_balancers_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -172373,44 +178921,27 @@ async def update_node_pool(
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)
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.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
@@ -172418,40 +178949,259 @@ async def update_node_pool(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def delete_node_pool(
- self, cluster_id: str, node_pool_id: str, **kwargs: Any
- ) -> Optional[JSON]:
+ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Node Pool in a Kubernetes Cluster.
-
- To delete a node pool, send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
+ """List All Load Balancers.
- A 204 status code with no body will be returned in response to a successful
- request. Nodes in the pool will subsequently be drained and deleted.
+ To list all of the load balancer instances on your account, send a GET request
+ to ``/v2/load_balancers``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: 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
+ # 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": {}
+ },
+ "load_balancers": [
+ {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing
+ the port on which the load balancer instance will listen.
+ Required.
+ "entry_protocol": "str", # The protocol used
+ for traffic to the load balancer. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``http3``"" , ``tcp``""
+ , or ``udp``. If you set the ``entry_protocol`` to ``udp``"" ,
+ the ``target_protocol`` must be set to ``udp``. When using UDP,
+ the load balancer requires that you set up a health check with a
+ port that uses TCP, HTTP, or HTTPS to work properly. Required.
+ Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing
+ the port on the backend Droplets to which the load balancer will
+ send traffic. Required.
+ "target_protocol": "str", # The protocol
+ used for traffic from the load balancer to the backend Droplets.
+ The possible values are: ``http``"" , ``https``"" , ``http2``"" ,
+ ``tcp``"" , or ``udp``. If you set the ``target_protocol`` to
+ ``udp``"" , the ``entry_protocol`` must be set to ``udp``. When
+ using UDP, the load balancer requires that you set up a health
+ check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "tcp", and
+ "udp".
+ "certificate_id": "str", # Optional. The ID
+ of the TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A
+ boolean value indicating whether SSL encrypted traffic will be
+ passed through to the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify
+ an algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the load balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional.
+ Default value is False. A boolean value indicating whether to disable
+ automatic DNS record creation for Let's Encrypt certificates that are
+ added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID
+ of the TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean
+ value indicating if the domain is already managed by
+ DigitalOcean. If true, all A and AAAA records required to enable
+ Global load balancers will be automatically added.
+ "name": "str" # Optional. FQDN to associate
+ with a Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the
+ Droplets assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value
+ is False. A boolean value indicating whether HTTP keepalive connections
+ are maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is
+ False. A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing
+ traffic to the load balancer (in the form 'ip:1.2.3.4' or
+ 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying
+ traffic to the load balancer (in the form 'ip:1.2.3.4' or
+ 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean
+ flag to enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer
+ value as a percentage to indicate failure threshold to decide how the
+ regional priorities will take effect. A value of ``50`` would
+ indicate that the Global load balancer will choose a lower priority
+ region to forward traffic to once this failure threshold has been
+ reached for the higher priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string
+ to an integer priority value indicating preference for which
+ regional target a Global load balancer will forward traffic to. A
+ lower value indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer
+ representing the port on the target backends which the load balancer
+ will forward traffic to.
+ "target_protocol": "str" # Optional. The protocol
+ used for forwarding traffic from the load balancer to the target
+ backends. The possible values are ``http``"" , ``https`` and
+ ``http2``. Known values are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default
+ value is 10. The number of seconds between between two consecutive
+ health checks.
+ "healthy_threshold": 3, # Optional. Default value is
+ 3. The number of times a health check must pass for a backend Droplet
+ to be marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The
+ path on the backend Droplets to which the load balancer instance will
+ send a request.
+ "port": 80, # Optional. Default value is 80. An
+ integer representing the port on the backend Droplets on which the
+ health check will attempt a connection.
+ "protocol": "http", # Optional. Default value is
+ "http". The protocol used for health checks sent to the backend
+ Droplets. The possible values are ``http``"" , ``https``"" , or
+ ``tcp``. Known values are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default
+ value is 5. The number of seconds the load balancer instance will
+ wait for a response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value
+ is 5. The number of times a health check must fail for a backend
+ Droplet to be marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value
+ is 60. An integer value which configures the idle timeout for HTTP
+ requests to the target droplets.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the
+ public-facing IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load
+ balancer instance.
+ "network": "EXTERNAL", # Optional. Default value is
+ "EXTERNAL". A string indicating whether the load balancer should be
+ external or internal. Internal load balancers have no public IPs and are
+ only accessible to resources on the same VPC network. This property
+ cannot be updated after creating the load balancer. Known values are:
+ "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is
+ "IPV4". A string indicating whether the load balancer will support IPv4
+ or both IPv4 and IPv6 networking. This property cannot be updated after
+ creating the load balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that
+ the load balancer is associated with. If no ID is provided at creation,
+ the load balancer associates with the user's default project. If an
+ invalid project ID is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value
+ is False. A boolean value indicating whether HTTP requests to the load
+ balancer on port 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small".
+ This field has been replaced by the ``size_unit`` field for all regions
+ except in AMS2, NYC2, and SFO1. Each available load balancer size now
+ equates to the load balancer having a set number of nodes. *
+ ``lb-small`` = 1 node * ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes
+ You can resize load balancers after creation up to once per hour. You
+ cannot resize a load balancer within the first hour of its creation.
+ Known values are: "lb-small", "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many
+ nodes the load balancer contains. Each additional node increases the load
+ balancer's ability to manage more connections. Load balancers can be
+ scaled up or down, and you can change the number of nodes after creation
+ up to once per hour. This field is currently not available in the AMS2,
+ NYC2, or SFO1 regions. Use the ``size`` field to scale load balancers
+ that reside in these regions.
+ "status": "str", # Optional. A status string indicating the
+ current state of the load balancer. This can be ``new``"" , ``active``""
+ , or ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the
+ cookie sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of
+ seconds until the cookie set by the load balancer expires. This
+ attribute is only returned when using ``cookies`` for the sticky
+ sessions type.
+ "type": "none" # Optional. Default value is "none".
+ An attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values
+ are ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the
+ UUID of the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag
+ corresponding to Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of
+ the Regional load balancers to be used as target backends for a
+ Global load balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used
+ by the load balancer. The possible values are ``DEFAULT`` or ``STRONG``.
+ The default value is ``DEFAULT``. Known values are: "DEFAULT" and
+ "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL".
+ A string indicating whether the load balancer should be a standard
+ regional HTTP load balancer, a regional network load balancer that routes
+ traffic at the TCP/UDP transport layer, or a global load balancer. Known
+ values are: "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID
+ of the VPC to which the load balancer is assigned.
+ }
+ ]
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -172470,11 +179220,11 @@ async def delete_node_pool(
_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_kubernetes_delete_node_pool_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ _request = build_load_balancers_list_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -172489,94 +179239,266 @@ async def delete_node_pool(
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
@distributed_trace_async
- async def delete_node(
- self,
- cluster_id: str,
- node_pool_id: str,
- node_id: str,
- *,
- skip_drain: int = 0,
- replace: int = 0,
- **kwargs: Any
- ) -> Optional[JSON]:
+ async def get(self, lb_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Node in a Kubernetes Cluster.
-
- To delete a single node in a pool, send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``.
-
- Appending the ``skip_drain=1`` query parameter to the request causes node
- draining to be skipped. Omitting the query parameter or setting its value to
- ``0`` carries out draining prior to deletion.
+ """Retrieve an Existing Load Balancer.
- Appending the ``replace=1`` query parameter to the request causes the node to
- be replaced by a new one after deletion. Omitting the query parameter or
- setting its value to ``0`` deletes without replacement.
+ To show information about a load balancer instance, send a GET request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
- :param node_id: A unique ID that can be used to reference a node in a Kubernetes node pool.
- Required.
- :type node_id: str
- :keyword skip_drain: Specifies whether or not to drain workloads from a node before it is
- deleted. Setting it to ``1`` causes node draining to be skipped. Omitting the query parameter
- or setting its value to ``0`` carries out draining prior to deletion. Default value is 0.
- :paramtype skip_drain: int
- :keyword replace: Specifies whether or not to replace a node after it has been deleted. Setting
- it to ``1`` causes the node to be replaced by a new one after deletion. Omitting the query
- parameter or setting its value to ``0`` deletes without replacement. Default value is 0.
- :paramtype replace: int
- :return: JSON object or None
- :rtype: JSON or None
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
+ # response body for status code(s): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -172605,14 +179527,10 @@ async def delete_node(
_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_kubernetes_delete_node_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
- node_id=node_id,
- skip_drain=skip_drain,
- replace=replace,
+ _request = build_load_balancers_get_request(
+ lb_id=lb_id,
headers=_headers,
params=_params,
)
@@ -172627,15 +179545,14 @@ async def delete_node(
response = pipeline_response.http_response
- if response.status_code not in [202, 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 == 202:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -172646,6 +179563,11 @@ async def delete_node(
"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")
@@ -172663,51 +179585,262 @@ async def delete_node(
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 recycle_node_pool(
+ async def update(
self,
- cluster_id: str,
- node_pool_id: str,
+ lb_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Recycle a Kubernetes Node Pool.
+ """Update a Load Balancer.
- The endpoint has been deprecated. Please use the DELETE
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
- method instead.
+ To update a load balancer's settings, send a PUT request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
+ representation of the load balancer including existing attributes. It may
+ contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
+ exclusive. **Note that any attribute that is not provided will be reset to its
+ default value.**.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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
# JSON input template you can fill out and use as your body input.
- body = {
- "nodes": [
- "str" # Optional.
- ]
- }
+ body = {}
+ # response body for status code(s): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -172722,39 +179855,254 @@ async def recycle_node_pool(
"""
@overload
- async def recycle_node_pool(
+ async def update(
self,
- cluster_id: str,
- node_pool_id: str,
+ lb_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Recycle a Kubernetes Node Pool.
+ """Update a Load Balancer.
- The endpoint has been deprecated. Please use the DELETE
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
- method instead.
+ To update a load balancer's settings, send a PUT request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
+ representation of the load balancer including existing attributes. It may
+ contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
+ exclusive. **Note that any attribute that is not provided will be reset to its
+ default value.**.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -172769,41 +180117,249 @@ async def recycle_node_pool(
"""
@distributed_trace_async
- async def recycle_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: Union[JSON, IO[bytes]],
- **kwargs: Any
- ) -> Optional[JSON]:
+ async def update(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Recycle a Kubernetes Node Pool.
+ """Update a Load Balancer.
- The endpoint has been deprecated. Please use the DELETE
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
- method instead.
+ To update a load balancer's settings, send a PUT request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
+ representation of the load balancer including existing attributes. It may
+ contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
+ exclusive. **Note that any attribute that is not provided will be reset to its
+ default value.**.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
: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 = {
- "nodes": [
- "str" # Optional.
- ]
+ body = {}
+
+ # response body for status code(s): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
}
-
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -172835,7 +180391,7 @@ async def recycle_node_pool(
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
@@ -172845,9 +180401,8 @@ async def recycle_node_pool(
else:
_json = body
- _request = build_kubernetes_recycle_node_pool_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ _request = build_load_balancers_update_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -172865,15 +180420,14 @@ async def recycle_node_pool(
response = pipeline_response.http_response
- if response.status_code not in [202, 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 == 202:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -172884,6 +180438,11 @@ async def recycle_node_pool(
"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")
@@ -172901,38 +180460,31 @@ async def recycle_node_pool(
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_cluster_user(self, cluster_id: str, **kwargs: Any) -> JSON:
+ async def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Retrieve User Information for a Kubernetes Cluster.
+ """Delete a Load Balancer.
- To show information the user associated with a Kubernetes cluster, send a GET
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/user``.
+ To delete a load balancer instance, disassociating any Droplets assigned to it
+ and removing it from your account, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :return: JSON object
- :rtype: JSON
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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 == {
- "kubernetes_cluster_user": {
- "groups": [
- "str" # Optional. A list of in-cluster groups that the user
- belongs to.
- ],
- "username": "str" # Optional. The username for the cluster admin
- user.
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -172961,10 +180513,10 @@ async def get_cluster_user(self, cluster_id: 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_kubernetes_get_cluster_user_request(
- cluster_id=cluster_id,
+ _request = build_load_balancers_delete_request(
+ lb_id=lb_id,
headers=_headers,
params=_params,
)
@@ -172979,14 +180531,15 @@ async def get_cluster_user(self, cluster_id: 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:
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")
)
@@ -172997,11 +180550,6 @@ async def get_cluster_user(self, cluster_id: 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")
@@ -173019,61 +180567,30 @@ async def get_cluster_user(self, cluster_id: 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_async
- async def list_options(self, **kwargs: Any) -> JSON:
+ async def delete_cache(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List Available Regions, Node Sizes, and Versions of Kubernetes.
+ """Delete a Global Load Balancer CDN Cache.
- To list the versions of Kubernetes available for use, the regions that support Kubernetes, and
- the available node sizes, send a GET request to ``/v2/kubernetes/options``.
+ To delete a Global load balancer CDN cache, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/cache``.
- :return: JSON object
- :rtype: JSON
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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 == {
- "options": {
- "regions": [
- {
- "name": "str", # Optional. A DigitalOcean region
- where Kubernetes is available.
- "slug": "str" # Optional. The identifier for a
- region for use when creating a new cluster.
- }
- ],
- "sizes": [
- {
- "name": "str", # Optional. A Droplet size available
- for use in a Kubernetes node pool.
- "slug": "str" # Optional. The identifier for a size
- for use when creating a new cluster.
- }
- ],
- "versions": [
- {
- "kubernetes_version": "str", # Optional. The
- upstream version string for the version of Kubernetes provided by a
- given slug.
- "slug": "str", # Optional. The slug identifier for
- an available version of Kubernetes for use when creating or updating
- a cluster. The string contains both the upstream version of
- Kubernetes as well as the DigitalOcean revision.
- "supported_features": [
- "str" # Optional. The features available
- with the version of Kubernetes provided by a given slug.
- ]
- }
- ]
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -173102,9 +180619,10 @@ async def list_options(self, **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_kubernetes_list_options_request(
+ _request = build_load_balancers_delete_cache_request(
+ lb_id=lb_id,
headers=_headers,
params=_params,
)
@@ -173119,14 +180637,15 @@ async def list_options(self, **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:
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")
)
@@ -173137,11 +180656,6 @@ async def list_options(self, **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")
@@ -173159,44 +180673,42 @@ async def list_options(self, **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
@overload
- async def run_cluster_lint(
+ async def add_droplets(
self,
- cluster_id: str,
- body: Optional[JSON] = None,
+ lb_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Run Clusterlint Checks on a Kubernetes Cluster.
-
- Clusterlint helps operators conform to Kubernetes best practices around
- resources, security and reliability to avoid common problems while operating
- or upgrading the clusters.
+ """Add Droplets to a Load Balancer.
- To request a clusterlint run on your cluster, send a POST request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
- checks present in the ``doks`` group by default, if a request body is not
- specified. Optionally specify the below attributes.
+ To assign a Droplet to a load balancer instance, send a POST request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ Individual Droplets can not be added to a load balancer configured with a
+ Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
+ response from the API.
- For information about the available checks, please refer to
- `the clusterlint check documentation
- `_.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Default value is None.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
:paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -173204,29 +180716,12 @@ async def run_cluster_lint(
# JSON input template you can fill out and use as your body input.
body = {
- "exclude_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "exclude_groups": [
- "str" # Optional. An array of check groups that will be omitted when
- clusterlint executes checks.
- ],
- "include_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "include_groups": [
- "str" # Optional. An array of check groups that will be run when
- clusterlint executes checks.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
- # response body for status code(s): 202
- response == {
- "run_id": "str" # Optional. ID of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -173241,121 +180736,42 @@ async def run_cluster_lint(
"""
@overload
- async def run_cluster_lint(
+ async def add_droplets(
self,
- cluster_id: str,
- body: Optional[IO[bytes]] = None,
+ lb_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Run Clusterlint Checks on a Kubernetes Cluster.
-
- Clusterlint helps operators conform to Kubernetes best practices around
- resources, security and reliability to avoid common problems while operating
- or upgrading the clusters.
+ """Add Droplets to a Load Balancer.
- To request a clusterlint run on your cluster, send a POST request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
- checks present in the ``doks`` group by default, if a request body is not
- specified. Optionally specify the below attributes.
+ To assign a Droplet to a load balancer instance, send a POST request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ Individual Droplets can not be added to a load balancer configured with a
+ Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
+ response from the API.
- For information about the available checks, please refer to
- `the clusterlint check documentation
- `_.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Default value is None.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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 == {
- "run_id": "str" # Optional. ID of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
- # 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_cluster_lint(
- self,
- cluster_id: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Run Clusterlint Checks on a Kubernetes Cluster.
-
- Clusterlint helps operators conform to Kubernetes best practices around
- resources, security and reliability to avoid common problems while operating
- or upgrading the clusters.
-
- To request a clusterlint run on your cluster, send a POST request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
- checks present in the ``doks`` group by default, if a request body is not
- specified. Optionally specify the below attributes.
-
- For information about the available checks, please refer to
- `the clusterlint check documentation
- `_.
-
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: 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
+ :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 = {
- "exclude_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "exclude_groups": [
- "str" # Optional. An array of check groups that will be omitted when
- clusterlint executes checks.
- ],
- "include_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "include_groups": [
- "str" # Optional. An array of check groups that will be run when
- clusterlint executes checks.
- ]
- }
-
- # response body for status code(s): 202
- response == {
- "run_id": "str" # Optional. ID of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -173368,627 +180784,31 @@ async def run_cluster_lint(
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_kubernetes_run_cluster_lint_request(
- cluster_id=cluster_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)
-
- 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.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_cluster_lint_results(
- self, cluster_id: str, *, run_id: Optional[str] = None, **kwargs: Any
- ) -> JSON:
+ async def add_droplets(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Fetch Clusterlint Diagnostics for a Kubernetes Cluster.
-
- To request clusterlint diagnostics for your cluster, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. If the ``run_id`` query
- parameter is provided, then the diagnostics for the specific run is fetched.
- By default, the latest results are shown.
-
- To find out how to address clusterlint feedback, please refer to
- `the clusterlint check documentation
- `_.
-
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :keyword run_id: Specifies the clusterlint run whose results will be retrieved. Default value
- is None.
- :paramtype run_id: str
- :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 that represents when the schedule
- clusterlint run request was completed.
- "diagnostics": [
- {
- "check_name": "str", # Optional. The clusterlint check that
- resulted in the diagnostic.
- "message": "str", # Optional. Feedback about the object for
- users to fix.
- "object": {
- "kind": "str", # Optional. The kind of Kubernetes
- API object.
- "name": "str", # Optional. Name of the object.
- "namespace": "str" # Optional. The namespace the
- object resides in the cluster.
- },
- "severity": "str" # Optional. Can be one of error, warning
- or suggestion.
- }
- ],
- "requested_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the schedule
- clusterlint run request was made.
- "run_id": "str" # Optional. Id of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
- # 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_kubernetes_get_cluster_lint_results_request(
- cluster_id=cluster_id,
- run_id=run_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 add_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> None:
- """Add Container Registry to Kubernetes Clusters.
-
- To integrate the container registry with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
-
- @overload
- async def add_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> None:
- """Add Container Registry to Kubernetes Clusters.
-
- To integrate the container registry with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
-
- @distributed_trace_async
- async def add_registry( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Add Container Registry to Kubernetes Clusters.
-
- To integrate the container registry with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registry``.
-
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
- :return: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
- 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[None] = 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_kubernetes_add_registry_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 [204]:
- 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 cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
-
- @overload
- async def remove_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> None:
- """Remove Container Registry from Kubernetes Clusters.
-
- To remove the container registry from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
-
- @overload
- async def remove_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> None:
- """Remove Container Registry from Kubernetes Clusters.
-
- To remove the container registry from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
-
- @distributed_trace_async
- async def remove_registry( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Remove Container Registry from Kubernetes Clusters.
-
- To remove the container registry from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registry``.
-
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
- :return: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
- 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[None] = 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_kubernetes_remove_registry_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 [204]:
- 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 cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
-
- @overload
- async def add_registries( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> None:
- """Add Container Registries to Kubernetes Clusters.
-
- To integrate the container registries with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registries``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
- ]
- }
- """
-
- @overload
- async def add_registries( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> None:
- """Add Container Registries to Kubernetes Clusters.
-
- To integrate the container registries with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registries``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
+ """Add Droplets to a Load Balancer.
- @distributed_trace_async
- async def add_registries( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Add Container Registries to Kubernetes Clusters.
+ To assign a Droplet to a load balancer instance, send a POST request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ Individual Droplets can not be added to a load balancer configured with a
+ Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
+ response from the API.
- To integrate the container registries with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registries``.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: None
- :rtype: None
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -173996,14 +180816,23 @@ async def add_registries( # pylint: disable=inconsistent-return-statements
# JSON input template you can fill out and use as your body input.
body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
+
+ # 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,
@@ -174024,7 +180853,7 @@ async def add_registries( # pylint: disable=inconsistent-return-statements
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -174032,12 +180861,10 @@ async def add_registries( # pylint: disable=inconsistent-return-statements
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_kubernetes_add_registries_request(
+ _request = build_load_balancers_add_droplets_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -174055,46 +180882,75 @@ async def add_registries( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [204]:
+ 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.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, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@overload
- async def remove_registries( # pylint: disable=inconsistent-return-statements
+ async def remove_droplets(
self,
- body: Optional[JSON] = None,
+ lb_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> None:
- """Remove Container Registries from Kubernetes Clusters.
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Droplets from a Load Balancer.
- To remove the container registries from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registries``.
+ To remove a Droplet from a load balancer instance, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- :param body: Default value is None.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
:paramtype content_type: str
- :return: None
- :rtype: None
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -174102,52 +180958,93 @@ async def remove_registries( # pylint: disable=inconsistent-return-statements
# JSON input template you can fill out and use as your body input.
body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
+
+ # 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 remove_registries( # pylint: disable=inconsistent-return-statements
+ async def remove_droplets(
self,
- body: Optional[IO[bytes]] = None,
+ lb_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> None:
- """Remove Container Registries from Kubernetes Clusters.
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Droplets from a Load Balancer.
- To remove the container registries from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registries``.
+ To remove a Droplet from a load balancer instance, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- :param body: Default value is None.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
:paramtype content_type: str
- :return: None
- :rtype: None
+ :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 remove_registries( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Remove Container Registries from Kubernetes Clusters.
+ async def remove_droplets(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Droplets from a Load Balancer.
- To remove the container registries from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registries``.
+ To remove a Droplet from a load balancer instance, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: None
- :rtype: None
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -174155,14 +181052,23 @@ async def remove_registries( # pylint: disable=inconsistent-return-statements
# JSON input template you can fill out and use as your body input.
body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
+
+ # 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,
@@ -174183,7 +181089,7 @@ async def remove_registries( # pylint: disable=inconsistent-return-statements
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -174191,12 +181097,10 @@ async def remove_registries( # pylint: disable=inconsistent-return-statements
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_kubernetes_remove_registries_request(
+ _request = build_load_balancers_remove_droplets_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -174214,64 +181118,235 @@ async def remove_registries( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [204]:
+ 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.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, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- @distributed_trace_async
- async def get_status_messages(
+ return deserialized # type: ignore
+
+ @overload
+ async def add_forwarding_rules(
self,
- cluster_id: str,
+ lb_id: str,
+ body: JSON,
*,
- since: Optional[datetime.datetime] = None,
+ content_type: str = "application/json",
**kwargs: Any
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Fetch Status Messages for a Kubernetes Cluster.
+ """Add Forwarding Rules to a Load Balancer.
- To retrieve status messages for a Kubernetes cluster, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/status_messages``. Status messages inform users of
- any issues that come up during the cluster lifecycle.
+ To add an additional forwarding rule to a load balancer instance, send a POST
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
+ of the request, there should be a ``forwarding_rules`` attribute containing an
+ array of rules to be added.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :keyword since: A timestamp used to return status messages emitted since the specified time.
- The timestamp should be in ISO8601 format. Default value is None.
- :paramtype since: ~datetime.datetime
- :return: JSON object
- :rtype: JSON
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
+ :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): 200
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
+ }
+ ]
+ }
+
+ # response body for status code(s): 404
response == {
- "messages": [
+ "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 add_forwarding_rules(
+ self,
+ lb_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Add Forwarding Rules to a Load Balancer.
+
+ To add an additional forwarding rule to a load balancer instance, send a POST
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
+ of the request, there should be a ``forwarding_rules`` attribute containing an
+ array of rules to be added.
+
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
+ :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 add_forwarding_rules(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Add Forwarding Rules to a Load Balancer.
+
+ To add an additional forwarding rule to a load balancer instance, send a POST
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
+ of the request, there should be a ``forwarding_rules`` attribute containing an
+ array of rules to be added.
+
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :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 = {
+ "forwarding_rules": [
{
- "message": "str", # Optional. Status information about the
- cluster which impacts it's lifecycle.
- "timestamp": "2020-02-20 00:00:00" # Optional. A timestamp
- in ISO8601 format that represents when the status message was emitted.
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
}
]
}
+
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -174297,14 +181372,27 @@ async def get_status_messages(
}
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[JSON] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_status_messages_request(
- cluster_id=cluster_id,
- since=since,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_load_balancers_add_forwarding_rules_request(
+ lb_id=lb_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -174319,14 +181407,15 @@ async def get_status_messages(
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")
)
@@ -174337,11 +181426,6 @@ async def get_status_messages(
"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")
@@ -174359,781 +181443,209 @@ async def get_status_messages(
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
-
- return cast(JSON, deserialized) # type: ignore
-
-
-class LoadBalancersOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.aio.GeneratedClient`'s
- :attr:`load_balancers` attribute.
- """
+ return cls(pipeline_response, 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 deserialized # type: ignore
@overload
- async def create(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
+ async def remove_forwarding_rules(
+ self,
+ lb_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a New Load Balancer.
-
- To create a new load balancer instance, send a POST request to
- ``/v2/load_balancers``.
-
- You can specify the Droplets that will sit behind the load balancer using one
- of two methods:
-
+ """Remove Forwarding Rules from a Load Balancer.
- * Set ``droplet_ids`` to a list of specific Droplet IDs.
- * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
- assigned to the load balancer. Additional Droplets will be automatically
- assigned as they are tagged.
+ To remove forwarding rules from a load balancer instance, send a DELETE
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
+ body of the request, there should be a ``forwarding_rules`` attribute containing
+ an array of rules to be removed.
- These methods are mutually exclusive.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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
# JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 202
- response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
- }
- """
-
- @overload
- async def create(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Create a New Load Balancer.
-
- To create a new load balancer instance, send a POST request to
- ``/v2/load_balancers``.
-
- You can specify the Droplets that will sit behind the load balancer using one
- of two methods:
-
-
- * Set ``droplet_ids`` to a list of specific Droplet IDs.
- * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
- assigned to the load balancer. Additional Droplets will be automatically
- assigned as they are tagged.
-
- These methods are mutually exclusive.
-
- :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 == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
+ body = {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
+ }
+ ]
+ }
+
+ # 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: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ @overload
+ async def remove_forwarding_rules(
+ self,
+ lb_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a New Load Balancer.
+ """Remove Forwarding Rules from a Load Balancer.
- To create a new load balancer instance, send a POST request to
- ``/v2/load_balancers``.
+ To remove forwarding rules from a load balancer instance, send a DELETE
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
+ body of the request, there should be a ``forwarding_rules`` attribute containing
+ an array of rules to be removed.
- You can specify the Droplets that will sit behind the load balancer using one
- of two methods:
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
+ :paramtype content_type: str
+ :return: JSON object or None
+ :rtype: JSON or None
+ :raises ~azure.core.exceptions.HttpResponseError:
- * Set ``droplet_ids`` to a list of specific Droplet IDs.
- * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
- assigned to the load balancer. Additional Droplets will be automatically
- assigned as they are tagged.
+ Example:
+ .. code-block:: python
- These methods are mutually exclusive.
+ # 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 remove_forwarding_rules(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Forwarding Rules from a Load Balancer.
+
+ To remove forwarding rules from a load balancer instance, send a DELETE
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
+ body of the request, there should be a ``forwarding_rules`` attribute containing
+ an array of rules to be removed.
+
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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
+ :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 = {}
+ body = {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
+ }
+ ]
+ }
- # response body for status code(s): 202
+ # response body for status code(s): 404
response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
+ "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]] = {
@@ -175155,7 +181667,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
@@ -175165,7 +181677,8 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_load_balancers_create_request(
+ _request = build_load_balancers_remove_forwarding_rules_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -175183,45 +181696,95 @@ 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 [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
+
+
+class MicrovmsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`microvms` 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 list(
+ self,
+ *,
+ page: int = 1,
+ per_page: int = 25,
+ region: Optional[str] = None,
+ name: Optional[str] = None,
+ tag_name: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """List All Load Balancers.
+ """List all MicroVMs.
- To list all of the load balancer instances on your account, send a GET request
- to ``/v2/load_balancers``.
+ To list all of the MicroVMs on your team, send a GET request to ``/v2/microvms``.
+
+ The ``region``\\ , ``name``\\ , and ``tag_name`` filters combine with AND.
- :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 per_page: Number of items returned per page. Default value is 25.
+ :paramtype per_page: int
+ :keyword region: Only return MicroVMs in this region. Default value is None.
+ :paramtype region: str
+ :keyword name: Only return the MicroVM with this exact name. Default value is None.
+ :paramtype name: str
+ :keyword tag_name: Only return MicroVMs with this tag. A tag that matches no MicroVMs returns
+ an empty list. Default value is None.
+ :paramtype tag_name: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -175237,231 +181800,83 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
"links": {
"pages": {}
},
- "load_balancers": [
+ "microvms": [
{
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing
- the port on which the load balancer instance will listen.
- Required.
- "entry_protocol": "str", # The protocol used
- for traffic to the load balancer. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``http3``"" , ``tcp``""
- , or ``udp``. If you set the ``entry_protocol`` to ``udp``"" ,
- the ``target_protocol`` must be set to ``udp``. When using UDP,
- the load balancer requires that you set up a health check with a
- port that uses TCP, HTTP, or HTTPS to work properly. Required.
- Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing
- the port on the backend Droplets to which the load balancer will
- send traffic. Required.
- "target_protocol": "str", # The protocol
- used for traffic from the load balancer to the backend Droplets.
- The possible values are: ``http``"" , ``https``"" , ``http2``"" ,
- ``tcp``"" , or ``udp``. If you set the ``target_protocol`` to
- ``udp``"" , the ``entry_protocol`` must be set to ``udp``. When
- using UDP, the load balancer requires that you set up a health
- check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "tcp", and
- "udp".
- "certificate_id": "str", # Optional. The ID
- of the TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A
- boolean value indicating whether SSL encrypted traffic will be
- passed through to the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify
- an algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the load balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional.
- Default value is False. A boolean value indicating whether to disable
- automatic DNS record creation for Let's Encrypt certificates that are
- added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID
- of the TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean
- value indicating if the domain is already managed by
- DigitalOcean. If true, all A and AAAA records required to enable
- Global load balancers will be automatically added.
- "name": "str" # Optional. FQDN to associate
- with a Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the
- Droplets assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value
- is False. A boolean value indicating whether HTTP keepalive connections
- are maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is
- False. A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing
- traffic to the load balancer (in the form 'ip:1.2.3.4' or
- 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying
- traffic to the load balancer (in the form 'ip:1.2.3.4' or
- 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean
- flag to enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer
- value as a percentage to indicate failure threshold to decide how the
- regional priorities will take effect. A value of ``50`` would
- indicate that the Global load balancer will choose a lower priority
- region to forward traffic to once this failure threshold has been
- reached for the higher priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string
- to an integer priority value indicating preference for which
- regional target a Global load balancer will forward traffic to. A
- lower value indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer
- representing the port on the target backends which the load balancer
- will forward traffic to.
- "target_protocol": "str" # Optional. The protocol
- used for forwarding traffic from the load balancer to the target
- backends. The possible values are ``http``"" , ``https`` and
- ``http2``. Known values are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default
- value is 10. The number of seconds between between two consecutive
- health checks.
- "healthy_threshold": 3, # Optional. Default value is
- 3. The number of times a health check must pass for a backend Droplet
- to be marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The
- path on the backend Droplets to which the load balancer instance will
- send a request.
- "port": 80, # Optional. Default value is 80. An
- integer representing the port on the backend Droplets on which the
- health check will attempt a connection.
- "protocol": "http", # Optional. Default value is
- "http". The protocol used for health checks sent to the backend
- Droplets. The possible values are ``http``"" , ``https``"" , or
- ``tcp``. Known values are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default
- value is 5. The number of seconds the load balancer instance will
- wait for a response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value
- is 5. The number of times a health check must fail for a backend
- Droplet to be marked "unhealthy" and be removed from the pool.
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is
+ on. Always ``true``.
+ "idle_timeout": "str" # Optional. How long the
+ MicroVM is idle before it pauses, as a duration such as ``30s``"" ,
+ ``5m``"" , or ``1h``. Defaults to ``5m``. The maximum is ``4h``.
+ Responses show the duration in the form ``5m0s``.
},
- "http_idle_timeout_seconds": 60, # Optional. Default value
- is 60. An integer value which configures the idle timeout for HTTP
- requests to the target droplets.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the
- public-facing IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load
- balancer instance.
- "network": "EXTERNAL", # Optional. Default value is
- "EXTERNAL". A string indicating whether the load balancer should be
- external or internal. Internal load balancers have no public IPs and are
- only accessible to resources on the same VPC network. This property
- cannot be updated after creating the load balancer. Known values are:
- "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is
- "IPV4". A string indicating whether the load balancer will support IPv4
- or both IPv4 and IPv6 networking. This property cannot be updated after
- creating the load balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that
- the load balancer is associated with. If no ID is provided at creation,
- the load balancer associates with the user's default project. If an
- invalid project ID is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value
- is False. A boolean value indicating whether HTTP requests to the load
- balancer on port 80 will be redirected to HTTPS on port 443.
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
+ "auto_resume": True, # Optional. Default value is True.
+ Whether an HTTP request, command, or console session resumes the MicroVM
+ when it is paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the
+ MicroVM was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed.
+ Present only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the
+ MicroVM's HTTP port serves. ``null`` if the protocol was not set when the
+ MicroVM was created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be
+ unique in the region and contain 1 to 63 lowercase letters, digits, and
+ hyphens.
+ "networking": "public", # Optional. Default value is
+ "public". ``public`` sends outbound traffic through a shared NAT gateway.
+ ``vpc`` places the MicroVM in the VPC network set by ``vpc_uuid``. Known
+ values are: "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the
+ MicroVM, including the HTTP port. During the public preview, only the
+ HTTP port is reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the
+ MicroVM is in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB.
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.
+ "disk": 0 # Optional. The size of the disk, in GB.
+ Set by the size.
},
- "size": "lb-small", # Optional. Default value is "lb-small".
- This field has been replaced by the ``size_unit`` field for all regions
- except in AMS2, NYC2, and SFO1. Each available load balancer size now
- equates to the load balancer having a set number of nodes. *
- ``lb-small`` = 1 node * ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes
- You can resize load balancers after creation up to once per hour. You
- cannot resize a load balancer within the first hour of its creation.
- Known values are: "lb-small", "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many
- nodes the load balancer contains. Each additional node increases the load
- balancer's ability to manage more connections. Load balancers can be
- scaled up or down, and you can change the number of nodes after creation
- up to once per hour. This field is currently not available in the AMS2,
- NYC2, or SFO1 regions. Use the ``size`` field to scale load balancers
- that reside in these regions.
- "status": "str", # Optional. A status string indicating the
- current state of the load balancer. This can be ``new``"" , ``active``""
- , or ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the
- cookie sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of
- seconds until the cookie set by the load balancer expires. This
- attribute is only returned when using ``cookies`` for the sticky
- sessions type.
- "type": "none" # Optional. Default value is "none".
- An attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values
- are ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a
+ checkpoint to create the MicroVM from. The new MicroVM inherits the
+ checkpoint's region, size, container image, and environment
+ variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form
+ ``registry/repository:tag``. The image can be public, such as an
+ image on Docker Hub, or private in your team's DigitalOcean Container
+ Registry.
},
- "subnet_uuid": "str", # Optional. A string specifying the
- UUID of the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag
- corresponding to Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of
- the Regional load balancers to be used as target backends for a
- Global load balancer.
+ "state": "str", # Optional. The MicroVM's current state.
+ Known values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used
- by the load balancer. The possible values are ``DEFAULT`` or ``STRONG``.
- The default value is ``DEFAULT``. Known values are: "DEFAULT" and
- "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL".
- A string indicating whether the load balancer should be a standard
- regional HTTP load balancer, a regional network load balancer that routes
- traffic at the TCP/UDP transport layer, or a global load balancer. Known
- values are: "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID
- of the VPC to which the load balancer is assigned.
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is
+ the endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The
+ endpoint's hostname. Empty until provisioning finishes. Requests
+ to the endpoint must include a DigitalOcean API token with the
+ ``microvm:access`` scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the
+ endpoint serves.
+ "status": "str" # Optional. ``PENDING``
+ until provisioning finishes, then ``ACTIVE``. Known values are:
+ "PENDING" and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the
+ same region that belongs to your team. Present only when ``networking``
+ is ``vpc``.
}
]
}
@@ -175484,9 +181899,12 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_load_balancers_list_request(
- per_page=per_page,
+ _request = build_microvms_list_request(
page=page,
+ per_page=per_page,
+ region=region,
+ name=name,
+ tag_name=tag_name,
headers=_headers,
params=_params,
)
@@ -175528,16 +181946,30 @@ 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, lb_id: str, **kwargs: Any) -> JSON:
+ @overload
+ async def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Load Balancer.
+ """Create a MicroVM.
- To show information about a load balancer instance, send a GET request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``.
+ To create a MicroVM, send a POST request to ``/v2/microvms``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ ``name`` and ``source`` are required. Set ``source.oci_ref`` to create the MicroVM from a
+ ``linux/amd64`` container image, or ``source.checkpoint_id`` to create it from a checkpoint.
+ With ``oci_ref``\\ , ``region`` and ``size`` are also required.
+
+ A MicroVM created from an image is returned with ``state`` set to ``creating``. Poll
+ ``GET /v2/microvms/{microvm_id}`` until ``state`` is ``running``. A MicroVM created from a
+ checkpoint is usually returned already ``running``.
+
+ All settings are fixed at creation. There is no update endpoint.
+
+ :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:
@@ -175545,232 +181977,421 @@ async def get(self, lb_id: 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 = {
+ "name": "str", # The name of the MicroVM. Must be unique in the region and
+ contain 1 to 63 lowercase letters, digits, and hyphens. Required.
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint to create
+ the MicroVM from. The new MicroVM inherits the checkpoint's region, size,
+ container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a ``linux/amd64``
+ container image in the form ``registry/repository:tag``. The image can be
+ public, such as an image on Docker Hub, or private in your team's
+ DigitalOcean Container Registry.
+ },
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on. Always
+ ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is idle
+ before it pauses, as a duration such as ``30s``"" , ``5m``"" , or ``1h``.
+ Defaults to ``5m``. The maximum is ``4h``. Responses show the duration in the
+ form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an HTTP
+ request, command, or console session resumes the MicroVM when it is paused. Set
+ to ``false`` to require a manual resume.
+ "environment": {
+ "str": "str" # Optional. Environment variables passed into the
+ MicroVM at boot, as key and value pairs. Not returned in responses.
+ },
+ "http_port": 8080, # Optional. Default value is 8080. The guest port the
+ workload serves HTTP on. Defaults to ``8080``. Not returned in responses. When
+ creating from a checkpoint without ``ports``"" , must be one of the checkpoint's
+ ports.
+ "http_protocol": "str", # Optional. The protocol the HTTP port serves. Known
+ values are: "http" and "http2".
+ "networking": "public", # Optional. Default value is "public". ``public``
+ sends outbound traffic through a shared NAT gateway. ``vpc`` places the MicroVM
+ in the VPC network set by ``vpc_uuid``. Known values are: "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports to declare, up to five. Must include
+ ``http_port``. Defaults to only the HTTP port. During the public preview,
+ only the HTTP port is reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region to create the MicroVM
+ in. Required with ``source.oci_ref``.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by the size.
+ },
+ "tags": [
+ "str" # Optional. Tags to apply to the MicroVM.
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same region
+ that belongs to your team. Required when ``networking`` is ``vpc``.
+ }
+
+ # response body for status code(s): 201
response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
+ },
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
{
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
}
],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 403
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
+ }
+ """
+
+ @overload
+ async def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a MicroVM.
+
+ To create a MicroVM, send a POST request to ``/v2/microvms``.
+
+ ``name`` and ``source`` are required. Set ``source.oci_ref`` to create the MicroVM from a
+ ``linux/amd64`` container image, or ``source.checkpoint_id`` to create it from a checkpoint.
+ With ``oci_ref``\\ , ``region`` and ``size`` are also required.
+
+ A MicroVM created from an image is returned with ``state`` set to ``creating``. Poll
+ ``GET /v2/microvms/{microvm_id}`` until ``state`` is ``running``. A MicroVM created from a
+ checkpoint is usually returned already ``running``.
+
+ All settings are fixed at creation. There is no update endpoint.
+
+ :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 == {
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
},
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
},
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 403
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
+ }
+ """
+
+ @distributed_trace_async
+ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a MicroVM.
+
+ To create a MicroVM, send a POST request to ``/v2/microvms``.
+
+ ``name`` and ``source`` are required. Set ``source.oci_ref`` to create the MicroVM from a
+ ``linux/amd64`` container image, or ``source.checkpoint_id`` to create it from a checkpoint.
+ With ``oci_ref``\\ , ``region`` and ``size`` are also required.
+
+ A MicroVM created from an image is returned with ``state`` set to ``creating``. Poll
+ ``GET /v2/microvms/{microvm_id}`` until ``state`` is ``running``. A MicroVM created from a
+ checkpoint is usually returned already ``running``.
+
+ All settings are fixed at creation. There is no update endpoint.
+
+ :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", # The name of the MicroVM. Must be unique in the region and
+ contain 1 to 63 lowercase letters, digits, and hyphens. Required.
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint to create
+ the MicroVM from. The new MicroVM inherits the checkpoint's region, size,
+ container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a ``linux/amd64``
+ container image in the form ``registry/repository:tag``. The image can be
+ public, such as an image on Docker Hub, or private in your team's
+ DigitalOcean Container Registry.
+ },
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on. Always
+ ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is idle
+ before it pauses, as a duration such as ``30s``"" , ``5m``"" , or ``1h``.
+ Defaults to ``5m``. The maximum is ``4h``. Responses show the duration in the
+ form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an HTTP
+ request, command, or console session resumes the MicroVM when it is paused. Set
+ to ``false`` to require a manual resume.
+ "environment": {
+ "str": "str" # Optional. Environment variables passed into the
+ MicroVM at boot, as key and value pairs. Not returned in responses.
+ },
+ "http_port": 8080, # Optional. Default value is 8080. The guest port the
+ workload serves HTTP on. Defaults to ``8080``. Not returned in responses. When
+ creating from a checkpoint without ``ports``"" , must be one of the checkpoint's
+ ports.
+ "http_protocol": "str", # Optional. The protocol the HTTP port serves. Known
+ values are: "http" and "http2".
+ "networking": "public", # Optional. Default value is "public". ``public``
+ sends outbound traffic through a shared NAT gateway. ``vpc`` places the MicroVM
+ in the VPC network set by ``vpc_uuid``. Known values are: "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports to declare, up to five. Must include
+ ``http_port``. Defaults to only the HTTP port. During the public preview,
+ only the HTTP port is reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region to create the MicroVM
+ in. Required with ``source.oci_ref``.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by the size.
+ },
+ "tags": [
+ "str" # Optional. Tags to apply to the MicroVM.
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same region
+ that belongs to your team. Required when ``networking`` is ``vpc``.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
},
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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.
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
},
- "size": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
},
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
}
}
- # response body for status code(s): 404
+ # response body for status code(s): 400, 403
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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -175786,13 +182407,26 @@ async def get(self, lb_id: str, **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_load_balancers_get_request(
- lb_id=lb_id,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_microvms_create_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -175807,14 +182441,14 @@ async def get(self, lb_id: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [201, 400, 403]:
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")
)
@@ -175830,7 +182464,23 @@ async def get(self, lb_id: str, **kwargs: Any) -> JSON:
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")
+ )
+ 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 == 403:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -175851,32 +182501,13 @@ async def get(self, lb_id: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
- @overload
- async def update(
- self,
- lb_id: str,
- body: JSON,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Update a Load Balancer.
+ @distributed_trace_async
+ async def get_options(self, **kwargs: Any) -> JSON:
+ """List MicroVM options.
- To update a load balancer's settings, send a PUT request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
- representation of the load balancer including existing attributes. It may
- contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
- exclusive. **Note that any attribute that is not provided will be reset to its
- default value.**.
+ To list the default region, sizes, prices, account limits, and features available to
+ your team, send a GET request to ``/v2/microvms/options``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -175884,518 +182515,130 @@ async def update(
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 == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
+ "account_limits": {
+ "max_disk_bytes": 0, # Optional. The maximum disk per MicroVM, in
+ bytes.
+ "max_idle_timeout_seconds": 0, # Optional. The maximum auto-pause
+ idle timeout, in seconds.
+ "max_memory_bytes": 0, # Optional. The maximum memory per MicroVM,
+ in bytes.
+ "max_total_count": 0 # Optional. The maximum number of MicroVMs,
+ counting both running and paused MicroVMs.
+ },
+ "default_region": "str", # Optional. The slug of the region MicroVMs are
+ created in by default.
+ "features": [
+ {
+ "enabled": bool, # Optional. Whether the feature is enabled.
+ "name": "str" # Optional. The name of the feature.
+ }
+ ],
+ "resource_pricing": {
+ "price_per_gib_bandwidth": 0.0, # Optional. The price per GiB of
+ outbound data transfer.
+ "price_per_gib_memory_hour": 0.0, # Optional. The price per GiB of
+ memory per hour of running time.
+ "price_per_gib_storage_month": 0.0, # Optional. The price per
+ GiB-month of disk and checkpoint storage.
+ "price_per_vcpu_hour": 0.0 # Optional. The price per vCPU per hour
+ of running time.
+ },
+ "sizes": [
+ {
+ "available": bool, # Optional. Whether the size is available
+ on your team's plan.
+ "cpu": 0, # Optional. The number of vCPUs.
+ "disk": 0, # Optional. The size of the disk, in GB.
+ "memory": 0, # Optional. The amount of memory, in MiB.
+ "pricing": {
+ "price_per_hour": 0.0, # Optional. The price per
+ hour of running time, in USD.
+ "price_per_month": 0.0 # Optional. The price for
+ running continuously for a month (730 hours), in USD.
},
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
- }
- # 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.
+ "regions": [
+ "str" # Optional. The slugs of the regions the size
+ is available in.
+ ]
+ }
+ ]
}
"""
+ 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(
- self,
- lb_id: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Update a Load Balancer.
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
- To update a load balancer's settings, send a PUT request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
- representation of the load balancer including existing attributes. It may
- contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
- exclusive. **Note that any attribute that is not provided will be reset to its
- default value.**.
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object
- :rtype: JSON
- :raises ~azure.core.exceptions.HttpResponseError:
+ _request = build_microvms_get_options_request(
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
- Example:
- .. code-block:: python
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
- # response body for status code(s): 200
- response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
- }
- # 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 = 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 update(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> JSON:
+ async def get(self, microvm_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Update a Load Balancer.
+ """Retrieve a MicroVM.
- To update a load balancer's settings, send a PUT request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
- representation of the load balancer including existing attributes. It may
- contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
- exclusive. **Note that any attribute that is not provided will be reset to its
- default value.**.
+ To show information about a MicroVM, send a GET request to ``/v2/microvms/{microvm_id}``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
+ The endpoint is in the ``urls`` entry with ``default`` set to ``true``. Its ``hostname`` is
+ empty
+ and its ``status`` is ``PENDING`` until provisioning finishes.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -176403,235 +182646,86 @@ async def update(
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 == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
},
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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.
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
},
- "size": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
},
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
}
}
# 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -176647,27 +182741,13 @@ async def update(
}
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:
- _json = body
-
- _request = build_load_balancers_update_request(
- lb_id=lb_id,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_microvms_get_request(
+ microvm_id=microvm_id,
headers=_headers,
params=_params,
)
@@ -176727,19 +182807,16 @@ async def update(
return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Delete a Load Balancer.
+ async def delete(self, microvm_id: str, **kwargs: Any) -> Optional[JSON]:
+ """Delete a MicroVM.
- To delete a load balancer instance, disassociating any Droplets assigned to it
- and removing it from your account, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``.
+ To delete a MicroVM and the data on its disk, send a DELETE request to
+ ``/v2/microvms/{microvm_id}``. The MicroVM's checkpoints are not deleted.
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ A successful request returns a ``204 No Content`` status code.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -176749,14 +182826,8 @@ async def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
# 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -176777,8 +182848,8 @@ async def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_load_balancers_delete_request(
- lb_id=lb_id,
+ _request = build_microvms_delete_request(
+ microvm_id=microvm_id,
headers=_headers,
params=_params,
)
@@ -176834,35 +182905,303 @@ async def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
return deserialized # type: ignore
@distributed_trace_async
- async def delete_cache(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
+ async def post_pause(self, microvm_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Global Load Balancer CDN Cache.
+ """Pause a MicroVM.
- To delete a Global load balancer CDN cache, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/cache``.
+ To pause a MicroVM, send a POST request to ``/v2/microvms/{microvm_id}/pause``.
+
+ Pausing suspends the MicroVM's processes and preserves its memory, files, and processes.
+ A paused MicroVM incurs storage charges only. The request returns when the change
+ completes. Pausing a MicroVM that is already paused succeeds. The request returns HTTP 400
+ when the MicroVM is ``creating``\\ , ``terminated``\\ , or ``failed``.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
+ },
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
+ }
+ """
+ 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_microvms_post_pause_request(
+ microvm_id=microvm_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, 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 == 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 == 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 post_resume(self, microvm_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Resume a MicroVM.
+
+ To resume a paused MicroVM, send a POST request to ``/v2/microvms/{microvm_id}/resume``.
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ The request returns when the change completes. Resuming a MicroVM that is already running
+ succeeds. The request returns HTTP 400 when the MicroVM is ``creating``\\ , ``terminated``\\ ,
+ or
+ ``failed``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :return: JSON object or None
- :rtype: JSON or None
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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.
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
+ },
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -176881,10 +183220,10 @@ async def delete_cache(self, lb_id: 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_load_balancers_delete_cache_request(
- lb_id=lb_id,
+ _request = build_microvms_post_resume_request(
+ microvm_id=microvm_id,
headers=_headers,
params=_params,
)
@@ -176899,15 +183238,30 @@ async def delete_cache(self, lb_id: 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, 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 == 204:
+ 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 == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -176918,6 +183272,11 @@ async def delete_cache(self, lb_id: str, **kwargs: Any) -> Optional[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")
@@ -176935,42 +183294,39 @@ async def delete_cache(self, lb_id: 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 add_droplets(
+ async def run_command(
self,
- lb_id: str,
+ microvm_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Droplets to a Load Balancer.
+ ) -> JSON:
+ """Run a command in a MicroVM.
- To assign a Droplet to a load balancer instance, send a POST request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- Individual Droplets can not be added to a load balancer configured with a
- Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
- response from the API.
+ To run a command in a MicroVM's workload container, send a POST request to
+ ``/v2/microvms/{microvm_id}/exec``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ ``argv`` runs directly, not through a shell, with standard input closed. If the MicroVM is
+ paused and auto-resume is on, the request resumes it and waits until it is running.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ A command has 60 seconds to finish. Your team can run 32 commands at once and 60 commands
+ per minute. Rejected requests count toward the per-minute limit.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_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".
:paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -176978,99 +183334,101 @@ async def add_droplets(
# JSON input template you can fill out and use as your body input.
body = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
+ "argv": [
+ "str" # The command and its arguments. Required.
+ ],
+ "cwd": "str" # Optional. The working directory to run the command in.
}
- # 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.
+ "exit_code": 0, # Optional. The command's exit code.
+ "stderr": "str", # Optional. The command's standard error. Bytes that are
+ not valid UTF-8 are replaced.
+ "stdout": "str", # Optional. The command's standard output. Bytes that are
+ not valid UTF-8 are replaced.
+ "truncated": bool # Optional. Present and ``true`` when the output exceeded
+ 4 MiB and was cut off.
+ }
+ # response body for status code(s): 400, 403, 404, 502
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@overload
- async def add_droplets(
+ async def run_command(
self,
- lb_id: str,
+ microvm_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Droplets to a Load Balancer.
+ ) -> JSON:
+ """Run a command in a MicroVM.
- To assign a Droplet to a load balancer instance, send a POST request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- Individual Droplets can not be added to a load balancer configured with a
- Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
- response from the API.
+ To run a command in a MicroVM's workload container, send a POST request to
+ ``/v2/microvms/{microvm_id}/exec``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ ``argv`` runs directly, not through a shell, with standard input closed. If the MicroVM is
+ paused and auto-resume is on, the request resumes it and waits until it is running.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ A command has 60 seconds to finish. Your team can run 32 commands at once and 60 commands
+ per minute. Rejected requests count toward the per-minute limit.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_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".
: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 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.
+ "exit_code": 0, # Optional. The command's exit code.
+ "stderr": "str", # Optional. The command's standard error. Bytes that are
+ not valid UTF-8 are replaced.
+ "stdout": "str", # Optional. The command's standard output. Bytes that are
+ not valid UTF-8 are replaced.
+ "truncated": bool # Optional. Present and ``true`` when the output exceeded
+ 4 MiB and was cut off.
+ }
+ # response body for status code(s): 400, 403, 404, 502
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@distributed_trace_async
- async def add_droplets(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Droplets to a Load Balancer.
+ async def run_command(
+ self, microvm_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ """Run a command in a MicroVM.
- To assign a Droplet to a load balancer instance, send a POST request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- Individual Droplets can not be added to a load balancer configured with a
- Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
- response from the API.
+ To run a command in a MicroVM's workload container, send a POST request to
+ ``/v2/microvms/{microvm_id}/exec``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ ``argv`` runs directly, not through a shell, with standard input closed. If the MicroVM is
+ paused and auto-resume is on, the request resumes it and waits until it is running.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ A command has 60 seconds to finish. Your team can run 32 commands at once and 60 commands
+ per minute. Rejected requests count toward the per-minute limit.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
: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:
@@ -177078,22 +183436,26 @@ async def add_droplets(
# JSON input template you can fill out and use as your body input.
body = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
+ "argv": [
+ "str" # The command and its arguments. Required.
+ ],
+ "cwd": "str" # Optional. The working directory to run the command in.
}
- # 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.
+ "exit_code": 0, # Optional. The command's exit code.
+ "stderr": "str", # Optional. The command's standard error. Bytes that are
+ not valid UTF-8 are replaced.
+ "stdout": "str", # Optional. The command's standard output. Bytes that are
+ not valid UTF-8 are replaced.
+ "truncated": bool # Optional. Present and ``true`` when the output exceeded
+ 4 MiB and was cut off.
+ }
+ # response body for status code(s): 400, 403, 404, 502
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -177115,7 +183477,7 @@ async def add_droplets(
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
@@ -177125,8 +183487,8 @@ async def add_droplets(
else:
_json = body
- _request = build_load_balancers_add_droplets_request(
- lb_id=lb_id,
+ _request = build_microvms_run_command_request(
+ microvm_id=microvm_id,
content_type=content_type,
json=_json,
content=_content,
@@ -177144,15 +183506,14 @@ async def add_droplets(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [200, 400, 403, 404, 502]:
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")
)
@@ -177163,7 +183524,12 @@ async def add_droplets(
"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")
)
@@ -177179,132 +183545,79 @@ async def add_droplets(
else:
deserialized = None
- if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
-
- return deserialized # type: ignore
-
- @overload
- async def remove_droplets(
- self,
- lb_id: str,
- body: JSON,
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Remove Droplets from a Load Balancer.
-
- To remove a Droplet from a load balancer instance, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
-
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
-
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :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 = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
- }
+ if response.status_code == 403:
+ 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 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- @overload
- async def remove_droplets(
- self,
- lb_id: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Remove Droplets from a Load Balancer.
+ 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 remove a Droplet from a load balancer instance, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ if response.status_code == 502:
+ 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")
+ )
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
- :raises ~azure.core.exceptions.HttpResponseError:
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- Example:
- .. code-block:: python
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- # 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.
- }
- """
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace_async
- async def remove_droplets(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ async def get_console(
+ self, microvm_id: str, *, rows: int = 24, cols: int = 80, **kwargs: Any
) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Remove Droplets from a Load Balancer.
-
- To remove a Droplet from a load balancer instance, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
-
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
-
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
+ """Open a console in a MicroVM.
+
+ To open an interactive ``/bin/sh`` console in a MicroVM's workload container, open a
+ WebSocket connection to ``wss://api.digitalocean.com/v2/microvms/{microvm_id}/console``.
+
+ Send the API token in the ``Authorization`` header of the handshake. Browsers cannot set this
+ header, so you cannot open the console from browser JavaScript. The image must include
+ ``/bin/sh``. A MicroVM can have four consoles open at a time. If the MicroVM is paused and
+ auto-resume is on, opening a console resumes it.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
+ :keyword rows: The initial number of terminal rows. Default value is 24.
+ :paramtype rows: int
+ :keyword cols: The initial number of terminal columns. Default value is 80.
+ :paramtype cols: int
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -177312,24 +183625,10 @@ async def remove_droplets(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
- }
-
- # response body for status code(s): 404
+ # response body for status code(s): 403, 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -177345,27 +183644,15 @@ async def remove_droplets(
}
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[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:
- _json = body
-
- _request = build_load_balancers_remove_droplets_request(
- lb_id=lb_id,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_microvms_get_console_request(
+ microvm_id=microvm_id,
+ rows=rows,
+ cols=cols,
headers=_headers,
params=_params,
)
@@ -177380,7 +183667,7 @@ async def remove_droplets(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [101, 403, 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
@@ -177388,7 +183675,18 @@ async def remove_droplets(
deserialized = None
response_headers = {}
- if response.status_code == 204:
+ if response.status_code == 101:
+ 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 == 403:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -177399,6 +183697,11 @@ async def remove_droplets(
"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")
@@ -177420,155 +183723,301 @@ async def remove_droplets(
return deserialized # type: ignore
- @overload
- async def add_forwarding_rules(
+
+class MicrovmCheckpointsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`microvm_checkpoints` 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,
- lb_id: str,
- body: JSON,
*,
- content_type: str = "application/json",
+ page: int = 1,
+ per_page: int = 25,
+ microvm_id: Optional[str] = None,
**kwargs: Any
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Add Forwarding Rules to a Load Balancer.
+ """List checkpoints.
- To add an additional forwarding rule to a load balancer instance, send a POST
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
- of the request, there should be a ``forwarding_rules`` attribute containing an
- array of rules to be added.
-
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ To list your team's checkpoints, newest first, send a GET request to
+ ``/v2/microvms/checkpoints``. To list one MicroVM's checkpoints, add the ``microvm_id`` query
+ parameter.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ :keyword page: Which 'page' of paginated results to return. Default value is 1.
+ :paramtype page: int
+ :keyword per_page: Number of items returned per page. Default value is 25.
+ :paramtype per_page: int
+ :keyword microvm_id: Only return checkpoints taken from this MicroVM. Default value is None.
+ :paramtype microvm_id: 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 = {
- "forwarding_rules": [
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "checkpoints": [
{
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the
+ checkpoint was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the
+ checkpoint's disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the
+ checkpoint's memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM
+ the checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If
+ you do not set one, a name such as ``checkpoint-20260929-143559`` is
+ generated.
+ "region": "str", # Optional. The slug of the checkpoint's
+ region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB.
+ Required.
+ "disk": 0 # Optional. The size of the disk, in GB.
+ Set by the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can
+ create MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``.
+ Known values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
}
- ]
- }
-
- # 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]] = {
+ 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 add_forwarding_rules(
- self,
- lb_id: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Forwarding Rules to a Load Balancer.
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
- To add an additional forwarding rule to a load balancer instance, send a POST
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
- of the request, there should be a ``forwarding_rules`` attribute containing an
- array of rules to be added.
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ _request = build_microvm_checkpoints_list_request(
+ page=page,
+ per_page=per_page,
+ microvm_id=microvm_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ _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, checkpoint_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve a checkpoint.
+
+ To show information about a checkpoint, send a GET request to
+ ``/v2/microvms/checkpoints/{checkpoint_id}``.
+
+ :param checkpoint_id: The unique ID of the checkpoint. Required.
+ :type checkpoint_id: str
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
+ # response body for status code(s): 200
+ response == {
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
# 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
+ 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_microvm_checkpoints_get_request(
+ checkpoint_id=checkpoint_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 add_forwarding_rules(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Forwarding Rules to a Load Balancer.
+ async def delete(self, checkpoint_id: str, **kwargs: Any) -> Optional[JSON]:
+ """Delete a checkpoint.
- To add an additional forwarding rule to a load balancer instance, send a POST
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
- of the request, there should be a ``forwarding_rules`` attribute containing an
- array of rules to be added.
+ To delete a checkpoint, send a DELETE request to ``/v2/microvms/checkpoints/{checkpoint_id}``.
+ You can no longer create MicroVMs from a deleted checkpoint.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The request returns HTTP 400 while the checkpoint is still being captured. A successful
+ request returns a ``204 No Content`` status code.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
+ :param checkpoint_id: The unique ID of the checkpoint. Required.
+ :type checkpoint_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -177576,49 +184025,10 @@ async def add_forwarding_rules(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
- }
- ]
- }
-
- # 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
- 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -177634,27 +184044,13 @@ async def add_forwarding_rules(
}
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[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:
- _json = body
-
- _request = build_load_balancers_add_forwarding_rules_request(
- lb_id=lb_id,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_microvm_checkpoints_delete_request(
+ checkpoint_id=checkpoint_id,
headers=_headers,
params=_params,
)
@@ -177669,7 +184065,7 @@ async def add_forwarding_rules(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [204, 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
@@ -177688,6 +184084,22 @@ async def add_forwarding_rules(
"int", response.headers.get("ratelimit-reset")
)
+ 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")
@@ -177710,35 +184122,32 @@ async def add_forwarding_rules(
return deserialized # type: ignore
@overload
- async def remove_forwarding_rules(
+ async def create(
self,
- lb_id: str,
- body: JSON,
+ microvm_id: str,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Remove Forwarding Rules from a Load Balancer.
+ """Create a checkpoint of a MicroVM.
- To remove forwarding rules from a load balancer instance, send a DELETE
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
- body of the request, there should be a ``forwarding_rules`` attribute containing
- an array of rules to be removed.
+ To create a checkpoint of a running or paused MicroVM, send a POST request to
+ ``/v2/microvms/{microvm_id}/checkpoints``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The capture runs in the background and does not change the MicroVM's state. Poll
+ ``GET /v2/microvms/checkpoints/{checkpoint_id}`` until ``status`` is ``CHECKPOINT_AVAILABLE``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Required.
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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:
@@ -177746,120 +184155,136 @@ async def remove_forwarding_rules(
# JSON input template you can fill out and use as your body input.
body = {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
- }
- ]
+ "name": "str" # Optional. A name for the checkpoint. If you omit it, a name
+ such as ``checkpoint-20260929-143559`` is generated.
}
- # response body for status code(s): 404
+ # response body for status code(s): 201
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.
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@overload
- async def remove_forwarding_rules(
+ async def create(
self,
- lb_id: str,
- body: IO[bytes],
+ microvm_id: str,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Remove Forwarding Rules from a Load Balancer.
+ """Create a checkpoint of a MicroVM.
- To remove forwarding rules from a load balancer instance, send a DELETE
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
- body of the request, there should be a ``forwarding_rules`` attribute containing
- an array of rules to be removed.
+ To create a checkpoint of a running or paused MicroVM, send a POST request to
+ ``/v2/microvms/{microvm_id}/checkpoints``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The capture runs in the background and does not change the MicroVM's state. Poll
+ ``GET /v2/microvms/checkpoints/{checkpoint_id}`` until ``status`` is ``CHECKPOINT_AVAILABLE``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Required.
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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): 404
+ # response body for status code(s): 201
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.
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@distributed_trace_async
- async def remove_forwarding_rules(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
+ async def create(
+ self,
+ microvm_id: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Remove Forwarding Rules from a Load Balancer.
+ """Create a checkpoint of a MicroVM.
- To remove forwarding rules from a load balancer instance, send a DELETE
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
- body of the request, there should be a ``forwarding_rules`` attribute containing
- an array of rules to be removed.
+ To create a checkpoint of a running or paused MicroVM, send a POST request to
+ ``/v2/microvms/{microvm_id}/checkpoints``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The capture runs in the background and does not change the MicroVM's state. Poll
+ ``GET /v2/microvms/checkpoints/{checkpoint_id}`` until ``status`` is ``CHECKPOINT_AVAILABLE``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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:
@@ -177867,47 +184292,43 @@ async def remove_forwarding_rules(
# JSON input template you can fill out and use as your body input.
body = {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
- }
- ]
+ "name": "str" # Optional. A name for the checkpoint. If you omit it, a name
+ such as ``checkpoint-20260929-143559`` is generated.
}
- # response body for status code(s): 404
+ # response body for status code(s): 201
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.
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -177929,7 +184350,7 @@ async def remove_forwarding_rules(
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
@@ -177937,10 +184358,13 @@ async def remove_forwarding_rules(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_load_balancers_remove_forwarding_rules_request(
- lb_id=lb_id,
+ _request = build_microvm_checkpoints_create_request(
+ microvm_id=microvm_id,
content_type=content_type,
json=_json,
content=_content,
@@ -177958,15 +184382,30 @@ async def remove_forwarding_rules(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ 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 == 204:
+ 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 == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -177977,6 +184416,11 @@ async def remove_forwarding_rules(
"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")
@@ -177994,9 +184438,9 @@ async def remove_forwarding_rules(
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
class MonitoringOperations: # pylint: disable=too-many-public-methods
diff --git a/src/pydo/operations/__init__.py b/src/pydo/operations/__init__.py
index 163af5e7..ba9e9863 100644
--- a/src/pydo/operations/__init__.py
+++ b/src/pydo/operations/__init__.py
@@ -38,8 +38,11 @@
from ._operations import ImagesOperations
from ._operations import ImageActionsOperations
from ._operations import InsightsOperations
+from ._operations import SignalsOperations
from ._operations import KubernetesOperations
from ._operations import LoadBalancersOperations
+from ._operations import MicrovmsOperations
+from ._operations import MicrovmCheckpointsOperations
from ._operations import MonitoringOperations
from ._operations import NfsOperations
from ._operations import OrganizationsOperations
@@ -112,8 +115,11 @@
"ImagesOperations",
"ImageActionsOperations",
"InsightsOperations",
+ "SignalsOperations",
"KubernetesOperations",
"LoadBalancersOperations",
+ "MicrovmsOperations",
+ "MicrovmCheckpointsOperations",
"MonitoringOperations",
"NfsOperations",
"OrganizationsOperations",
diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py
index 8ec49bf3..7c45a1f5 100644
--- a/src/pydo/operations/_operations.py
+++ b/src/pydo/operations/_operations.py
@@ -7756,6 +7756,414 @@ def build_insights_post_logs_search_request(region: str, **kwargs: Any) -> HttpR
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+def build_insights_post_traces_search_request( # pylint: disable=name-too-long
+ region: 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, text/plain")
+
+ # Construct URL
+ _url = "/v2/insights/query/{region}/traces/search"
+ path_format_arguments = {
+ "region": _SERIALIZER.url("region", region, "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_insights_get_trace_request(
+ region: str,
+ trace_id: str,
+ *,
+ from_parameter: Optional[str] = None,
+ to: 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, text/plain")
+
+ # Construct URL
+ _url = "/v2/insights/query/{region}/traces/{trace_id}"
+ path_format_arguments = {
+ "region": _SERIALIZER.url("region", region, "str"),
+ "trace_id": _SERIALIZER.url("trace_id", trace_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if from_parameter is not None:
+ _params["from"] = _SERIALIZER.query("from_parameter", from_parameter, "str")
+ if to is not None:
+ _params["to"] = _SERIALIZER.query("to", to, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_insights_post_spans_search_request(region: 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/insights/query/{region}/spans/search"
+ path_format_arguments = {
+ "region": _SERIALIZER.url("region", region, "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_signals_list_consents_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/consent"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_get_consent_request(agent_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/consent/{agent_id}"
+ path_format_arguments = {
+ "agent_id": _SERIALIZER.url("agent_id", agent_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_signals_update_consent_request(agent_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 = "/v1/consent/{agent_id}"
+ path_format_arguments = {
+ "agent_id": _SERIALIZER.url("agent_id", agent_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="PUT", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_list_agent_sessions_request( # pylint: disable=name-too-long
+ agent_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_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 = "/v1/signals/agents/{agent_id}/sessions"
+ path_format_arguments = {
+ "agent_id": _SERIALIZER.url("agent_id", agent_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if limit is not None:
+ _params["limit"] = _SERIALIZER.query(
+ "limit", limit, "int", maximum=100, minimum=1
+ )
+ if after is not None:
+ _params["after"] = _SERIALIZER.query("after", after, "str")
+ if start_time is not None:
+ _params["start_time"] = _SERIALIZER.query("start_time", start_time, "iso-8601")
+ if end_time is not None:
+ _params["end_time"] = _SERIALIZER.query("end_time", end_time, "iso-8601")
+ if signal_type is not None:
+ _params["signal_type"] = _SERIALIZER.query("signal_type", signal_type, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_signals_list_session_dialogues_request( # pylint: disable=name-too-long
+ session_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_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 = "/v1/signals/sessions/{session_id}/dialogues"
+ path_format_arguments = {
+ "session_id": _SERIALIZER.url("session_id", session_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if limit is not None:
+ _params["limit"] = _SERIALIZER.query(
+ "limit", limit, "int", maximum=100, minimum=1
+ )
+ if after is not None:
+ _params["after"] = _SERIALIZER.query("after", after, "str")
+ if start_time is not None:
+ _params["start_time"] = _SERIALIZER.query("start_time", start_time, "iso-8601")
+ if end_time is not None:
+ _params["end_time"] = _SERIALIZER.query("end_time", end_time, "iso-8601")
+ if signal_type is not None:
+ _params["signal_type"] = _SERIALIZER.query("signal_type", signal_type, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_signals_list_exports_request(
+ *, limit: int = 20, after: 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 = "/v1/signals/exports"
+
+ # Construct parameters
+ if limit is not None:
+ _params["limit"] = _SERIALIZER.query(
+ "limit", limit, "int", maximum=100, minimum=1
+ )
+ if after is not None:
+ _params["after"] = _SERIALIZER.query("after", after, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_signals_create_export_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 = "/v1/signals/exports"
+
+ # 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_signals_get_export_options_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports/options"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_get_export_request(export_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports/{export_id}"
+ path_format_arguments = {
+ "export_id": _SERIALIZER.url("export_id", export_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_signals_get_export_download_request( # pylint: disable=name-too-long
+ export_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports/{export_id}/download"
+ path_format_arguments = {
+ "export_id": _SERIALIZER.url("export_id", export_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_signals_list_deletions_request(
+ *, limit: int = 20, after: 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 = "/v1/signals/deletions"
+
+ # Construct parameters
+ if limit is not None:
+ _params["limit"] = _SERIALIZER.query(
+ "limit", limit, "int", maximum=100, minimum=1
+ )
+ if after is not None:
+ _params["after"] = _SERIALIZER.query("after", after, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_signals_create_deletion_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 = "/v1/signals/deletions"
+
+ # 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_signals_get_deletion_request(deletion_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/deletions/{deletion_id}"
+ path_format_arguments = {
+ "deletion_id": _SERIALIZER.url("deletion_id", deletion_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_kubernetes_list_clusters_request(
*, per_page: int = 20, page: int = 1, **kwargs: Any
) -> HttpRequest:
@@ -8702,6 +9110,319 @@ def build_load_balancers_remove_forwarding_rules_request( # pylint: disable=nam
return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
+def build_microvms_list_request(
+ *,
+ page: int = 1,
+ per_page: int = 25,
+ region: Optional[str] = None,
+ name: Optional[str] = None,
+ tag_name: 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/microvms"
+
+ # Construct parameters
+ if page is not None:
+ _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
+ if per_page is not None:
+ _params["per_page"] = _SERIALIZER.query(
+ "per_page", per_page, "int", maximum=200, minimum=1
+ )
+ if region is not None:
+ _params["region"] = _SERIALIZER.query("region", region, "str")
+ if name is not None:
+ _params["name"] = _SERIALIZER.query("name", name, "str")
+ if tag_name is not None:
+ _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_microvms_create_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/microvms"
+
+ # 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_microvms_get_options_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/microvms/options"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_microvms_get_request(microvm_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/microvms/{microvm_id}"
+ path_format_arguments = {
+ "microvm_id": _SERIALIZER.url("microvm_id", microvm_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_microvms_delete_request(microvm_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/microvms/{microvm_id}"
+ path_format_arguments = {
+ "microvm_id": _SERIALIZER.url("microvm_id", microvm_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_microvms_post_pause_request(microvm_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/microvms/{microvm_id}/pause"
+ path_format_arguments = {
+ "microvm_id": _SERIALIZER.url("microvm_id", microvm_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_microvms_post_resume_request(microvm_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/microvms/{microvm_id}/resume"
+ path_format_arguments = {
+ "microvm_id": _SERIALIZER.url("microvm_id", microvm_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_microvms_run_command_request(microvm_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/microvms/{microvm_id}/exec"
+ path_format_arguments = {
+ "microvm_id": _SERIALIZER.url("microvm_id", microvm_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_microvms_get_console_request(
+ microvm_id: str, *, rows: int = 24, cols: int = 80, **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/microvms/{microvm_id}/console"
+ path_format_arguments = {
+ "microvm_id": _SERIALIZER.url("microvm_id", microvm_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if rows is not None:
+ _params["rows"] = _SERIALIZER.query(
+ "rows", rows, "int", maximum=65535, minimum=1
+ )
+ if cols is not None:
+ _params["cols"] = _SERIALIZER.query(
+ "cols", cols, "int", maximum=65535, minimum=1
+ )
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_microvm_checkpoints_list_request(
+ *,
+ page: int = 1,
+ per_page: int = 25,
+ microvm_id: 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/microvms/checkpoints"
+
+ # Construct parameters
+ if page is not None:
+ _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1)
+ if per_page is not None:
+ _params["per_page"] = _SERIALIZER.query(
+ "per_page", per_page, "int", maximum=200, minimum=1
+ )
+ if microvm_id is not None:
+ _params["microvm_id"] = _SERIALIZER.query("microvm_id", microvm_id, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_microvm_checkpoints_get_request(
+ checkpoint_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/microvms/checkpoints/{checkpoint_id}"
+ path_format_arguments = {
+ "checkpoint_id": _SERIALIZER.url("checkpoint_id", checkpoint_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_microvm_checkpoints_delete_request(
+ checkpoint_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/microvms/checkpoints/{checkpoint_id}"
+ path_format_arguments = {
+ "checkpoint_id": _SERIALIZER.url("checkpoint_id", checkpoint_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_microvm_checkpoints_create_request(
+ microvm_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/microvms/{microvm_id}/checkpoints"
+ path_format_arguments = {
+ "microvm_id": _SERIALIZER.url("microvm_id", microvm_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_monitoring_list_alert_policy_request( # pylint: disable=name-too-long
*, per_page: int = 20, page: int = 1, **kwargs: Any
) -> HttpRequest:
@@ -42150,7 +42871,8 @@ def create(
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -58873,7 +59595,8 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -184637,42 +185360,249 @@ def post_logs_search(
return cast(JSON, deserialized) # type: ignore
+ @overload
+ def post_traces_search(
+ self,
+ region: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Union[JSON, str]:
+ # pylint: disable=line-too-long
+ """Search traces.
-class KubernetesOperations: # pylint: disable=too-many-public-methods
- """
- .. warning::
- **DO NOT** instantiate this class directly.
+ To search traces in a region, send a POST request to
+ ``/v2/insights/query/{region}/traces/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ Each result is one trace, aggregated from all of its spans in the time range. A trace is
+ included when at least one of its spans matches ``filter``. The time range must not exceed 7
+ days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is
+ ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless
+ ``orderBy`` is set.
+ JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ ,
+ ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are
+ rejected with ``400``.
+ Each request searches a single region; there is no multi-region search. Supported regions are
+ ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ ,
+ ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ , ``sfo2``\\ , ``sfo3``\\ ,
+ ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60 seconds.
+ Errors produced by the traces service (\\ ``400``\\ ) have a ``text/plain`` body containing a
+ short message. Authentication and authorization errors (\\ ``401``\\ , ``403``\\ ), rate
+ limiting (\\ ``429``\\ ), and routing errors (for example, ``404`` for an unknown region) come
+ from the API gateway and use the standard JSON error object with ``id`` and ``message``.
+ ``403`` is also returned for accounts that are in a trial or not in good standing. If the
+ regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body.
- Instead, you should access the following operations through
- :class:`~pydo.GeneratedClient`'s
- :attr:`kubernetes` attribute.
- """
+ :param region: The datacenter region slug for the query. Required.
+ :type region: 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 or str
+ :rtype: JSON or str
+ :raises ~azure.core.exceptions.HttpResponseError:
- 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")
- )
+ Example:
+ .. code-block:: python
- @distributed_trace
- def list_clusters(
- self, *, per_page: int = 20, page: int = 1, **kwargs: Any
- ) -> JSON:
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ }
+ },
+ "filter": {
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Without ``scope``"" , these
+ names (case-insensitive) resolve to built-in span columns: `traceId`
+ (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId`
+ (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`,
+ `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in
+ nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode`
+ (`status.code`, `status_code`), `statusMessage` (`status.message`,
+ `status_message`), and `serviceName` (`service.name`, `service_name`).
+ Any other name is looked up as a span attribute, falling back to a
+ resource attribute. With `scope` set, `name` is always treated as an
+ attribute key. Attribute keys may contain only letters, digits, and `.`,
+ `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field description.
+ Required.
+ "scope": "str" # Optional. Restricts the lookup to one
+ attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or
+ ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to
+ use the built-in column mapping described for ``name``. Ignored in traces
+ ``orderBy``. Known values are: "resource", "resource.attributes",
+ "attribute", "attributes", and "span.attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Matching is case-insensitive, and the symbol forms
+ ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted
+ as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and
+ ``lte``. ``exists`` matches spans where the field is present and non-empty
+ and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100
+ entries. ``neq`` on string fields also matches spans where the field is
+ absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and
+ "lte".
+ "query": "str", # Optional. The search string for a ``text_search``
+ node. Leading and trailing whitespace is trimmed; the trimmed string must be
+ non-empty.
+ "type": "condition", # Optional. Default value is "condition". The
+ node type. Matching is case-insensitive. Known values are: "condition",
+ "and", "or", "not", and "text_search".
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Without ``scope``""
+ , these names (case-insensitive) resolve to built-in span columns:
+ `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`),
+ `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime`
+ (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs`
+ (`duration`, in nanoseconds), `name` (`span.name`), `kind`
+ (`span.kind`), `statusCode` (`status.code`, `status_code`),
+ `statusMessage` (`status.message`, `status_message`), and
+ `serviceName` (`service.name`, `service_name`). Any other name is
+ looked up as a span attribute, falling back to a resource attribute.
+ With `scope` set, `name` is always treated as an attribute key.
+ Attribute keys may contain only letters, digits, and `.`, `_`, `-`,
+ `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field
+ description. Required.
+ "scope": "str" # Optional. Restricts the lookup to
+ one attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute``
+ (or ``attributes``"" , ``span.attributes``"" ) reads span attributes.
+ Omit to use the built-in column mapping described for ``name``.
+ Ignored in traces ``orderBy``. Known values are: "resource",
+ "resource.attributes", "attribute", "attributes", and
+ "span.attributes".
+ },
+ "direction": "desc" # Optional. Default value is "desc". The
+ sort direction (case-insensitive). Defaults to ``desc``. Known values
+ are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ traces to return. Omitted or ``0`` uses the default of 100. Negative values
+ or values above 1000 return ``400``"" ; they are not clamped.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "traceId": "str", # The trace identifier. Required.
+ "durationNs": 0, # Optional. Wall-clock duration of the
+ trace in nanoseconds.
+ "errorCount": 0, # Optional. The number of spans in the
+ trace with an ``Error`` status code. Omitted when zero.
+ "serviceName": "str", # Optional. The service that emitted
+ the root span. Omitted when the root span has no service.name resource
+ attribute.
+ "spanCount": 0, # Optional. The number of spans in the
+ trace.
+ "spanNames": [
+ "str" # Optional. The distinct span names present in
+ the trace.
+ ],
+ "started": "2020-02-20 00:00:00", # Optional. The start time
+ of the earliest span in the trace, in RFC 3339 format.
+ "status": "str" # Optional. The rolled-up status of the
+ trace. ``Error`` if any span has an ``Error`` status code, otherwise
+ ``Ok``. Known values are: "Ok" and "Error".
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Whether more results matched the query than were
+ returned. Required.
+ }
+ }
+ # response body for status code(s): 403, 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 post_traces_search(
+ self,
+ region: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Union[JSON, str]:
# pylint: disable=line-too-long
- """List All Kubernetes Clusters.
+ """Search traces.
- To list all of the Kubernetes clusters on your account, send a GET request
- to ``/v2/kubernetes/clusters``.
+ To search traces in a region, send a POST request to
+ ``/v2/insights/query/{region}/traces/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ Each result is one trace, aggregated from all of its spans in the time range. A trace is
+ included when at least one of its spans matches ``filter``. The time range must not exceed 7
+ days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is
+ ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless
+ ``orderBy`` is set.
+ JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ ,
+ ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are
+ rejected with ``400``.
+ Each request searches a single region; there is no multi-region search. Supported regions are
+ ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ ,
+ ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ , ``sfo2``\\ , ``sfo3``\\ ,
+ ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60 seconds.
+ Errors produced by the traces service (\\ ``400``\\ ) have a ``text/plain`` body containing a
+ short message. Authentication and authorization errors (\\ ``401``\\ , ``403``\\ ), rate
+ limiting (\\ ``429``\\ ), and routing errors (for example, ``404`` for an unknown region) come
+ from the API gateway and use the standard JSON error object with ``id`` and ``message``.
+ ``403`` is also returned for accounts that are in a trial or not in good standing. If the
+ regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body.
- :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 region: The datacenter region slug for the query. Required.
+ :type region: 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 or str
+ :rtype: JSON or str
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -184680,272 +185610,237 @@ def list_clusters(
# response body for status code(s): 200
response == {
- "meta": {
- "total": 0 # Optional. Number of objects returned by the request.
+ "data": [
+ {
+ "traceId": "str", # The trace identifier. Required.
+ "durationNs": 0, # Optional. Wall-clock duration of the
+ trace in nanoseconds.
+ "errorCount": 0, # Optional. The number of spans in the
+ trace with an ``Error`` status code. Omitted when zero.
+ "serviceName": "str", # Optional. The service that emitted
+ the root span. Omitted when the root span has no service.name resource
+ attribute.
+ "spanCount": 0, # Optional. The number of spans in the
+ trace.
+ "spanNames": [
+ "str" # Optional. The distinct span names present in
+ the trace.
+ ],
+ "started": "2020-02-20 00:00:00", # Optional. The start time
+ of the earliest span in the trace, in RFC 3339 format.
+ "status": "str" # Optional. The rolled-up status of the
+ trace. ``Error`` if any span has an ``Error`` status code, otherwise
+ ``Ok``. Known values are: "Ok" and "Error".
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Whether more results matched the query than were
+ returned. Required.
+ }
+ }
+ # response body for status code(s): 403, 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 post_traces_search(
+ self, region: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Union[JSON, str]:
+ # pylint: disable=line-too-long
+ """Search traces.
+
+ To search traces in a region, send a POST request to
+ ``/v2/insights/query/{region}/traces/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ Each result is one trace, aggregated from all of its spans in the time range. A trace is
+ included when at least one of its spans matches ``filter``. The time range must not exceed 7
+ days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is
+ ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless
+ ``orderBy`` is set.
+ JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ ,
+ ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are
+ rejected with ``400``.
+ Each request searches a single region; there is no multi-region search. Supported regions are
+ ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ ,
+ ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ , ``sfo2``\\ , ``sfo3``\\ ,
+ ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60 seconds.
+ Errors produced by the traces service (\\ ``400``\\ ) have a ``text/plain`` body containing a
+ short message. Authentication and authorization errors (\\ ``401``\\ , ``403``\\ ), rate
+ limiting (\\ ``429``\\ ), and routing errors (for example, ``404`` for an unknown region) come
+ from the API gateway and use the standard JSON error object with ``id`` and ``message``.
+ ``403`` is also returned for accounts that are in a trial or not in good standing. If the
+ regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object or str
+ :rtype: JSON or str
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp, either
+ RFC3339 (with optional fractional seconds) or a Unix epoch integer as a
+ decimal string. Epoch precision is inferred from magnitude: seconds,
+ milliseconds, microseconds, or nanoseconds.
+ "relative": "str" # Optional. A time relative to now. Use
+ ``now`` for the current time, a bare duration such as ``15m`` or ``24h``
+ to look back from now, or an offset such as ``now-2h`` or ``now+30m``.
+ Supported units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``"" ;
+ decimal amounts such as ``1.5h`` are allowed.
+ }
},
- "kubernetes_clusters": [
+ "filter": {
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Without ``scope``"" , these
+ names (case-insensitive) resolve to built-in span columns: `traceId`
+ (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId`
+ (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`,
+ `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in
+ nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode`
+ (`status.code`, `status_code`), `statusMessage` (`status.message`,
+ `status_message`), and `serviceName` (`service.name`, `service_name`).
+ Any other name is looked up as a span attribute, falling back to a
+ resource attribute. With `scope` set, `name` is always treated as an
+ attribute key. Attribute keys may contain only letters, digits, and `.`,
+ `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field description.
+ Required.
+ "scope": "str" # Optional. Restricts the lookup to one
+ attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or
+ ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to
+ use the built-in column mapping described for ``name``. Ignored in traces
+ ``orderBy``. Known values are: "resource", "resource.attributes",
+ "attribute", "attributes", and "span.attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Matching is case-insensitive, and the symbol forms
+ ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted
+ as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and
+ ``lte``. ``exists`` matches spans where the field is present and non-empty
+ and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100
+ entries. ``neq`` on string fields also matches spans where the field is
+ absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and
+ "lte".
+ "query": "str", # Optional. The search string for a ``text_search``
+ node. Leading and trailing whitespace is trimmed; the trimmed string must be
+ non-empty.
+ "type": "condition", # Optional. Default value is "condition". The
+ node type. Matching is case-insensitive. Known values are: "condition",
+ "and", "or", "not", and "text_search".
+ "value": {}
+ },
+ "orderBy": [
{
- "name": "str", # A human-readable name for a Kubernetes
- cluster. Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean
- value indicating whether auto-scaling is enabled for this node
- pool.
- "count": 0, # Optional. The number of
- Droplet instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The
- AMD GPU partition mode for this node pool. Only applicable to AMD
- GPU sizes that support partitioning. Immutable after the node
- pool is created. When omitted, the GPUs in the pool are left
- unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1"
- and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that
- can be used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of
- key/value mappings specifying labels to apply to all nodes in a
- pool. Labels will automatically be applied to all existing nodes
- and any subsequent nodes added to the pool. Note that when a
- label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum
- number of nodes that this node pool can be auto-scaled to. The
- value will be ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum
- number of nodes that this node pool can be auto-scaled to. The
- value will be ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable
- name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20
- 00:00:00", # Optional. A time value given in ISO8601
- combined date and time format that represents when the
- node was created.
- "droplet_id": "str", #
- Optional. The ID of the Droplet used for the worker node.
- "id": "str", # Optional. A
- unique ID that can be used to identify and reference the
- node.
- "name": "str", # Optional.
- An automatically generated, human-readable name for the
- node.
- "status": {
- "state": "str" #
- Optional. A string indicating the current status of
- the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20
- 00:00:00" # Optional. A time value given in ISO8601
- combined date and time format that represents when the
- node was last updated.
- }
- ],
- "size": "str", # Optional. The slug
- identifier for the type of Droplet used as workers in the node
- pool.
- "tags": [
- "str" # Optional. An array
- containing the tags applied to the node pool. All node pools
- are automatically tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional.
- How the node reacts to pods that it won't tolerate.
- Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values
- are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if
- the value of the ``key`` field is "special" and the value
- of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional.
- An arbitrary string. The ``key`` and ``value`` fields of
- the ``taint`` object form a key-value pair. For example,
- if the value of the ``key`` field is "special" and the
- value of the ``value`` field is "gpu", the key value pair
- would be ``special=gpu``.
- }
- ]
- }
- ],
- "region": "str", # The slug identifier for the region where
- the Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"),
- the latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available
- versions. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the
- AMD Device Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the
- AMD GPU Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the
- AMD GPU DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether the cluster will be automatically
- upgraded to new patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used
- by cluster-autoscaler. The autoscaler will apply each expander
- from the provided list to narrow down the selection of node types
- created to scale up, until either a single node type is left, or
- the list of expanders is exhausted. If this flag is unset,
- autoscaler will use its default expander ``random``. Passing an
- empty list ("" *not* ``null``"" ) will unset any previous
- expander customizations. Available expanders: * ``random``"" :
- Randomly selects a node group to scale. * `priority`: Selects the
- node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in
- the least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used
- to customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional.
- Used to customize when cluster autoscaler scales down non-empty nodes
- by setting the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP
- addresses for the overlay network of the Kubernetes cluster in CIDR
- notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public
- addresses (IPv4 or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the
- control plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the
- CoreDNS Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the Kubernetes cluster was created.
- "endpoint": "str", # Optional. The base URL of the API
- server on the Kubernetes master node.
- "ha": False, # Optional. Default value is False. A boolean
- value indicating whether the control plane is run in a highly available
- configuration in the cluster. Highly available control planes incur less
- downtime. The property cannot be disabled. When omitted on create, the
- default is version-dependent; for DOKS 1.36.0 and later, the default is
- true; for earlier versions, the default is false.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the
- Kubernetes master node. This will not be set if high availability is
- configured on the cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is
- False. A boolean value indicating whether worker nodes in the cluster are
- not assigned public IP addresses. When omitted on create, the default
- value is false. When enabled, a NAT gateway must exist in the VPC where
- the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance
- window policy. May be one of ``monday`` through ``sunday``"" , or
- ``any`` to indicate an arbitrary week day. Known values are: "any",
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday",
- and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in
- UTC of the maintenance window policy in 24-hour clock format / HH:MM
- notation (e.g., ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the
- NFS CSI plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Nvidia GPU Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the
- NVIDIA GPU DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the
- RDMA shared device plugin is enabled.
- },
- "registries": [
- "str" # Optional. An array of integrated DOCR
- registries.
- ],
- "registry_enabled": bool, # Optional. A read-only boolean
- value indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable
- IP addresses for services running in the Kubernetes cluster in CIDR
- notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is
- False. Indicates whether SSO authentication is enabled for the
- cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL
- for the identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is
- False. Indicates whether any non-SSO forms of authentication are
- disallowed. Can only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message
- providing additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the
- current status of the cluster. Known values are: "running",
- "provisioning", "degraded", "error", "deleted", "upgrading", and
- "deleting".
+ "field": {
+ "name": "str", # The field name. Without ``scope``""
+ , these names (case-insensitive) resolve to built-in span columns:
+ `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`),
+ `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime`
+ (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs`
+ (`duration`, in nanoseconds), `name` (`span.name`), `kind`
+ (`span.kind`), `statusCode` (`status.code`, `status_code`),
+ `statusMessage` (`status.message`, `status_message`), and
+ `serviceName` (`service.name`, `service_name`). Any other name is
+ looked up as a span attribute, falling back to a resource attribute.
+ With `scope` set, `name` is always treated as an attribute key.
+ Attribute keys may contain only letters, digits, and `.`, `_`, `-`,
+ `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a
+ trace-level sort field instead; see the ``orderBy`` field
+ description. Required.
+ "scope": "str" # Optional. Restricts the lookup to
+ one attribute map (case-insensitive). ``resource`` (or
+ ``resource.attributes``"" ) reads resource attributes; ``attribute``
+ (or ``attributes``"" , ``span.attributes``"" ) reads span attributes.
+ Omit to use the built-in column mapping described for ``name``.
+ Ignored in traces ``orderBy``. Known values are: "resource",
+ "resource.attributes", "attribute", "attributes", and
+ "span.attributes".
},
- "surge_upgrade": False, # Optional. Default value is False.
- A boolean value indicating whether surge upgrade is enabled/disabled for
- the cluster. Surge upgrade makes cluster upgrades fast and reliable by
- bringing up new nodes before destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags applied to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the Kubernetes cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID
- of the VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC
- subnet worker nodes are attached to. When unset, the default subnet for
- the VPC is used.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "direction": "desc" # Optional. Default value is "desc". The
+ sort direction (case-insensitive). Defaults to ``desc``. Known values
+ are: "asc" and "desc".
}
],
- "links": {
- "pages": {}
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ traces to return. Omitted or ``0`` uses the default of 100. Negative values
+ or values above 1000 return ``400``"" ; they are not clamped.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "traceId": "str", # The trace identifier. Required.
+ "durationNs": 0, # Optional. Wall-clock duration of the
+ trace in nanoseconds.
+ "errorCount": 0, # Optional. The number of spans in the
+ trace with an ``Error`` status code. Omitted when zero.
+ "serviceName": "str", # Optional. The service that emitted
+ the root span. Omitted when the root span has no service.name resource
+ attribute.
+ "spanCount": 0, # Optional. The number of spans in the
+ trace.
+ "spanNames": [
+ "str" # Optional. The distinct span names present in
+ the trace.
+ ],
+ "started": "2020-02-20 00:00:00", # Optional. The start time
+ of the earliest span in the trace, in RFC 3339 format.
+ "status": "str" # Optional. The rolled-up status of the
+ trace. ``Error`` if any span has an ``Error`` status code, otherwise
+ ``Ok``. Known values are: "Ok" and "Error".
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Whether more results matched the query than were
+ returned. Required.
}
}
+ # response body for status code(s): 403, 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,
@@ -184960,14 +185855,27 @@ def list_clusters(
}
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[JSON] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[Union[JSON, str]] = kwargs.pop("cls", None)
- _request = build_kubernetes_list_clusters_request(
- 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:
+ _json = body
+
+ _request = build_insights_post_traces_search_request(
+ region=region,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -184982,50 +185890,389 @@ def list_clusters(
response = pipeline_response.http_response
- if response.status_code not in [200]:
+ if response.status_code not in [200, 400, 403, 404, 404, 502]:
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")
+ 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 == 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 == 403:
+ 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 == 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 == 502:
+ 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(Union[JSON, str], deserialized), response_headers) # type: ignore
+
+ return cast(Union[JSON, str], deserialized) # type: ignore
+
+ @distributed_trace
+ def get_trace(
+ self,
+ region: str,
+ trace_id: str,
+ *,
+ from_parameter: Optional[str] = None,
+ to: Optional[str] = None,
+ **kwargs: Any,
+ ) -> Union[JSON, str]:
+ # pylint: disable=line-too-long
+ """Retrieve an existing trace.
+
+ To retrieve a single trace and all of its spans, send a GET request to
+ ``/v2/insights/query/{region}/traces/{trace_id}``.
+ Only spans that started within the lookup window are returned. The window defaults to the last
+ 7 days and can be narrowed with the ``from`` and ``to`` query parameters; it must not exceed 7
+ days, and ``from`` must not be after ``to``. Spans are returned ordered by start time. At most
+ 10,000 spans are returned; ``truncated`` is ``true`` when the trace has more.
+ A trace ID with no spans in the window returns ``404``\\ , as do malformed or uppercase trace
+ IDs. A trace is only resolvable in the region that ingested it; querying another region also
+ returns ``404``.
+ Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ ,
+ ``lon1``\\ , ``mem1``\\ , ``nyc1``\\ , ``nyc2``\\ , ``nyc3``\\ , ``ric1``\\ , ``sfo1``\\ ,
+ ``sfo2``\\ , ``sfo3``\\ , ``sgp1``\\ , ``syd1``\\ , and ``tor1``. Requests time out after 60
+ seconds.
+ Errors produced by the traces service (\\ ``400``\\ , and ``404`` when no trace is found) have
+ a ``text/plain`` body containing a short message. Authentication and authorization errors (\\
+ ``401``\\ , ``403``\\ ), rate limiting (\\ ``429``\\ ), and routing errors (for example,
+ ``404`` for an unknown region) come from the API gateway and use the standard JSON error object
+ with ``id`` and ``message``. ``403`` is also returned for accounts that are in a trial or not
+ in good standing. If the regional traces backend cannot be reached, the response is ``502``
+ with a ``text/plain`` body.
+ JSON field names are camelCase (\\ ``traceId``\\ , ``spanId``\\ , ``startTime``\\ ,
+ ``endTime``\\ , ``durationNs``\\ , ``serviceName``\\ , ``statusCode``\\ , ``parentSpanId``\\ ).
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param trace_id: The OpenTelemetry trace ID to retrieve, as 32 lowercase hexadecimal
+ characters. IDs are matched exactly; an ID with no spans in the lookup window returns ``404``.
+ Malformed or uppercase IDs are not rejected with ``400``\\ ; they also return ``404``.
+ Required.
+ :type trace_id: str
+ :keyword from_parameter: Start of the trace lookup window. Accepts a relative time (\\
+ ``now``\\ , a bare duration such as ``24h`` to look back from now, or ``now-2h``\\ ) or an
+ absolute time (RFC3339, or a Unix epoch integer in seconds, milliseconds, microseconds, or
+ nanoseconds). Defaults to 7 days before now. Default value is None.
+ :paramtype from_parameter: str
+ :keyword to: End of the trace lookup window, in the same formats as ``from``. Defaults to now.
+ Default value is None.
+ :paramtype to: str
+ :return: JSON object or str
+ :rtype: JSON or str
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "spans": [
+ {
+ "spanId": "str", # The span identifier. Required.
+ "traceId": "str", # The trace this span belongs to.
+ Required.
+ "attributes": {
+ "str": "str" # Optional. Span attributes. Omitted
+ when empty.
+ },
+ "durationNs": 0, # Optional. Span duration in nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The OpenTelemetry span kind as a
+ string, for example ``Server``"" , ``Client``"" , or ``Internal``.
+ "name": "str", # Optional. The span name, typically the
+ operation being performed.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for the root span.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The service that emitted
+ the span. Omitted when the span has no service.name resource attribute.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The OpenTelemetry span
+ status code as a string: ``Unset``"" , ``Ok``"" , or ``Error``.
+ "statusMessage": "str" # Optional. The status description.
+ Omitted when empty.
+ }
+ ],
+ "traceId": "str", # Optional. The trace identifier.
+ "truncated": bool # Optional. True when the trace has more spans than were
+ returned in this response. Omitted when false.
+ }
+ # response body for status code(s): 403, 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[Union[JSON, str]] = kwargs.pop("cls", None)
+
+ _request = build_insights_get_trace_request(
+ region=region,
+ trace_id=trace_id,
+ from_parameter=from_parameter,
+ to=to,
+ headers=_headers,
+ params=_params,
)
- response_headers["ratelimit-reset"] = self._deserialize(
- "int", response.headers.get("ratelimit-reset")
+ _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 [200, 400, 403, 404, 404, 502]:
+ 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 == 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 == 403:
+ 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 == 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 == 502:
+ 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, cast(Union[JSON, str], deserialized), response_headers) # type: ignore
- return cast(JSON, deserialized) # type: ignore
+ return cast(Union[JSON, str], deserialized) # type: ignore
@overload
- def create_cluster(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ def post_spans_search(
+ self,
+ region: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Kubernetes Cluster.
-
- To create a new Kubernetes cluster, send a POST request to
- ``/v2/kubernetes/clusters``. The request must contain at least one node pool
- with at least one worker.
+ """Search spans.
- The request may contain a maintenance window policy describing a time period
- when disruptive maintenance tasks may be carried out. Omitting the policy
- implies that a window will be chosen automatically. See
- `here `_
- for details.
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -185040,505 +186287,802 @@ def create_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A human-readable name for a Kubernetes cluster. Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value indicating
- whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in
- the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes that
- support partitioning. Immutable after the node pool is created. When
- omitted, the GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings
- specifying labels to apply to all nodes in a pool. Labels will
- automatically be applied to all existing nodes and any subsequent nodes
- added to the pool. Note that when a label is removed, it is not deleted
- from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for the
- node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was created.
- "droplet_id": "str", # Optional. The ID of
- the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that
- can be used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type
- of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags
- applied to the node pool. All node pools are automatically tagged
- ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node
- reacts to pods that it won't tolerate. Available effect values
- are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- "value": "str" # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- }
- ]
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
}
- ],
- "region": "str", # The slug identifier for the region where the Kubernetes
- cluster is located. Required.
- "version": "str", # The slug identifier for the version of Kubernetes used
- for the cluster. If set to a minor version (e.g. "1.14"), the latest version
- within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
- published version will be used. See the ``/v2/kubernetes/options`` endpoint to
- find all currently available versions. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
},
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for the
- overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
- node. This will not be set if high availability is configured on the cluster
- (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A boolean
- value indicating whether worker nodes in the cluster are not assigned public IP
- addresses. When omitted on create, the default value is false. When enabled, a
- NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value indicating
- if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP addresses
- for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current status of
- the cluster. Known values are: "running", "provisioning", "degraded",
- "error", "deleted", "upgrading", and "deleting".
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
},
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags to apply to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
- ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
- removed.
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
- which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
- ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
- worker nodes to. When omitted on create, the default subnet for the VPC is used.
- This value cannot be changed after the cluster is created. ``vpc_uuid`` must
- also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
}
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
- ],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 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 post_spans_search(
+ self,
+ region: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: 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:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 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 post_spans_search(
+ self, region: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: 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 = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
},
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ }
+ },
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
}
}
+ # response body for status code(s): 400, 403, 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:
+ _json = body
+
+ _request = build_insights_post_spans_search_request(
+ region=region,
+ 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, 400, 403, 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 == 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 == 403:
+ 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 SignalsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`signals` 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_consents(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Consent Records.
+
+ To list all signals consent records for your team, send a GET request to
+ ``/v1/consent``. Each record indicates whether signals collection is enabled
+ for a specific agent.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "consents": [
+ {
+ "agent_id": "str", # The unique identifier of the agent. For
+ Harness Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for
+ this agent. Required.
+ "id": 0, # The unique numeric identifier for the consent
+ record. Required.
+ "team_id": 0, # The team ID that owns this consent record.
+ Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in
+ ISO8601 combined date and time format. Required.
+ }
+ ]
+ }
+ """
+ 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_signals_list_consents_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_consent(self, agent_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Consent for an Agent.
+
+ To retrieve the consent record for a specific agent, send a GET
+ request to ``/v1/consent/{agent_id}``. The response includes an ``allowed``
+ field indicating whether the team is permitted to use signals for this agent.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "allowed": bool, # Whether the team is permitted to use signals for this
+ agent. This is determined by the platform and cannot be set by the user.
+ Required.
+ "enabled": bool, # Whether signals collection is enabled for this agent.
+ Required.
+ "id": 0, # The unique numeric identifier for the consent record. Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601 combined
+ date and time format. 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_signals_get_consent_request(
+ agent_id=agent_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 create_cluster(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ def update_consent(
+ self,
+ agent_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Create a New Kubernetes Cluster.
+ """Update Consent for an Agent.
- To create a new Kubernetes cluster, send a POST request to
- ``/v2/kubernetes/clusters``. The request must contain at least one node pool
- with at least one worker.
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
- The request may contain a maintenance window policy describing a time period
- when disruptive maintenance tasks may be carried out. Omitting the policy
- implies that a window will be chosen automatically. See
- `here `_
- for details.
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_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".
+ :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 = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. 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 update_consent(
+ self,
+ agent_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -185551,274 +187095,6407 @@ def create_cluster(
Example:
.. code-block:: python
- # response body for status code(s): 201
+ # response body for status code(s): 200
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
- ],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
- "tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
- ],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. 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 update_consent(
+ self, agent_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_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
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. 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 = 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_signals_update_consent_request(
+ agent_id=agent_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
+
+ @distributed_trace
+ def list_agent_sessions(
+ self,
+ agent_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Sessions for an Agent.
+
+ To list signals sessions for a specific agent, send a GET request to
+ ``/v1/signals/agents/{agent_id}/sessions``. Results are paginated using cursor-based
+ pagination with ``limit`` and ``after`` parameters.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "session_id": "str", # The unique identifier for the
+ session. Required.
+ "duration_seconds": 0.0, # Optional. The duration of
+ the session in seconds.
+ "signal_count": 0, # Optional. The number of signals
+ detected in this session.
+ "started_at": "2020-02-20 00:00:00", # Optional.
+ When the session started.
+ "total_turns": 0 # Optional. The total number of
+ conversation turns in this session.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # 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_signals_list_agent_sessions_request(
+ agent_id=agent_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_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 list_session_dialogues(
+ self,
+ session_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Dialogues for a Session.
+
+ To list the dialogue turns within a specific session, send a GET request to
+ ``/v1/signals/sessions/{session_id}/dialogues``. Each dialogue represents a
+ single turn of conversation between a user and the agent, along with
+ any signals detected. Results are paginated using cursor-based pagination.
+
+ :param session_id: A unique identifier for a signals session. Required.
+ :type session_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "id": "str", # The unique identifier for the
+ dialogue. Required.
+ "run_status": "str", # Optional. The execution
+ status of this dialogue turn.
+ "sequence": 0, # Optional. The sequence number of
+ this dialogue within the session.
+ "signals": [
+ "str" # Optional. A list of signal types
+ detected in this dialogue.
+ ],
+ "user_message": "str" # Optional. The user's message
+ in this dialogue turn.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # 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_signals_list_session_dialogues_request(
+ session_id=session_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_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 list_exports(
+ self, *, limit: int = 20, after: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Export Jobs.
+
+ To list signals export jobs for your team, send a GET request to
+ ``/v1/signals/exports``. Results are paginated using cursor-based pagination
+ with ``limit`` and ``after`` parameters.
+
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "agent_id": "str", # The agent whose data is being
+ exported. For Harness Runtime, this is the Environment Config ID.
+ Required.
+ "created_at": 0, # Unix timestamp when the export
+ was created. Required.
+ "export_id": "str", # The unique identifier for the
+ export job. Required.
+ "status": "str", # The current status of the export
+ job. Required. Known values are: "pending", "processing", "complete",
+ and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when
+ the export completed, or null if still in progress.
+ "error_message": "str", # Optional. Error message if
+ the export failed, or null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the
+ export download link expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session
+ IDs included in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types
+ included in the export.
+ ]
+ }
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ """
+ 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_signals_list_exports_request(
+ limit=limit,
+ after=after,
+ 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_export(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :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 = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 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_export(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :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 == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 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_export(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :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 = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 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,
+ 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_signals_create_export_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, 400, 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:
+ 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 == 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 == 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 get_export_options(self, **kwargs: Any) -> JSON:
+ """Get Export Options.
+
+ To retrieve the available filter options for creating an export, send a GET
+ request to ``/v1/signals/exports/options``. The response lists valid signal
+ types that can be used in the ``signal_type`` filter when creating an export.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "filters": {
+ "signal_type": [
+ "str" # The list of valid signal type values that can be
+ used when creating an export. Required.
+ ]
+ }
+ }
+ """
+ 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_signals_get_export_options_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_export(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Export Job.
+
+ To retrieve the status and details of a signals export job, send a GET
+ request to ``/v1/signals/exports/{export_id}``.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # 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_signals_get_export_request(
+ export_id=export_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def get_export_download(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Get Export Download URL.
+
+ To retrieve a pre-signed download URL for a completed export, send a GET
+ request to ``/v1/signals/exports/{export_id}/download``. The export must have
+ a ``complete`` status. The URL is temporary and will expire.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "download_url": "str", # A temporary pre-signed URL to download the export
+ archive. Required.
+ "expires_at": 0 # Unix timestamp when the download URL expires. The URL is
+ valid for 15 minutes. 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_signals_get_export_download_request(
+ export_id=export_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def list_deletions(
+ self, *, limit: int = 20, after: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Data Deletion Jobs.
+
+ To list signals data deletion jobs for your team, newest first, send a GET
+ request to ``/v1/signals/deletions``. Results are paginated using
+ cursor-based pagination with ``limit`` and ``after`` parameters.
+
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "created_at": 0, # Unix timestamp when the deletion
+ job was created. Required.
+ "deletion_id": "str", # The unique identifier for
+ the deletion job (ULID). Required.
+ "status": "str", # The current status of the
+ deletion job. Required. Known values are: "queued", "running",
+ "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job.
+ Required.
+ "type": "str", # The scope of the deletion.
+ ``agent`` deletes data for one agent. ``inference`` deletes data for
+ the team's Serverless Inference requests. Required. Known values are:
+ "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data
+ is being deleted. For Harness Runtime, this is the Environment Config
+ ID. Only present for ``agent`` deletions.
+ "completed_at": 0, # Optional. Unix timestamp when
+ the deletion finished, or null if still in progress.
+ "error_message": "str", # Optional. Error message if
+ the deletion failed, or null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when
+ processing started, or null if still queued.
+ }
+ }
+ ],
+ "page_info": {
+ "end_cursor": "str", # Optional. Cursor of the last item. Pass as
+ ``after`` to fetch the next page. Present only when there are more results.
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # response body for status code(s): 400
+ 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_signals_list_deletions_request(
+ limit=limit,
+ after=after,
+ 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, 400]:
+ 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 == 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 cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ def create_deletion(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Data Deletion Job.
+
+ To permanently delete signals data, send a POST request to
+ ``/v1/signals/deletions``.
+
+ Two deletion types are supported:
+
+
+ * ``agent`` — deletes sessions, dialogues, and signal reports for one agent.
+ Requires ``agent_id``. The agent's data is hidden immediately and signals
+ collection is disabled for the agent, even if the job later fails. Wait
+ until the job is complete before enabling signals for the agent again.
+ * ``inference`` — deletes sessions, dialogues, and signal reports for the
+ team's Serverless Inference requests made before the deletion. Signals
+ continues to analyze new requests.
+
+ Deletion is permanent and cannot be undone. The job runs asynchronously;
+ poll the get endpoint to check status. To retry a failed job, send the same
+ request again. Export files created earlier are not deleted and remain
+ available until they expire.
+
+ The endpoint is idempotent: if a queued or running job already exists for
+ the same target, it is returned with ``200 OK``. A new job returns
+ ``202 Accepted``. Each team can have a limited number of active jobs;
+ requests beyond that limit return ``429 Too Many Requests``.
+
+ :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 = {
+ "team_id": 0, # The team whose data should be deleted. Must match the
+ authenticated team. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent and requires ``agent_id``. ``inference`` deletes data for the team's
+ Serverless Inference requests. Required. Known values are: "agent" and
+ "inference".
+ "agent_id": "str" # Optional. The agent whose data should be deleted. For
+ Harness Runtime, this is the Environment Config ID. Required when ``type`` is
+ ``agent``"" ; must be omitted when ``type`` is ``inference``.
+ }
+
+ # response body for status code(s): 200, 202
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # response body for status code(s): 400, 403, 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_deletion(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Data Deletion Job.
+
+ To permanently delete signals data, send a POST request to
+ ``/v1/signals/deletions``.
+
+ Two deletion types are supported:
+
+
+ * ``agent`` — deletes sessions, dialogues, and signal reports for one agent.
+ Requires ``agent_id``. The agent's data is hidden immediately and signals
+ collection is disabled for the agent, even if the job later fails. Wait
+ until the job is complete before enabling signals for the agent again.
+ * ``inference`` — deletes sessions, dialogues, and signal reports for the
+ team's Serverless Inference requests made before the deletion. Signals
+ continues to analyze new requests.
+
+ Deletion is permanent and cannot be undone. The job runs asynchronously;
+ poll the get endpoint to check status. To retry a failed job, send the same
+ request again. Export files created earlier are not deleted and remain
+ available until they expire.
+
+ The endpoint is idempotent: if a queued or running job already exists for
+ the same target, it is returned with ``200 OK``. A new job returns
+ ``202 Accepted``. Each team can have a limited number of active jobs;
+ requests beyond that limit return ``429 Too Many Requests``.
+
+ :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): 200, 202
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # response body for status code(s): 400, 403, 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_deletion(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a Data Deletion Job.
+
+ To permanently delete signals data, send a POST request to
+ ``/v1/signals/deletions``.
+
+ Two deletion types are supported:
+
+
+ * ``agent`` — deletes sessions, dialogues, and signal reports for one agent.
+ Requires ``agent_id``. The agent's data is hidden immediately and signals
+ collection is disabled for the agent, even if the job later fails. Wait
+ until the job is complete before enabling signals for the agent again.
+ * ``inference`` — deletes sessions, dialogues, and signal reports for the
+ team's Serverless Inference requests made before the deletion. Signals
+ continues to analyze new requests.
+
+ Deletion is permanent and cannot be undone. The job runs asynchronously;
+ poll the get endpoint to check status. To retry a failed job, send the same
+ request again. Export files created earlier are not deleted and remain
+ available until they expire.
+
+ The endpoint is idempotent: if a queued or running job already exists for
+ the same target, it is returned with ``200 OK``. A new job returns
+ ``202 Accepted``. Each team can have a limited number of active jobs;
+ requests beyond that limit return ``429 Too Many Requests``.
+
+ :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 = {
+ "team_id": 0, # The team whose data should be deleted. Must match the
+ authenticated team. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent and requires ``agent_id``. ``inference`` deletes data for the team's
+ Serverless Inference requests. Required. Known values are: "agent" and
+ "inference".
+ "agent_id": "str" # Optional. The agent whose data should be deleted. For
+ Harness Runtime, this is the Environment Config ID. Required when ``type`` is
+ ``agent``"" ; must be omitted when ``type`` is ``inference``.
+ }
+
+ # response body for status code(s): 200, 202
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # response body for status code(s): 400, 403, 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:
+ _json = body
+
+ _request = build_signals_create_deletion_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, 202, 400, 403, 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 == 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 == 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 == 403:
+ 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_deletion(self, deletion_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve a Data Deletion Job.
+
+ To retrieve the status of a signals data deletion job, send a GET request
+ to ``/v1/signals/deletions/{deletion_id}``.
+
+ :param deletion_id: A unique identifier for a data deletion job. Required.
+ :type deletion_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "created_at": 0, # Unix timestamp when the deletion job was created.
+ Required.
+ "deletion_id": "str", # The unique identifier for the deletion job (ULID).
+ Required.
+ "status": "str", # The current status of the deletion job. Required. Known
+ values are: "queued", "running", "complete", and "failed".
+ "team_id": 0, # The team that owns the deletion job. Required.
+ "type": "str", # The scope of the deletion. ``agent`` deletes data for one
+ agent. ``inference`` deletes data for the team's Serverless Inference requests.
+ Required. Known values are: "agent" and "inference".
+ "agent_id": "str", # Optional. The agent whose data is being deleted. For
+ Harness Runtime, this is the Environment Config ID. Only present for ``agent``
+ deletions.
+ "completed_at": 0, # Optional. Unix timestamp when the deletion finished, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the deletion failed, or
+ null otherwise.
+ "started_at": 0 # Optional. Unix timestamp when processing started, or null
+ if still queued.
+ }
+ # 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_signals_get_deletion_request(
+ deletion_id=deletion_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
+
+
+class KubernetesOperations: # pylint: disable=too-many-public-methods
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`kubernetes` 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_clusters(
+ self, *, per_page: int = 20, page: int = 1, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Kubernetes Clusters.
+
+ To list all of the Kubernetes clusters on your account, send a GET request
+ to ``/v2/kubernetes/clusters``.
+
+ :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.
+ },
+ "kubernetes_clusters": [
+ {
+ "name": "str", # A human-readable name for a Kubernetes
+ cluster. Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean
+ value indicating whether auto-scaling is enabled for this node
+ pool.
+ "count": 0, # Optional. The number of
+ Droplet instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The
+ AMD GPU partition mode for this node pool. Only applicable to AMD
+ GPU sizes that support partitioning. Immutable after the node
+ pool is created. When omitted, the GPUs in the pool are left
+ unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1"
+ and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that
+ can be used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of
+ key/value mappings specifying labels to apply to all nodes in a
+ pool. Labels will automatically be applied to all existing nodes
+ and any subsequent nodes added to the pool. Note that when a
+ label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum
+ number of nodes that this node pool can be auto-scaled to. The
+ value will be ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum
+ number of nodes that this node pool can be auto-scaled to. The
+ value will be ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable
+ name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20
+ 00:00:00", # Optional. A time value given in ISO8601
+ combined date and time format that represents when the
+ node was created.
+ "droplet_id": "str", #
+ Optional. The ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A
+ unique ID that can be used to identify and reference the
+ node.
+ "name": "str", # Optional.
+ An automatically generated, human-readable name for the
+ node.
+ "status": {
+ "state": "str" #
+ Optional. A string indicating the current status of
+ the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20
+ 00:00:00" # Optional. A time value given in ISO8601
+ combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug
+ identifier for the type of Droplet used as workers in the node
+ pool.
+ "tags": [
+ "str" # Optional. An array
+ containing the tags applied to the node pool. All node pools
+ are automatically tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional.
+ How the node reacts to pods that it won't tolerate.
+ Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values
+ are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if
+ the value of the ``key`` field is "special" and the value
+ of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional.
+ An arbitrary string. The ``key`` and ``value`` fields of
+ the ``taint`` object form a key-value pair. For example,
+ if the value of the ``key`` field is "special" and the
+ value of the ``value`` field is "gpu", the key value pair
+ would be ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where
+ the Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"),
+ the latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available
+ versions. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ AMD Device Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ AMD GPU Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the
+ AMD GPU DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether the cluster will be automatically
+ upgraded to new patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used
+ by cluster-autoscaler. The autoscaler will apply each expander
+ from the provided list to narrow down the selection of node types
+ created to scale up, until either a single node type is left, or
+ the list of expanders is exhausted. If this flag is unset,
+ autoscaler will use its default expander ``random``. Passing an
+ empty list ("" *not* ``null``"" ) will unset any previous
+ expander customizations. Available expanders: * ``random``"" :
+ Randomly selects a node group to scale. * `priority`: Selects the
+ node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in
+ the least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used
+ to customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional.
+ Used to customize when cluster autoscaler scales down non-empty nodes
+ by setting the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP
+ addresses for the overlay network of the Kubernetes cluster in CIDR
+ notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public
+ addresses (IPv4 or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the
+ control plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the
+ CoreDNS Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the Kubernetes cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API
+ server on the Kubernetes master node.
+ "ha": False, # Optional. Default value is False. A boolean
+ value indicating whether the control plane is run in a highly available
+ configuration in the cluster. Highly available control planes incur less
+ downtime. The property cannot be disabled. When omitted on create, the
+ default is version-dependent; for DOKS 1.36.0 and later, the default is
+ true; for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the
+ Kubernetes master node. This will not be set if high availability is
+ configured on the cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is
+ False. A boolean value indicating whether worker nodes in the cluster are
+ not assigned public IP addresses. When omitted on create, the default
+ value is false. When enabled, a NAT gateway must exist in the VPC where
+ the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance
+ window policy. May be one of ``monday`` through ``sunday``"" , or
+ ``any`` to indicate an arbitrary week day. Known values are: "any",
+ "monday", "tuesday", "wednesday", "thursday", "friday", "saturday",
+ and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in
+ UTC of the maintenance window policy in 24-hour clock format / HH:MM
+ notation (e.g., ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ NFS CSI plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Nvidia GPU Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the
+ NVIDIA GPU DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ RDMA shared device plugin is enabled.
+ },
+ "registries": [
+ "str" # Optional. An array of integrated DOCR
+ registries.
+ ],
+ "registry_enabled": bool, # Optional. A read-only boolean
+ value indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable
+ IP addresses for services running in the Kubernetes cluster in CIDR
+ notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is
+ False. Indicates whether SSO authentication is enabled for the
+ cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL
+ for the identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is
+ False. Indicates whether any non-SSO forms of authentication are
+ disallowed. Can only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message
+ providing additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the
+ current status of the cluster. Known values are: "running",
+ "provisioning", "degraded", "error", "deleted", "upgrading", and
+ "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False.
+ A boolean value indicating whether surge upgrade is enabled/disabled for
+ the cluster. Surge upgrade makes cluster upgrades fast and reliable by
+ bringing up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the Kubernetes cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID
+ of the VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC
+ subnet worker nodes are attached to. When unset, the default subnet for
+ the VPC is used.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ }
+ ],
+ "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_kubernetes_list_clusters_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_cluster(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Kubernetes Cluster.
+
+ To create a new Kubernetes cluster, send a POST request to
+ ``/v2/kubernetes/clusters``. The request must contain at least one node pool
+ with at least one worker.
+
+ The request may contain a maintenance window policy describing a time period
+ when disruptive maintenance tasks may be carried out. Omitting the policy
+ implies that a window will be chosen automatically. See
+ `here `_
+ for details.
+
+ :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 = {
+ "name": "str", # A human-readable name for a Kubernetes cluster. Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value indicating
+ whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in
+ the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes that
+ support partitioning. Immutable after the node pool is created. When
+ omitted, the GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings
+ specifying labels to apply to all nodes in a pool. Labels will
+ automatically be applied to all existing nodes and any subsequent nodes
+ added to the pool. Note that when a label is removed, it is not deleted
+ from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for the
+ node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of
+ the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that
+ can be used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type
+ of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags
+ applied to the node pool. All node pools are automatically tagged
+ ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node
+ reacts to pods that it won't tolerate. Available effect values
+ are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the Kubernetes
+ cluster is located. Required.
+ "version": "str", # The slug identifier for the version of Kubernetes used
+ for the cluster. If set to a minor version (e.g. "1.14"), the latest version
+ within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
+ published version will be used. See the ``/v2/kubernetes/options`` endpoint to
+ find all currently available versions. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for the
+ overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
+ node. This will not be set if high availability is configured on the cluster
+ (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A boolean
+ value indicating whether worker nodes in the cluster are not assigned public IP
+ addresses. When omitted on create, the default value is false. When enabled, a
+ NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value indicating
+ if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP addresses
+ for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current status of
+ the cluster. Known values are: "running", "provisioning", "degraded",
+ "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
+ ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
+ removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
+ which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
+ ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
+ worker nodes to. When omitted on create, the default subnet for the VPC is used.
+ This value cannot be changed after the cluster is created. ``vpc_uuid`` must
+ also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
+ scope.
+ }
+ }
+ """
+
+ @overload
+ def create_cluster(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Kubernetes Cluster.
+
+ To create a new Kubernetes cluster, send a POST request to
+ ``/v2/kubernetes/clusters``. The request must contain at least one node pool
+ with at least one worker.
+
+ The request may contain a maintenance window policy describing a time period
+ when disruptive maintenance tasks may be carried out. Omitting the policy
+ implies that a window will be chosen automatically. See
+ `here `_
+ for details.
+
+ :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 == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
+ scope.
+ }
+ }
+ """
+
+ @distributed_trace
+ def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a New Kubernetes Cluster.
+
+ To create a new Kubernetes cluster, send a POST request to
+ ``/v2/kubernetes/clusters``. The request must contain at least one node pool
+ with at least one worker.
+
+ The request may contain a maintenance window policy describing a time period
+ when disruptive maintenance tasks may be carried out. Omitting the policy
+ implies that a window will be chosen automatically. See
+ `here `_
+ for details.
+
+ :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 human-readable name for a Kubernetes cluster. Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value indicating
+ whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in
+ the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes that
+ support partitioning. Immutable after the node pool is created. When
+ omitted, the GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings
+ specifying labels to apply to all nodes in a pool. Labels will
+ automatically be applied to all existing nodes and any subsequent nodes
+ added to the pool. Note that when a label is removed, it is not deleted
+ from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that
+ this node pool can be auto-scaled to. The value will be ``0`` if
+ ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for the
+ node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of
+ the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that
+ can be used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" #
+ Optional. A time value given in ISO8601 combined date and time
+ format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type
+ of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags
+ applied to the node pool. All node pools are automatically tagged
+ ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node
+ reacts to pods that it won't tolerate. Available effect values
+ are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary
+ string. The ``key`` and ``value`` fields of the ``taint`` object
+ form a key-value pair. For example, if the value of the ``key``
+ field is "special" and the value of the ``value`` field is "gpu",
+ the key value pair would be ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the Kubernetes
+ cluster is located. Required.
+ "version": "str", # The slug identifier for the version of Kubernetes used
+ for the cluster. If set to a minor version (e.g. "1.14"), the latest version
+ within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
+ published version will be used. See the ``/v2/kubernetes/options`` endpoint to
+ find all currently available versions. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for the
+ overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
+ node. This will not be set if high availability is configured on the cluster
+ (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A boolean
+ value indicating whether worker nodes in the cluster are not assigned public IP
+ addresses. When omitted on create, the default value is false. When enabled, a
+ NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value indicating
+ if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP addresses
+ for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current status of
+ the cluster. Known values are: "running", "provisioning", "degraded",
+ "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
+ ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
+ removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the Kubernetes cluster
+ was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
+ which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
+ ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
+ worker nodes to. When omitted on create, the default subnet for the VPC is used.
+ This value cannot be changed after the cluster is created. ``vpc_uuid`` must
+ also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
+ scope.
+ }
+ }
+ """
+ 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_kubernetes_create_cluster_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_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Existing Kubernetes Cluster.
+
+ To show information about an existing Kubernetes cluster, send a GET request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": False, # Optional. Default value is False. A boolean value
+ indicating whether the control plane is run in a highly available
+ configuration in the cluster. Highly available control planes incur less
+ downtime. The property cannot be disabled. When omitted on create, the
+ default is version-dependent; for DOKS 1.36.0 and later, the default is true;
+ for earlier versions, the default is false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registries": [
+ "str" # Optional. An array of integrated DOCR registries.
+ ],
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ worker nodes are attached to. When unset, the default subnet for the VPC is
+ used.:code:`
`: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_kubernetes_get_cluster_request(
+ cluster_id=cluster_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 update_cluster(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Kubernetes Cluster.
+
+ To update a Kubernetes cluster, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
+ attributes below.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "name": "str", # A human-readable name for a Kubernetes cluster. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`: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.
+ }
+ """
+
+ @overload
+ def update_cluster(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Kubernetes Cluster.
+
+ To update a Kubernetes cluster, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
+ attributes below.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`: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.
+ }
+ """
+
+ @distributed_trace
+ def update_cluster(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update a Kubernetes Cluster.
+
+ To update a Kubernetes cluster, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
+ attributes below.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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
+ :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 human-readable name for a Kubernetes cluster. Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device Metrics
+ Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU Device
+ Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
+ is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether the cluster will be automatically upgraded to new patch
+ releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to scale
+ up, until either a single node type is left, or the list of expanders is
+ exhausted. If this flag is unset, autoscaler will use its default
+ expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
+ unset any previous expander customizations. Available expanders: *
+ ``random``"" : Randomly selects a node group to scale. * `priority`:
+ Selects the node group with the highest priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to customize how
+ long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting the
+ node utilization threshold.
+ },
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4 or
+ CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control plane
+ firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
+ Proportional Autoscaler add-on is enabled.
+ },
+ "ha": bool, # Optional. A boolean value indicating whether the control plane
+ is run in a highly available configuration in the cluster. Highly available
+ control planes incur less downtime. The property cannot be disabled. When omitted
+ on create, the default is version-dependent; for DOKS 1.36.0 and later, the
+ default is true; for earlier versions, the default is false.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window policy.
+ May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
+ arbitrary week day. Known values are: "any", "monday", "tuesday",
+ "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the maintenance
+ window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
+ enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
+ Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
+ Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
+ registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA shared device
+ plugin is enabled.
+ },
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the routing-agent
+ component is enabled.
+ },
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID registered with
+ the identity provider. Required when ``enabled`` is ``true``.
+ "enabled": False, # Optional. Default value is False. Indicates
+ whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False. Indicates
+ whether any non-SSO forms of authentication are disallowed. Can only be set
+ to ``true`` when ``enabled`` is ``true``.
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A boolean value
+ indicating whether surge upgrade is enabled/disabled for the cluster. Surge
+ upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
+ destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags applied to the Kubernetes
+ cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "kubernetes_cluster": {
+ "name": "str", # A human-readable name for a Kubernetes cluster.
+ Required.
+ "node_pools": [
+ {
+ "auto_scale": bool, # Optional. A boolean value
+ indicating whether auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet
+ instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU
+ partition mode for this node pool. Only applicable to AMD GPU sizes
+ that support partitioning. Immutable after the node pool is created.
+ When omitted, the GPUs in the pool are left unpartitioned. Known
+ values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value
+ mappings specifying labels to apply to all nodes in a pool. Labels
+ will automatically be applied to all existing nodes and any
+ subsequent nodes added to the pool. Note that when a label is
+ removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of
+ nodes that this node pool can be auto-scaled to. The value will be
+ ``0`` if ``auto_scale`` is set to ``false``.
+ "name": "str", # Optional. A human-readable name for
+ the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00",
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was created.
+ "droplet_id": "str", # Optional. The
+ ID of the Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID
+ that can be used to identify and reference the node.
+ "name": "str", # Optional. An
+ automatically generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A
+ string indicating the current status of the node. Known
+ values are: "provisioning", "running", "draining", and
+ "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00"
+ # Optional. A time value given in ISO8601 combined date and
+ time format that represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for
+ the type of Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the
+ tags applied to the node pool. All node pools are automatically
+ tagged ``k8s``"" , ``k8s-worker``"" , and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
+ ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the
+ node reacts to pods that it won't tolerate. Available effect
+ values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
+ ``NoExecute``. Known values are: "NoSchedule",
+ "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An
+ arbitrary string. The ``key`` and ``value`` fields of the
+ ``taint`` object form a key-value pair. For example, if the
+ value of the ``key`` field is "special" and the value of the
+ ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+ ],
+ "region": "str", # The slug identifier for the region where the
+ Kubernetes cluster is located. Required.
+ "version": "str", # The slug identifier for the version of
+ Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
+ latest version within it will be used (e.g. "1.14.6-do.1"); if set to
+ "latest", the latest published version will be used. See the
+ ``/v2/kubernetes/options`` endpoint to find all currently available versions.
+ Required.
+ "amd_gpu_device_metrics_exporter_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD Device
+ Metrics Exporter is enabled.
+ },
+ "amd_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ Device Plugin is enabled.
+ },
+ "amd_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the AMD GPU
+ DRA Driver is enabled.
+ },
+ "auto_upgrade": False, # Optional. Default value is False. A boolean
+ value indicating whether the cluster will be automatically upgraded to new
+ patch releases during its maintenance window.
+ "cluster_autoscaler_configuration": {
+ "expanders": [
+ "str" # Optional. Customizes expanders used by
+ cluster-autoscaler. The autoscaler will apply each expander from the
+ provided list to narrow down the selection of node types created to
+ scale up, until either a single node type is left, or the list of
+ expanders is exhausted. If this flag is unset, autoscaler will use
+ its default expander ``random``. Passing an empty list ("" *not*
+ ``null``"" ) will unset any previous expander customizations.
+ Available expanders: * ``random``"" : Randomly selects a node group
+ to scale. * `priority`: Selects the node group with the highest
+ priority as per [user-provided
+ configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
+ * ``least_waste``"" : Selects the node group that will result in the
+ least amount of idle resources.
+ ],
+ "scale_down_unneeded_time": "str", # Optional. Used to
+ customize how long a node is unneeded before being scaled down.
+ "scale_down_utilization_threshold": 0.0 # Optional. Used to
+ customize when cluster autoscaler scales down non-empty nodes by setting
+ the node utilization threshold.
+ },
+ "cluster_subnet": "str", # Optional. The range of IP addresses for
+ the overlay network of the Kubernetes cluster in CIDR notation.
+ "control_plane_firewall": {
+ "allowed_addresses": [
+ "str" # Optional. An array of public addresses (IPv4
+ or CIDR) allowed to access the control plane.
+ ],
+ "enabled": bool # Optional. Indicates whether the control
+ plane firewall is enabled.
+ },
+ "coredns_autoscaler": {
+ "enabled": bool # Optional. Indicates whether the CoreDNS
+ Cluster Proportional Autoscaler add-on is enabled.
+ },
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was created.
+ "endpoint": "str", # Optional. The base URL of the API server on the
+ Kubernetes master node.
+ "ha": bool, # Optional. A boolean value indicating whether the
+ control plane is run in a highly available configuration in the cluster.
+ Highly available control planes incur less downtime. The property cannot be
+ disabled. When omitted on create, the default is version-dependent; for DOKS
+ 1.36.0 and later, the default is true; for earlier versions, the default is
+ false.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a Kubernetes cluster.
+ "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
+ master node. This will not be set if high availability is configured on the
+ cluster (v1.21+).
+ "isolated_workers": False, # Optional. Default value is False. A
+ boolean value indicating whether worker nodes in the cluster are not assigned
+ public IP addresses. When omitted on create, the default value is false. When
+ enabled, a NAT gateway must exist in the VPC where the cluster is created.
+ "maintenance_policy": {
+ "day": "str", # Optional. The day of the maintenance window
+ policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
+ indicate an arbitrary week day. Known values are: "any", "monday",
+ "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
+ "duration": "str", # Optional. The duration of the
+ maintenance window policy in human-readable format.
+ "start_time": "str" # Optional. The start time in UTC of the
+ maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
+ ``15:00``"" ).
+ },
+ "nfs_csi_plugin": {
+ "enabled": bool # Optional. Indicates whether the NFS CSI
+ plugin is enabled.
+ },
+ "nvidia_gpu_device_plugin": {
+ "enabled": bool # Optional. Indicates whether the Nvidia GPU
+ Device Plugin is enabled.
+ },
+ "nvidia_gpu_dra_driver": {
+ "enabled": bool # Optional. Indicates whether the NVIDIA GPU
+ DRA Driver is enabled.
+ },
+ "p2p_oci_registry_plugin": {
+ "enabled": bool # Optional. Indicates whether the
+ Peer-to-peer OCI registry component is enabled.
+ },
+ "rdma_shared_dev_plugin": {
+ "enabled": bool # Optional. Indicates whether the RDMA
+ shared device plugin is enabled.
+ },
+ "registry_enabled": bool, # Optional. A read-only boolean value
+ indicating if a container registry is integrated with the cluster.
+ "routing_agent": {
+ "enabled": bool # Optional. Indicates whether the
+ routing-agent component is enabled.
+ },
+ "service_subnet": "str", # Optional. The range of assignable IP
+ addresses for services running in the Kubernetes cluster in CIDR notation.
+ "sso": {
+ "client_id": "str", # Optional. The OIDC client ID
+ registered with the identity provider. Required when ``enabled`` is
+ ``true``.
+ "enabled": False, # Optional. Default value is False.
+ Indicates whether SSO authentication is enabled for the cluster.
+ "issuer_url": "str", # Optional. The OIDC issuer URL for the
+ identity provider. Required when ``enabled`` is ``true``.
+ "required": False # Optional. Default value is False.
+ Indicates whether any non-SSO forms of authentication are disallowed. Can
+ only be set to ``true`` when ``enabled`` is ``true``.
+ },
+ "status": {
+ "message": "str", # Optional. An optional message providing
+ additional information about the current cluster state.
+ "state": "str" # Optional. A string indicating the current
+ status of the cluster. Known values are: "running", "provisioning",
+ "degraded", "error", "deleted", "upgrading", and "deleting".
+ },
+ "surge_upgrade": False, # Optional. Default value is False. A
+ boolean value indicating whether surge upgrade is enabled/disabled for the
+ cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
+ up new nodes before destroying the outdated nodes.
+ "tags": [
+ "str" # Optional. An array of tags to apply to the
+ Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
+ ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
+ getting removed.
+ ],
+ "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the Kubernetes
+ cluster was last updated.
+ "vpc_uuid": "str", # Optional. A string specifying the UUID of the
+ VPC to which the Kubernetes cluster is
+ assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
+ to attach worker nodes to. When omitted on create, the default subnet for the
+ VPC is used. This value cannot be changed after the cluster is created.
+ ``vpc_uuid`` must also be set. :code:`
`: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 = 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_kubernetes_update_cluster_request(
+ cluster_id=cluster_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 [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 == 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 cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def delete_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete a Kubernetes Cluster.
+
+ To delete a Kubernetes cluster and all services deployed to it, send a DELETE
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+
+ A 204 status code with no body will be returned in response to a successful
+ request.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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): 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_kubernetes_delete_cluster_request(
+ cluster_id=cluster_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_associated_resources(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List Associated Resources for Cluster Deletion.
+
+ To list the associated billable resources that can be destroyed along with a cluster, send a
+ GET request to the
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources`` endpoint.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "load_balancers": [
+ {
+ "id": "str", # Optional. The ID of a resource associated
+ with a Kubernetes cluster.
+ "name": "str" # Optional. The name of a resource associated
+ with a Kubernetes cluster.
+ }
+ ],
+ "volume_snapshots": [
+ {
+ "id": "str", # Optional. The ID of a resource associated
+ with a Kubernetes cluster.
+ "name": "str" # Optional. The name of a resource associated
+ with a Kubernetes cluster.
+ }
+ ],
+ "volumes": [
+ {
+ "id": "str", # Optional. The ID of a resource associated
+ with a Kubernetes cluster.
+ "name": "str" # Optional. The name of a resource associated
+ with a Kubernetes cluster.
+ }
+ ]
+ }
+ # 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_kubernetes_list_associated_resources_request(
+ cluster_id=cluster_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 destroy_associated_resources_selective(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Delete a Cluster and its Associated Resources.
+
+ To delete a Kubernetes cluster along with a subset of its associated resources,
+ send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
+
+ The JSON body of the request should include ``load_balancers``\\ , ``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 cluster's associated resources endpoint.
+ Any associated resource not included in the request will remain and continue
+ to accrue changes on your account.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "load_balancers": [
+ "str" # Optional. A list of IDs for associated load balancers to
+ destroy along with the cluster.
+ ],
+ "volume_snapshots": [
+ "str" # Optional. A list of IDs for associated volume snapshots to
+ destroy along with the cluster.
+ ],
+ "volumes": [
+ "str" # Optional. A list of IDs for associated volumes to destroy
+ along with the cluster.
+ ]
+ }
+
+ # 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 destroy_associated_resources_selective(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Delete a Cluster and its Associated Resources.
+
+ To delete a Kubernetes cluster along with a subset of its associated resources,
+ send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
+
+ The JSON body of the request should include ``load_balancers``\\ , ``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 cluster's associated resources endpoint.
+ Any associated resource not included in the request will remain and continue
+ to accrue changes on your account.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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
+ def destroy_associated_resources_selective(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Selectively Delete a Cluster and its Associated Resources.
+
+ To delete a Kubernetes cluster along with a subset of its associated resources,
+ send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
+
+ The JSON body of the request should include ``load_balancers``\\ , ``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 cluster's associated resources endpoint.
+ Any associated resource not included in the request will remain and continue
+ to accrue changes on your account.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :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 = {
+ "load_balancers": [
+ "str" # Optional. A list of IDs for associated load balancers to
+ destroy along with the cluster.
+ ],
+ "volume_snapshots": [
+ "str" # Optional. A list of IDs for associated volume snapshots to
+ destroy along with the cluster.
+ ],
+ "volumes": [
+ "str" # Optional. A list of IDs for associated volumes to destroy
+ along with the cluster.
+ ]
+ }
+
+ # 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:
+ _json = body
+
+ _request = build_kubernetes_destroy_associated_resources_selective_request(
+ cluster_id=cluster_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 [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 destroy_associated_resources_dangerous(
+ self, cluster_id: str, **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Delete a Cluster and All of its Associated Resources (Dangerous).
+
+ To delete a Kubernetes cluster with all of its associated resources, send a
+ DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/dangerous``.
+ A 204 status code with no body will be returned in response to a successful request.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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): 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_kubernetes_destroy_associated_resources_dangerous_request(
+ cluster_id=cluster_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 get_kubeconfig(
+ self,
+ cluster_id: str,
+ *,
+ expiry_seconds: int = 0,
+ type: Optional[str] = None,
+ **kwargs: Any,
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Retrieve the kubeconfig for a Kubernetes Cluster.
+
+ This endpoint returns a kubeconfig file in YAML format. It can be used to
+ connect to and administer the cluster using the Kubernetes command line tool,
+ ``kubectl``\\ , or other programs supporting kubeconfig files (e.g., client libraries).
+
+ The resulting kubeconfig file uses token-based authentication for clusters
+ supporting it, and certificate-based authentication otherwise. For a list of
+ supported versions and more information, see "\\ `How to Connect to a DigitalOcean
+ Kubernetes Cluster
+ `_\\ ".
+
+ To retrieve a kubeconfig file for use with a Kubernetes cluster, send a GET
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig``.
+
+ Clusters supporting token-based authentication may define an expiration by
+ passing a duration in seconds as a query parameter to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig?expiry_seconds=$DURATION_IN_SECONDS``.
+ If not set or 0, then the token will have a 7 day expiry. The query parameter
+ has no impact for other kubeconfig types.
+
+ Using an ``sso`` kubeconfig type requires ``doctl`` to be installed to handle the client side
+ of the OAuth2 flow.
+
+ Kubernetes Roles granted to a user are derived from that user's
+ DigitalOcean role. Predefined roles (Owner, Member, Modifier etc.) have an automatic mapping
+ to Kubernetes roles. Custom roles are not automatically mapped to any Kubernetes roles,
+ and require `additional configuration
+ `_
+ by a cluster administrator.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
+ be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
+ :paramtype expiry_seconds: int
+ :keyword type: The type of credentials to return in the kubeconfig. When omitted, the
+ default credential type for the cluster is used: ``sso`` for clusters with SSO enabled,
+ ``token`` for clusters without SSO enabled. Known values are: "token" and "sso". Default value
+ is None.
+ :paramtype 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.
+ }
+ """
+ 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_kubernetes_get_kubeconfig_request(
+ cluster_id=cluster_id,
+ expiry_seconds=expiry_seconds,
+ 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)
+
+ deserialized = None
+ 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.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 get_credentials(
+ self, cluster_id: str, *, expiry_seconds: int = 0, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Credentials for a Kubernetes Cluster.
+
+ This endpoint returns a JSON object . It can be used to programmatically
+ construct Kubernetes clients which cannot parse kubeconfig files.
+
+ The resulting JSON object contains token-based authentication for clusters
+ supporting it, and certificate-based authentication otherwise. For a list of
+ supported versions and more information, see "\\ `How to Connect to a DigitalOcean
+ Kubernetes Cluster
+ `_\\ ".
+
+ To retrieve credentials for accessing a Kubernetes cluster, send a GET
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials``.
+
+ Clusters supporting token-based authentication may define an expiration by
+ passing a duration in seconds as a query parameter to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials?expiry_seconds=$DURATION_IN_SECONDS``.
+ If not set or 0, then the token will have a 7 day expiry. The query parameter
+ has no impact in certificate-based authentication.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
+ be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
+ :paramtype expiry_seconds: int
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "certificate_authority_data": bytes("bytes", encoding="utf-8"), # Optional.
+ A base64 encoding of bytes representing the certificate authority data for
+ accessing the cluster.
+ "client_certificate_data": bytes("bytes", encoding="utf-8"), # Optional. A
+ base64 encoding of bytes representing the x509 client certificate data for access
+ the cluster. This is only returned for clusters without support for token-based
+ authentication. Newly created Kubernetes clusters do not return credentials
+ using certificate-based authentication. For additional information, `see here
+ `_.
+ "client_key_data": bytes("bytes", encoding="utf-8"), # Optional. A base64
+ encoding of bytes representing the x509 client key data for access the cluster.
+ This is only returned for clusters without support for token-based
+ authentication. Newly created Kubernetes clusters do not return credentials
+ using certificate-based authentication. For additional information, `see here
+ `_.
+ "expires_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the access token
+ expires.
+ "server": "str", # Optional. The URL used to access the cluster API server.
+ "token": "str" # Optional. An access token used to authenticate with the
+ cluster. This is only returned for clusters with support for token-based
+ authentication.
+ }
+ # 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_kubernetes_get_credentials_request(
+ cluster_id=cluster_id,
+ expiry_seconds=expiry_seconds,
+ 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 get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Available Upgrades for an Existing Kubernetes Cluster.
+
+ To determine whether a cluster can be upgraded, and the versions to which it
+ can be upgraded, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "available_upgrade_versions": [
+ {
+ "kubernetes_version": "str", # Optional. The upstream
+ version string for the version of Kubernetes provided by a given slug.
+ "slug": "str", # Optional. The slug identifier for an
+ available version of Kubernetes for use when creating or updating a
+ cluster. The string contains both the upstream version of Kubernetes as
+ well as the DigitalOcean revision.
+ "supported_features": [
+ "str" # Optional. The features available with the
+ version of Kubernetes provided by a given slug.
+ ]
+ }
+ ]
+ }
+ # 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_kubernetes_get_available_upgrades_request(
+ cluster_id=cluster_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 upgrade_cluster(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Upgrade a Kubernetes Cluster.
+
+ To immediately upgrade a Kubernetes cluster to a newer patch release of
+ Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
+ The body of the request must specify a version attribute.
+
+ Available upgrade versions for a cluster can be fetched from
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "version": "str" # Optional. The slug identifier for the version of
+ Kubernetes that the cluster will be upgraded to.
+ }
+
+ # 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 upgrade_cluster(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Upgrade a Kubernetes Cluster.
+
+ To immediately upgrade a Kubernetes cluster to a newer patch release of
+ Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
+ The body of the request must specify a version attribute.
+
+ Available upgrade versions for a cluster can be fetched from
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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
- def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ def upgrade_cluster(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a New Kubernetes Cluster.
+ """Upgrade a Kubernetes Cluster.
- To create a new Kubernetes cluster, send a POST request to
- ``/v2/kubernetes/clusters``. The request must contain at least one node pool
- with at least one worker.
+ To immediately upgrade a Kubernetes cluster to a newer patch release of
+ Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
+ The body of the request must specify a version attribute.
- The request may contain a maintenance window policy describing a time period
- when disruptive maintenance tasks may be carried out. Omitting the policy
- implies that a window will be chosen automatically. See
- `here `_
- for details.
+ Available upgrade versions for a cluster can be fetched from
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -185826,7 +193503,129 @@ def create_cluster(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 human-readable name for a Kubernetes cluster. Required.
+ "version": "str" # Optional. The slug identifier for the version of
+ Kubernetes that the cluster will be upgraded to.
+ }
+
+ # 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:
+ _json = body
+
+ _request = build_kubernetes_upgrade_cluster_request(
+ cluster_id=cluster_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 [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 == 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
+ def list_node_pools(self, cluster_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Node Pools in a Kubernetes Clusters.
+
+ To list all of the node pools in a Kubernetes clusters, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools``.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
"node_pools": [
{
"auto_scale": bool, # Optional. A boolean value indicating
@@ -185902,410 +193701,583 @@ def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
}
]
}
- ],
- "region": "str", # The slug identifier for the region where the Kubernetes
- cluster is located. Required.
- "version": "str", # The slug identifier for the version of Kubernetes used
- for the cluster. If set to a minor version (e.g. "1.14"), the latest version
- within it will be used (e.g. "1.14.6-do.1"); if set to "latest", the latest
- published version will be used. See the ``/v2/kubernetes/options`` endpoint to
- find all currently available versions. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for the
- overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
+ ]
+ }
+ # 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_kubernetes_list_node_pools_request(
+ cluster_id=cluster_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 add_node_pool(
+ self,
+ cluster_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Add a Node Pool to a Kubernetes Cluster.
+
+ To add an additional node pool to a Kubernetes clusters, send a POST request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
+ attributes.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 = {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
+ node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
+ after the node pool is created. When omitted, the GPUs in the pool are left
+ unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
"id": "str", # Optional. A unique ID that can be used to identify and
- reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes master
- node. This will not be set if high availability is configured on the cluster
- (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A boolean
- value indicating whether worker nodes in the cluster are not assigned public IP
- addresses. When omitted on create, the default value is false. When enabled, a
- NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value indicating
- if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP addresses
- for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current status of
- the cluster. Known values are: "running", "provisioning", "degraded",
- "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of Droplet used
+ as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read`` and
- ``tag:create`` scope, as well as ``tag:delete`` if existing tags are getting
- removed.
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the Kubernetes cluster
- was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the VPC to
- which the Kubernetes cluster is assigned.:code:`
`:code:`
`Requires
- ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet to attach
- worker nodes to. When omitted on create, the default subnet for the VPC is used.
- This value cannot be changed after the cluster is created. ``vpc_uuid`` must
- also be set. :code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
}
# response body for status code(s): 201
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
+ }
+ }
+ # 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 add_node_pool(
+ self,
+ cluster_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Add a Node Pool to a Kubernetes Cluster.
+
+ To add an additional node pool to a Kubernetes clusters, send a POST request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
+ attributes.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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".
+ :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 == {
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
+ }
+ }
+ # 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 add_node_pool(
+ self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Add a Node Pool to a Kubernetes Cluster.
+
+ To add an additional node pool to a Kubernetes clusters, send a POST request
+ to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
+ attributes.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_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
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
+ node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
+ after the node pool is created. When omitted, the GPUs in the pool are left
+ unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
+ "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of Droplet used
+ as workers in the node pool.
+ "tags": [
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
+ ]
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
"id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
+ "id": "str", # Optional. A unique ID that can be
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
+ }
+ ],
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
+ # 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,
@@ -186336,7 +194308,8 @@ def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_kubernetes_create_cluster_request(
+ _request = build_kubernetes_add_node_pool_request(
+ cluster_id=cluster_id,
content_type=content_type,
json=_json,
content=_content,
@@ -186354,27 +194327,44 @@ def create_cluster(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 [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 = {}
- 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 == 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.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
@@ -186382,15 +194372,18 @@ def create_cluster(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
+ def get_node_pool(self, cluster_id: str, node_pool_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Kubernetes Cluster.
+ """Retrieve a Node Pool for a Kubernetes Cluster.
- To show information about an existing Kubernetes cluster, send a GET request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+ To show information about a specific node pool in a Kubernetes cluster, send
+ a GET request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -186400,249 +194393,76 @@ def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": False, # Optional. Default value is False. A boolean value
- indicating whether the control plane is run in a highly available
- configuration in the cluster. Highly available control planes incur less
- downtime. The property cannot be disabled. When omitted on create, the
- default is version-dependent; for DOKS 1.36.0 and later, the default is true;
- for earlier versions, the default is false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registries": [
- "str" # Optional. An array of integrated DOCR registries.
- ],
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags applied to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- worker nodes are attached to. When unset, the default subnet for the VPC is
- used.:code:`
`:code:`
`Requires ``vpc:read`` scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -186675,8 +194495,9 @@ def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_cluster_request(
+ _request = build_kubernetes_get_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
headers=_headers,
params=_params,
)
@@ -186736,23 +194557,28 @@ def get_cluster(self, cluster_id: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@overload
- def update_cluster(
+ def update_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update a Kubernetes Cluster.
+ """Update a Node Pool in a Kubernetes Cluster.
- To update a Kubernetes cluster, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
- attributes below.
+ To update the name of a node pool, edit the tags applied to it, or adjust its
+ number of nodes, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
+ following attributes.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -186767,362 +194593,141 @@ def update_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A human-readable name for a Kubernetes cluster. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
"tags": [
- "str" # Optional. An array of tags applied to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``.
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
]
}
# response body for status code(s): 202
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -187139,23 +194744,28 @@ def update_cluster(
"""
@overload
- def update_cluster(
+ def update_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update a Kubernetes Cluster.
+ """Update a Node Pool in a Kubernetes Cluster.
- To update a Kubernetes cluster, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
- attributes below.
+ To update the name of a node pool, edit the tags applied to it, or adjust its
+ number of nodes, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
+ following attributes.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -187170,249 +194780,76 @@ def update_cluster(
# response body for status code(s): 202
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -187429,18 +194866,26 @@ def update_cluster(
"""
@distributed_trace
- def update_cluster(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ def update_node_pool(
+ self,
+ cluster_id: str,
+ node_pool_id: str,
+ body: Union[JSON, IO[bytes]],
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Update a Kubernetes Cluster.
+ """Update a Node Pool in a Kubernetes Cluster.
- To update a Kubernetes cluster, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID`` and specify one or more of the
- attributes below.
+ To update the name of a node pool, edit the tags applied to it, or adjust its
+ number of nodes, send a PUT request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
+ following attributes.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -187452,362 +194897,141 @@ def update_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "name": "str", # A human-readable name for a Kubernetes cluster. Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device Metrics
- Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU Device
- Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU DRA Driver
- is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether the cluster will be automatically upgraded to new patch
- releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to scale
- up, until either a single node type is left, or the list of expanders is
- exhausted. If this flag is unset, autoscaler will use its default
- expander ``random``. Passing an empty list ("" *not* ``null``"" ) will
- unset any previous expander customizations. Available expanders: *
- ``random``"" : Randomly selects a node group to scale. * `priority`:
- Selects the node group with the highest priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to customize how
- long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting the
- node utilization threshold.
- },
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4 or
- CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control plane
- firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS Cluster
- Proportional Autoscaler add-on is enabled.
- },
- "ha": bool, # Optional. A boolean value indicating whether the control plane
- is run in a highly available configuration in the cluster. Highly available
- control planes incur less downtime. The property cannot be disabled. When omitted
- on create, the default is version-dependent; for DOKS 1.36.0 and later, the
- default is true; for earlier versions, the default is false.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window policy.
- May be one of ``monday`` through ``sunday``"" , or ``any`` to indicate an
- arbitrary week day. Known values are: "any", "monday", "tuesday",
- "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the maintenance
- window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI plugin is
- enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU Device
- Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU DRA
- Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the Peer-to-peer OCI
- registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA shared device
- plugin is enabled.
- },
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the routing-agent
- component is enabled.
- },
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID registered with
- the identity provider. Required when ``enabled`` is ``true``.
- "enabled": False, # Optional. Default value is False. Indicates
- whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False. Indicates
- whether any non-SSO forms of authentication are disallowed. Can only be set
- to ``true`` when ``enabled`` is ``true``.
- },
- "surge_upgrade": False, # Optional. Default value is False. A boolean value
- indicating whether surge upgrade is enabled/disabled for the cluster. Surge
- upgrade makes cluster upgrades fast and reliable by bringing up new nodes before
- destroying the outdated nodes.
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node pool.
+ "id": "str", # Optional. A unique ID that can be used to identify and
+ reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying labels
+ to apply to all nodes in a pool. Labels will automatically be applied to all
+ existing nodes and any subsequent nodes added to the pool. Note that when a label
+ is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
+ can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
+ ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
+ {
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the node was created.
+ "droplet_id": "str", # Optional. The ID of the Droplet used
+ for the worker node.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference the node.
+ "name": "str", # Optional. An automatically generated,
+ human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string indicating the
+ current status of the node. Known values are: "provisioning",
+ "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A time value
+ given in ISO8601 combined date and time format that represents when the
+ node was last updated.
+ }
+ ],
"tags": [
- "str" # Optional. An array of tags applied to the Kubernetes
- cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``.
+ "str" # Optional. An array containing the tags applied to the node
+ pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
+ and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
+ scope.
+ ],
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to pods
+ that it won't tolerate. Available effect values are ``NoSchedule``"" ,
+ ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
+ "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The ``key``
+ and ``value`` fields of the ``taint`` object form a key-value pair. For
+ example, if the value of the ``key`` field is "special" and the value of
+ the ``value`` field is "gpu", the key value pair would be
+ ``special=gpu``.
+ }
]
}
# response body for status code(s): 202
response == {
- "kubernetes_cluster": {
- "name": "str", # A human-readable name for a Kubernetes cluster.
- Required.
- "node_pools": [
+ "node_pool": {
+ "auto_scale": bool, # Optional. A boolean value indicating whether
+ auto-scaling is enabled for this node pool.
+ "count": 0, # Optional. The number of Droplet instances in the node
+ pool.
+ "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
+ for this node pool. Only applicable to AMD GPU sizes that support
+ partitioning. Immutable after the node pool is created. When omitted, the
+ GPUs in the pool are left unpartitioned. Known values are:
+ "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a specific node pool.
+ "labels": {}, # Optional. An object of key/value mappings specifying
+ labels to apply to all nodes in a pool. Labels will automatically be applied
+ to all existing nodes and any subsequent nodes added to the pool. Note that
+ when a label is removed, it is not deleted from the nodes in the pool.
+ "max_nodes": 0, # Optional. The maximum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "min_nodes": 0, # Optional. The minimum number of nodes that this
+ node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
+ set to ``false``.
+ "name": "str", # Optional. A human-readable name for the node pool.
+ "nodes": [
{
- "auto_scale": bool, # Optional. A boolean value
- indicating whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet
- instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes
- that support partitioning. Immutable after the node pool is created.
- When omitted, the GPUs in the pool are left unpartitioned. Known
- values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
+ "created_at": "2020-02-20 00:00:00", # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was created.
+ "droplet_id": "str", # Optional. The ID of the
+ Droplet used for the worker node.
"id": "str", # Optional. A unique ID that can be
- used to identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value
- mappings specifying labels to apply to all nodes in a pool. Labels
- will automatically be applied to all existing nodes and any
- subsequent nodes added to the pool. Note that when a label is
- removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of
- nodes that this node pool can be auto-scaled to. The value will be
- ``0`` if ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for
- the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00",
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was created.
- "droplet_id": "str", # Optional. The
- ID of the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID
- that can be used to identify and reference the node.
- "name": "str", # Optional. An
- automatically generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A
- string indicating the current status of the node. Known
- values are: "provisioning", "running", "draining", and
- "deleting".
- },
- "updated_at": "2020-02-20 00:00:00"
- # Optional. A time value given in ISO8601 combined date and
- time format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for
- the type of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the
- tags applied to the node pool. All node pools are automatically
- tagged ``k8s``"" , ``k8s-worker``"" , and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires
- ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the
- node reacts to pods that it won't tolerate. Available effect
- values are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An
- arbitrary string. The ``key`` and ``value`` fields of the
- ``taint`` object form a key-value pair. For example, if the
- value of the ``key`` field is "special" and the value of the
- ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
+ used to identify and reference the node.
+ "name": "str", # Optional. An automatically
+ generated, human-readable name for the node.
+ "status": {
+ "state": "str" # Optional. A string
+ indicating the current status of the node. Known values are:
+ "provisioning", "running", "draining", and "deleting".
+ },
+ "updated_at": "2020-02-20 00:00:00" # Optional. A
+ time value given in ISO8601 combined date and time format that
+ represents when the node was last updated.
}
],
- "region": "str", # The slug identifier for the region where the
- Kubernetes cluster is located. Required.
- "version": "str", # The slug identifier for the version of
- Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the
- latest version within it will be used (e.g. "1.14.6-do.1"); if set to
- "latest", the latest published version will be used. See the
- ``/v2/kubernetes/options`` endpoint to find all currently available versions.
- Required.
- "amd_gpu_device_metrics_exporter_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD Device
- Metrics Exporter is enabled.
- },
- "amd_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- Device Plugin is enabled.
- },
- "amd_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the AMD GPU
- DRA Driver is enabled.
- },
- "auto_upgrade": False, # Optional. Default value is False. A boolean
- value indicating whether the cluster will be automatically upgraded to new
- patch releases during its maintenance window.
- "cluster_autoscaler_configuration": {
- "expanders": [
- "str" # Optional. Customizes expanders used by
- cluster-autoscaler. The autoscaler will apply each expander from the
- provided list to narrow down the selection of node types created to
- scale up, until either a single node type is left, or the list of
- expanders is exhausted. If this flag is unset, autoscaler will use
- its default expander ``random``. Passing an empty list ("" *not*
- ``null``"" ) will unset any previous expander customizations.
- Available expanders: * ``random``"" : Randomly selects a node group
- to scale. * `priority`: Selects the node group with the highest
- priority as per [user-provided
- configuration](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/#configuring-priority-expander)
- * ``least_waste``"" : Selects the node group that will result in the
- least amount of idle resources.
- ],
- "scale_down_unneeded_time": "str", # Optional. Used to
- customize how long a node is unneeded before being scaled down.
- "scale_down_utilization_threshold": 0.0 # Optional. Used to
- customize when cluster autoscaler scales down non-empty nodes by setting
- the node utilization threshold.
- },
- "cluster_subnet": "str", # Optional. The range of IP addresses for
- the overlay network of the Kubernetes cluster in CIDR notation.
- "control_plane_firewall": {
- "allowed_addresses": [
- "str" # Optional. An array of public addresses (IPv4
- or CIDR) allowed to access the control plane.
- ],
- "enabled": bool # Optional. Indicates whether the control
- plane firewall is enabled.
- },
- "coredns_autoscaler": {
- "enabled": bool # Optional. Indicates whether the CoreDNS
- Cluster Proportional Autoscaler add-on is enabled.
- },
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was created.
- "endpoint": "str", # Optional. The base URL of the API server on the
- Kubernetes master node.
- "ha": bool, # Optional. A boolean value indicating whether the
- control plane is run in a highly available configuration in the cluster.
- Highly available control planes incur less downtime. The property cannot be
- disabled. When omitted on create, the default is version-dependent; for DOKS
- 1.36.0 and later, the default is true; for earlier versions, the default is
- false.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a Kubernetes cluster.
- "ipv4": "str", # Optional. The public IPv4 address of the Kubernetes
- master node. This will not be set if high availability is configured on the
- cluster (v1.21+).
- "isolated_workers": False, # Optional. Default value is False. A
- boolean value indicating whether worker nodes in the cluster are not assigned
- public IP addresses. When omitted on create, the default value is false. When
- enabled, a NAT gateway must exist in the VPC where the cluster is created.
- "maintenance_policy": {
- "day": "str", # Optional. The day of the maintenance window
- policy. May be one of ``monday`` through ``sunday``"" , or ``any`` to
- indicate an arbitrary week day. Known values are: "any", "monday",
- "tuesday", "wednesday", "thursday", "friday", "saturday", and "sunday".
- "duration": "str", # Optional. The duration of the
- maintenance window policy in human-readable format.
- "start_time": "str" # Optional. The start time in UTC of the
- maintenance window policy in 24-hour clock format / HH:MM notation (e.g.,
- ``15:00``"" ).
- },
- "nfs_csi_plugin": {
- "enabled": bool # Optional. Indicates whether the NFS CSI
- plugin is enabled.
- },
- "nvidia_gpu_device_plugin": {
- "enabled": bool # Optional. Indicates whether the Nvidia GPU
- Device Plugin is enabled.
- },
- "nvidia_gpu_dra_driver": {
- "enabled": bool # Optional. Indicates whether the NVIDIA GPU
- DRA Driver is enabled.
- },
- "p2p_oci_registry_plugin": {
- "enabled": bool # Optional. Indicates whether the
- Peer-to-peer OCI registry component is enabled.
- },
- "rdma_shared_dev_plugin": {
- "enabled": bool # Optional. Indicates whether the RDMA
- shared device plugin is enabled.
- },
- "registry_enabled": bool, # Optional. A read-only boolean value
- indicating if a container registry is integrated with the cluster.
- "routing_agent": {
- "enabled": bool # Optional. Indicates whether the
- routing-agent component is enabled.
- },
- "service_subnet": "str", # Optional. The range of assignable IP
- addresses for services running in the Kubernetes cluster in CIDR notation.
- "sso": {
- "client_id": "str", # Optional. The OIDC client ID
- registered with the identity provider. Required when ``enabled`` is
- ``true``.
- "enabled": False, # Optional. Default value is False.
- Indicates whether SSO authentication is enabled for the cluster.
- "issuer_url": "str", # Optional. The OIDC issuer URL for the
- identity provider. Required when ``enabled`` is ``true``.
- "required": False # Optional. Default value is False.
- Indicates whether any non-SSO forms of authentication are disallowed. Can
- only be set to ``true`` when ``enabled`` is ``true``.
- },
- "status": {
- "message": "str", # Optional. An optional message providing
- additional information about the current cluster state.
- "state": "str" # Optional. A string indicating the current
- status of the cluster. Known values are: "running", "provisioning",
- "degraded", "error", "deleted", "upgrading", and "deleting".
- },
- "surge_upgrade": False, # Optional. Default value is False. A
- boolean value indicating whether surge upgrade is enabled/disabled for the
- cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing
- up new nodes before destroying the outdated nodes.
+ "size": "str", # Optional. The slug identifier for the type of
+ Droplet used as workers in the node pool.
"tags": [
- "str" # Optional. An array of tags to apply to the
- Kubernetes cluster. All clusters are automatically tagged ``k8s`` and
- ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- and ``tag:create`` scope, as well as ``tag:delete`` if existing tags are
- getting removed.
+ "str" # Optional. An array containing the tags applied to
+ the node pool. All node pools are automatically tagged ``k8s``"" ,
+ ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
+ :code:`
`:code:`
`Requires ``tag:read`` scope.
],
- "updated_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the Kubernetes
- cluster was last updated.
- "vpc_uuid": "str", # Optional. A string specifying the UUID of the
- VPC to which the Kubernetes cluster is
- assigned.:code:`
`:code:`
`Requires ``vpc:read`` scope.
- "worker_subnet_uuid": "str" # Optional. The UUID of the VPC subnet
- to attach worker nodes to. When omitted on create, the default subnet for the
- VPC is used. This value cannot be changed after the cluster is created.
- ``vpc_uuid`` must also be set. :code:`
`:code:`
`Requires ``vpc:read``
- scope.
+ "taints": [
+ {
+ "effect": "str", # Optional. How the node reacts to
+ pods that it won't tolerate. Available effect values are
+ ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
+ values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
+ "key": "str", # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ "value": "str" # Optional. An arbitrary string. The
+ ``key`` and ``value`` fields of the ``taint`` object form a key-value
+ pair. For example, if the value of the ``key`` field is "special" and
+ the value of the ``value`` field is "gpu", the key value pair would
+ be ``special=gpu``.
+ }
+ ]
}
}
# response body for status code(s): 404
@@ -187851,8 +195075,9 @@ def update_cluster(
else:
_json = body
- _request = build_kubernetes_update_cluster_request(
+ _request = build_kubernetes_update_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
content_type=content_type,
json=_json,
content=_content,
@@ -187915,18 +195140,23 @@ def update_cluster(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def delete_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]:
+ def delete_node_pool(
+ self, cluster_id: str, node_pool_id: str, **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Delete a Kubernetes Cluster.
+ """Delete a Node Pool in a Kubernetes Cluster.
- To delete a Kubernetes cluster and all services deployed to it, send a DELETE
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID``.
+ To delete a node pool, send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
A 204 status code with no body will be returned in response to a successful
- request.
+ request. Nodes in the pool will subsequently be drained and deleted.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -187964,8 +195194,9 @@ def delete_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]:
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_kubernetes_delete_cluster_request(
+ _request = build_kubernetes_delete_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
headers=_headers,
params=_params,
)
@@ -188021,50 +195252,53 @@ def delete_cluster(self, cluster_id: str, **kwargs: Any) -> Optional[JSON]:
return deserialized # type: ignore
@distributed_trace
- def list_associated_resources(self, cluster_id: str, **kwargs: Any) -> JSON:
+ def delete_node(
+ self,
+ cluster_id: str,
+ node_pool_id: str,
+ node_id: str,
+ *,
+ skip_drain: int = 0,
+ replace: int = 0,
+ **kwargs: Any,
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List Associated Resources for Cluster Deletion.
+ """Delete a Node in a Kubernetes Cluster.
- To list the associated billable resources that can be destroyed along with a cluster, send a
- GET request to the
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources`` endpoint.
+ To delete a single node in a pool, send a DELETE request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``.
+
+ Appending the ``skip_drain=1`` query parameter to the request causes node
+ draining to be skipped. Omitting the query parameter or setting its value to
+ ``0`` carries out draining prior to deletion.
+
+ Appending the ``replace=1`` query parameter to the request causes the node to
+ be replaced by a new one after deletion. Omitting the query parameter or
+ setting its value to ``0`` deletes without replacement.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
- :return: JSON object
- :rtype: JSON
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
+ :param node_id: A unique ID that can be used to reference a node in a Kubernetes node pool.
+ Required.
+ :type node_id: str
+ :keyword skip_drain: Specifies whether or not to drain workloads from a node before it is
+ deleted. Setting it to ``1`` causes node draining to be skipped. Omitting the query parameter
+ or setting its value to ``0`` carries out draining prior to deletion. Default value is 0.
+ :paramtype skip_drain: int
+ :keyword replace: Specifies whether or not to replace a node after it has been deleted. Setting
+ it to ``1`` causes the node to be replaced by a new one after deletion. Omitting the query
+ parameter or setting its value to ``0`` deletes without replacement. Default value is 0.
+ :paramtype replace: 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 == {
- "load_balancers": [
- {
- "id": "str", # Optional. The ID of a resource associated
- with a Kubernetes cluster.
- "name": "str" # Optional. The name of a resource associated
- with a Kubernetes cluster.
- }
- ],
- "volume_snapshots": [
- {
- "id": "str", # Optional. The ID of a resource associated
- with a Kubernetes cluster.
- "name": "str" # Optional. The name of a resource associated
- with a Kubernetes cluster.
- }
- ],
- "volumes": [
- {
- "id": "str", # Optional. The ID of a resource associated
- with a Kubernetes cluster.
- "name": "str" # Optional. The name of a resource associated
- with a Kubernetes cluster.
- }
- ]
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -188093,10 +195327,14 @@ def list_associated_resources(self, cluster_id: 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_kubernetes_list_associated_resources_request(
+ _request = build_kubernetes_delete_node_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
+ node_id=node_id,
+ skip_drain=skip_drain,
+ replace=replace,
headers=_headers,
params=_params,
)
@@ -188111,14 +195349,15 @@ def list_associated_resources(self, cluster_id: 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")
)
@@ -188129,11 +195368,6 @@ def list_associated_resources(self, cluster_id: 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")
@@ -188151,36 +195385,32 @@ def list_associated_resources(self, cluster_id: 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
@overload
- def destroy_associated_resources_selective(
+ def recycle_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Selectively Delete a Cluster and its Associated Resources.
-
- To delete a Kubernetes cluster along with a subset of its associated resources,
- send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
-
- The JSON body of the request should include ``load_balancers``\\ , ``volumes``\\ , or
- ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed.
+ """Recycle a Kubernetes Node Pool.
- The IDs can be found by querying the cluster's associated resources endpoint.
- Any associated resource not included in the request will remain and continue
- to accrue changes on your account.
+ The endpoint has been deprecated. Please use the DELETE
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
+ method instead.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -188195,17 +195425,8 @@ def destroy_associated_resources_selective(
# JSON input template you can fill out and use as your body input.
body = {
- "load_balancers": [
- "str" # Optional. A list of IDs for associated load balancers to
- destroy along with the cluster.
- ],
- "volume_snapshots": [
- "str" # Optional. A list of IDs for associated volume snapshots to
- destroy along with the cluster.
- ],
- "volumes": [
- "str" # Optional. A list of IDs for associated volumes to destroy
- along with the cluster.
+ "nodes": [
+ "str" # Optional.
]
}
@@ -188223,31 +195444,27 @@ def destroy_associated_resources_selective(
"""
@overload
- def destroy_associated_resources_selective(
+ def recycle_node_pool(
self,
cluster_id: str,
+ node_pool_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Selectively Delete a Cluster and its Associated Resources.
-
- To delete a Kubernetes cluster along with a subset of its associated resources,
- send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
-
- The JSON body of the request should include ``load_balancers``\\ , ``volumes``\\ , or
- ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed.
+ """Recycle a Kubernetes Node Pool.
- The IDs can be found by querying the cluster's associated resources endpoint.
- Any associated resource not included in the request will remain and continue
- to accrue changes on your account.
+ The endpoint has been deprecated. Please use the DELETE
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
+ method instead.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -188274,48 +195491,38 @@ def destroy_associated_resources_selective(
"""
@distributed_trace
- def destroy_associated_resources_selective(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ def recycle_node_pool(
+ self,
+ cluster_id: str,
+ node_pool_id: str,
+ body: Union[JSON, IO[bytes]],
+ **kwargs: Any,
) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Selectively Delete a Cluster and its Associated Resources.
-
- To delete a Kubernetes cluster along with a subset of its associated resources,
- send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective``.
-
- The JSON body of the request should include ``load_balancers``\\ , ``volumes``\\ , or
- ``volume_snapshots`` keys each set to an array of IDs for the associated
- resources to be destroyed.
+ """Recycle a Kubernetes Node Pool.
- The IDs can be found by querying the cluster's associated resources endpoint.
- Any associated resource not included in the request will remain and continue
- to accrue changes on your account.
+ The endpoint has been deprecated. Please use the DELETE
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
+ method instead.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
+ Required.
+ :type node_pool_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
: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 = {
- "load_balancers": [
- "str" # Optional. A list of IDs for associated load balancers to
- destroy along with the cluster.
- ],
- "volume_snapshots": [
- "str" # Optional. A list of IDs for associated volume snapshots to
- destroy along with the cluster.
- ],
- "volumes": [
- "str" # Optional. A list of IDs for associated volumes to destroy
- along with the cluster.
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "nodes": [
+ "str" # Optional.
]
}
@@ -188360,8 +195567,9 @@ def destroy_associated_resources_selective(
else:
_json = body
- _request = build_kubernetes_destroy_associated_resources_selective_request(
+ _request = build_kubernetes_recycle_node_pool_request(
cluster_id=cluster_id,
+ node_pool_id=node_pool_id,
content_type=content_type,
json=_json,
content=_content,
@@ -188379,7 +195587,7 @@ def destroy_associated_resources_selective(
response = pipeline_response.http_response
- if response.status_code not in [204, 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
@@ -188387,7 +195595,7 @@ def destroy_associated_resources_selective(
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")
)
@@ -188420,26 +195628,33 @@ def destroy_associated_resources_selective(
return deserialized # type: ignore
@distributed_trace
- def destroy_associated_resources_dangerous(
- self, cluster_id: str, **kwargs: Any
- ) -> Optional[JSON]:
+ def get_cluster_user(self, cluster_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Cluster and All of its Associated Resources (Dangerous).
+ """Retrieve User Information for a Kubernetes Cluster.
- To delete a Kubernetes cluster with all of its associated resources, send a
- DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/dangerous``.
- A 204 status code with no body will be returned in response to a successful request.
+ To show information the user associated with a Kubernetes cluster, send a GET
+ request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/user``.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: 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): 200
+ response == {
+ "kubernetes_cluster_user": {
+ "groups": [
+ "str" # Optional. A list of in-cluster groups that the user
+ belongs to.
+ ],
+ "username": "str" # Optional. The username for the cluster admin
+ user.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -188468,9 +195683,9 @@ def destroy_associated_resources_dangerous(
_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_kubernetes_destroy_associated_resources_dangerous_request(
+ _request = build_kubernetes_get_cluster_user_request(
cluster_id=cluster_id,
headers=_headers,
params=_params,
@@ -188486,15 +195701,14 @@ def destroy_associated_resources_dangerous(
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")
)
@@ -188505,6 +195719,11 @@ def destroy_associated_resources_dangerous(
"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")
@@ -188522,68 +195741,61 @@ def destroy_associated_resources_dangerous(
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_kubeconfig(
- self,
- cluster_id: str,
- *,
- expiry_seconds: int = 0,
- type: Optional[str] = None,
- **kwargs: Any,
- ) -> Optional[JSON]:
+ def list_options(self, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Retrieve the kubeconfig for a Kubernetes Cluster.
-
- This endpoint returns a kubeconfig file in YAML format. It can be used to
- connect to and administer the cluster using the Kubernetes command line tool,
- ``kubectl``\\ , or other programs supporting kubeconfig files (e.g., client libraries).
-
- The resulting kubeconfig file uses token-based authentication for clusters
- supporting it, and certificate-based authentication otherwise. For a list of
- supported versions and more information, see "\\ `How to Connect to a DigitalOcean
- Kubernetes Cluster
- `_\\ ".
-
- To retrieve a kubeconfig file for use with a Kubernetes cluster, send a GET
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig``.
-
- Clusters supporting token-based authentication may define an expiration by
- passing a duration in seconds as a query parameter to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/kubeconfig?expiry_seconds=$DURATION_IN_SECONDS``.
- If not set or 0, then the token will have a 7 day expiry. The query parameter
- has no impact for other kubeconfig types.
-
- Using an ``sso`` kubeconfig type requires ``doctl`` to be installed to handle the client side
- of the OAuth2 flow.
+ """List Available Regions, Node Sizes, and Versions of Kubernetes.
- Kubernetes Roles granted to a user are derived from that user's
- DigitalOcean role. Predefined roles (Owner, Member, Modifier etc.) have an automatic mapping
- to Kubernetes roles. Custom roles are not automatically mapped to any Kubernetes roles,
- and require `additional configuration
- `_
- by a cluster administrator.
+ To list the versions of Kubernetes available for use, the regions that support Kubernetes, and
+ the available node sizes, send a GET request to ``/v2/kubernetes/options``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
- be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
- :paramtype expiry_seconds: int
- :keyword type: The type of credentials to return in the kubeconfig. When omitted, the
- default credential type for the cluster is used: ``sso`` for clusters with SSO enabled,
- ``token`` for clusters without SSO enabled. Known values are: "token" and "sso". Default value
- is None.
- :paramtype 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): 200
+ response == {
+ "options": {
+ "regions": [
+ {
+ "name": "str", # Optional. A DigitalOcean region
+ where Kubernetes is available.
+ "slug": "str" # Optional. The identifier for a
+ region for use when creating a new cluster.
+ }
+ ],
+ "sizes": [
+ {
+ "name": "str", # Optional. A Droplet size available
+ for use in a Kubernetes node pool.
+ "slug": "str" # Optional. The identifier for a size
+ for use when creating a new cluster.
+ }
+ ],
+ "versions": [
+ {
+ "kubernetes_version": "str", # Optional. The
+ upstream version string for the version of Kubernetes provided by a
+ given slug.
+ "slug": "str", # Optional. The slug identifier for
+ an available version of Kubernetes for use when creating or updating
+ a cluster. The string contains both the upstream version of
+ Kubernetes as well as the DigitalOcean revision.
+ "supported_features": [
+ "str" # Optional. The features available
+ with the version of Kubernetes provided by a given slug.
+ ]
+ }
+ ]
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -188612,12 +195824,9 @@ def get_kubeconfig(
_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_kubernetes_get_kubeconfig_request(
- cluster_id=cluster_id,
- expiry_seconds=expiry_seconds,
- type=type,
+ _request = build_kubernetes_list_options_request(
headers=_headers,
params=_params,
)
@@ -188638,7 +195847,6 @@ def get_kubeconfig(
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:
response_headers["ratelimit-limit"] = self._deserialize(
@@ -188651,6 +195859,11 @@ def get_kubeconfig(
"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")
@@ -188668,40 +195881,119 @@ def get_kubeconfig(
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_credentials(
- self, cluster_id: str, *, expiry_seconds: int = 0, **kwargs: Any
+ @overload
+ def run_cluster_lint(
+ self,
+ cluster_id: str,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
- """Retrieve Credentials for a Kubernetes Cluster.
+ """Run Clusterlint Checks on a Kubernetes Cluster.
- This endpoint returns a JSON object . It can be used to programmatically
- construct Kubernetes clients which cannot parse kubeconfig files.
+ Clusterlint helps operators conform to Kubernetes best practices around
+ resources, security and reliability to avoid common problems while operating
+ or upgrading the clusters.
- The resulting JSON object contains token-based authentication for clusters
- supporting it, and certificate-based authentication otherwise. For a list of
- supported versions and more information, see "\\ `How to Connect to a DigitalOcean
- Kubernetes Cluster
- `_\\ ".
+ To request a clusterlint run on your cluster, send a POST request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
+ checks present in the ``doks`` group by default, if a request body is not
+ specified. Optionally specify the below attributes.
- To retrieve credentials for accessing a Kubernetes cluster, send a GET
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials``.
+ For information about the available checks, please refer to
+ `the clusterlint check documentation
+ `_.
- Clusters supporting token-based authentication may define an expiration by
- passing a duration in seconds as a query parameter to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/credentials?expiry_seconds=$DURATION_IN_SECONDS``.
- If not set or 0, then the token will have a 7 day expiry. The query parameter
- has no impact in certificate-based authentication.
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: 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 = {
+ "exclude_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "exclude_groups": [
+ "str" # Optional. An array of check groups that will be omitted when
+ clusterlint executes checks.
+ ],
+ "include_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "include_groups": [
+ "str" # Optional. An array of check groups that will be run when
+ clusterlint executes checks.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "run_id": "str" # Optional. ID of the clusterlint run that can be used later
+ to fetch the diagnostics.
+ }
+ # 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_cluster_lint(
+ self,
+ cluster_id: str,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Run Clusterlint Checks on a Kubernetes Cluster.
+
+ Clusterlint helps operators conform to Kubernetes best practices around
+ resources, security and reliability to avoid common problems while operating
+ or upgrading the clusters.
+
+ To request a clusterlint run on your cluster, send a POST request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
+ checks present in the ``doks`` group by default, if a request body is not
+ specified. Optionally specify the below attributes.
+
+ For information about the available checks, please refer to
+ `the clusterlint check documentation
+ `_.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
- :keyword expiry_seconds: The duration in seconds that the returned Kubernetes credentials will
- be valid. If not set or 0, the credentials will have a 7 day expiry. Default value is 0.
- :paramtype expiry_seconds: 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:
@@ -188709,30 +196001,82 @@ def get_credentials(
Example:
.. code-block:: python
- # response body for status code(s): 200
+ # response body for status code(s): 202
response == {
- "certificate_authority_data": bytes("bytes", encoding="utf-8"), # Optional.
- A base64 encoding of bytes representing the certificate authority data for
- accessing the cluster.
- "client_certificate_data": bytes("bytes", encoding="utf-8"), # Optional. A
- base64 encoding of bytes representing the x509 client certificate data for access
- the cluster. This is only returned for clusters without support for token-based
- authentication. Newly created Kubernetes clusters do not return credentials
- using certificate-based authentication. For additional information, `see here
- `_.
- "client_key_data": bytes("bytes", encoding="utf-8"), # Optional. A base64
- encoding of bytes representing the x509 client key data for access the cluster.
- This is only returned for clusters without support for token-based
- authentication. Newly created Kubernetes clusters do not return credentials
- using certificate-based authentication. For additional information, `see here
- `_.
- "expires_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the access token
- expires.
- "server": "str", # Optional. The URL used to access the cluster API server.
- "token": "str" # Optional. An access token used to authenticate with the
- cluster. This is only returned for clusters with support for token-based
- authentication.
+ "run_id": "str" # Optional. ID of the clusterlint run that can be used later
+ to fetch the diagnostics.
+ }
+ # 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_cluster_lint(
+ self,
+ cluster_id: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Run Clusterlint Checks on a Kubernetes Cluster.
+
+ Clusterlint helps operators conform to Kubernetes best practices around
+ resources, security and reliability to avoid common problems while operating
+ or upgrading the clusters.
+
+ To request a clusterlint run on your cluster, send a POST request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
+ checks present in the ``doks`` group by default, if a request body is not
+ specified. Optionally specify the below attributes.
+
+ For information about the available checks, please refer to
+ `the clusterlint check documentation
+ `_.
+
+ :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
+ :type cluster_id: 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 = {
+ "exclude_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "exclude_groups": [
+ "str" # Optional. An array of check groups that will be omitted when
+ clusterlint executes checks.
+ ],
+ "include_checks": [
+ "str" # Optional. An array of checks that will be run when
+ clusterlint executes checks.
+ ],
+ "include_groups": [
+ "str" # Optional. An array of check groups that will be run when
+ clusterlint executes checks.
+ ]
+ }
+
+ # response body for status code(s): 202
+ response == {
+ "run_id": "str" # Optional. ID of the clusterlint run that can be used later
+ to fetch the diagnostics.
}
# response body for status code(s): 404
response == {
@@ -188759,14 +196103,30 @@ def get_credentials(
}
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_kubernetes_get_credentials_request(
+ 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_kubernetes_run_cluster_lint_request(
cluster_id=cluster_id,
- expiry_seconds=expiry_seconds,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -188781,14 +196141,14 @@ def get_credentials(
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")
)
@@ -188826,16 +196186,26 @@ def get_credentials(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
+ def get_cluster_lint_results(
+ self, cluster_id: str, *, run_id: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve Available Upgrades for an Existing Kubernetes Cluster.
+ """Fetch Clusterlint Diagnostics for a Kubernetes Cluster.
- To determine whether a cluster can be upgraded, and the versions to which it
- can be upgraded, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ To request clusterlint diagnostics for your cluster, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. If the ``run_id`` query
+ parameter is provided, then the diagnostics for the specific run is fetched.
+ By default, the latest results are shown.
+
+ To find out how to address clusterlint feedback, please refer to
+ `the clusterlint check documentation
+ `_.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
+ :keyword run_id: Specifies the clusterlint run whose results will be retrieved. Default value
+ is None.
+ :paramtype run_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -188845,20 +196215,31 @@ def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
# response body for status code(s): 200
response == {
- "available_upgrade_versions": [
+ "completed_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the schedule
+ clusterlint run request was completed.
+ "diagnostics": [
{
- "kubernetes_version": "str", # Optional. The upstream
- version string for the version of Kubernetes provided by a given slug.
- "slug": "str", # Optional. The slug identifier for an
- available version of Kubernetes for use when creating or updating a
- cluster. The string contains both the upstream version of Kubernetes as
- well as the DigitalOcean revision.
- "supported_features": [
- "str" # Optional. The features available with the
- version of Kubernetes provided by a given slug.
- ]
+ "check_name": "str", # Optional. The clusterlint check that
+ resulted in the diagnostic.
+ "message": "str", # Optional. Feedback about the object for
+ users to fix.
+ "object": {
+ "kind": "str", # Optional. The kind of Kubernetes
+ API object.
+ "name": "str", # Optional. Name of the object.
+ "namespace": "str" # Optional. The namespace the
+ object resides in the cluster.
+ },
+ "severity": "str" # Optional. Can be one of error, warning
+ or suggestion.
}
- ]
+ ],
+ "requested_at": "2020-02-20 00:00:00", # Optional. A time value given in
+ ISO8601 combined date and time format that represents when the schedule
+ clusterlint run request was made.
+ "run_id": "str" # Optional. Id of the clusterlint run that can be used later
+ to fetch the diagnostics.
}
# response body for status code(s): 404
response == {
@@ -188890,8 +196271,9 @@ def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_available_upgrades_request(
+ _request = build_kubernetes_get_cluster_lint_results_request(
cluster_id=cluster_id,
+ run_id=run_id,
headers=_headers,
params=_params,
)
@@ -188951,33 +196333,25 @@ def get_available_upgrades(self, cluster_id: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
@overload
- def upgrade_cluster(
+ def add_registry( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: JSON,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Upgrade a Kubernetes Cluster.
-
- To immediately upgrade a Kubernetes cluster to a newer patch release of
- Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
- The body of the request must specify a version attribute.
+ ) -> None:
+ """Add Container Registry to Kubernetes Clusters.
- Available upgrade versions for a cluster can be fetched from
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ To integrate the container registry with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registry``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -188985,89 +196359,152 @@ def upgrade_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "version": "str" # Optional. The slug identifier for the version of
- Kubernetes that the cluster will be upgraded to.
- }
-
- # 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.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
"""
@overload
- def upgrade_cluster(
+ def add_registry( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: IO[bytes],
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Upgrade a Kubernetes Cluster.
-
- To immediately upgrade a Kubernetes cluster to a newer patch release of
- Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
- The body of the request must specify a version attribute.
+ ) -> None:
+ """Add Container Registry to Kubernetes Clusters.
- Available upgrade versions for a cluster can be fetched from
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ To integrate the container registry with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registry``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def add_registry( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Add Container Registry to Kubernetes Clusters.
+
+ To integrate the container registry with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registry``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: None
+ :rtype: 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.
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
"""
+ 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 {})
- @distributed_trace
- def upgrade_cluster(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Upgrade a Kubernetes Cluster.
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
- To immediately upgrade a Kubernetes cluster to a newer patch release of
- Kubernetes, send a POST request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrade``.
- The body of the request must specify a version attribute.
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[None] = kwargs.pop("cls", None)
- Available upgrade versions for a cluster can be fetched from
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/upgrades``.
+ 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
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
- :return: JSON object or None
- :rtype: JSON or None
+ _request = build_kubernetes_add_registry_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 [204]:
+ 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 cls:
+ return cls(pipeline_response, None, response_headers) # type: ignore
+
+ @overload
+ def remove_registry( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> None:
+ """Remove Container Registry from Kubernetes Clusters.
+
+ To remove the container registry from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registry``.
+
+ :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: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -189075,20 +196512,60 @@ def upgrade_cluster(
# JSON input template you can fill out and use as your body input.
body = {
- "version": "str" # Optional. The slug identifier for the version of
- Kubernetes that the cluster will be upgraded to.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
+ """
- # 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 remove_registry( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> None:
+ """Remove Container Registry from Kubernetes Clusters.
+
+ To remove the container registry from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registry``.
+
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def remove_registry( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Remove Container Registry from Kubernetes Clusters.
+
+ To remove the container registry from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registry``.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ]
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -189110,7 +196587,7 @@ def upgrade_cluster(
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
+ cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -189118,10 +196595,12 @@ def upgrade_cluster(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_kubernetes_upgrade_cluster_request(
- cluster_id=cluster_id,
+ _request = build_kubernetes_remove_registry_request(
content_type=content_type,
json=_json,
content=_content,
@@ -189139,153 +196618,114 @@ def upgrade_cluster(
response = pipeline_response.http_response
- if response.status_code not in [202, 404]:
+ if response.status_code not in [204]:
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:
- 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 cls:
+ return cls(pipeline_response, None, response_headers) # type: ignore
- if response.content:
- deserialized = response.json()
- else:
- deserialized = None
+ @overload
+ def add_registries( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[JSON] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> None:
+ """Add Container Registries to Kubernetes Clusters.
- if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
+ To integrate the container registries with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registries``.
- return deserialized # type: ignore
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ],
+ "registries": [
+ "str" # Optional. An array containing the registry names.
+ ]
+ }
+ """
+
+ @overload
+ def add_registries( # pylint: disable=inconsistent-return-statements
+ self,
+ body: Optional[IO[bytes]] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> None:
+ """Add Container Registries to Kubernetes Clusters.
+
+ To integrate the container registries with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registries``.
+
+ :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: None
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
@distributed_trace
- def list_node_pools(self, cluster_id: str, **kwargs: Any) -> JSON:
- # pylint: disable=line-too-long
- """List All Node Pools in a Kubernetes Clusters.
+ def add_registries( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Add Container Registries to Kubernetes Clusters.
- To list all of the node pools in a Kubernetes clusters, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools``.
+ To integrate the container registries with Kubernetes clusters, send a POST request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :return: JSON object
- :rtype: JSON
+ :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :type body: JSON or IO[bytes]
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
- # response body for status code(s): 200
- response == {
- "node_pools": [
- {
- "auto_scale": bool, # Optional. A boolean value indicating
- whether auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in
- the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU
- partition mode for this node pool. Only applicable to AMD GPU sizes that
- support partitioning. Immutable after the node pool is created. When
- omitted, the GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings
- specifying labels to apply to all nodes in a pool. Labels will
- automatically be applied to all existing nodes and any subsequent nodes
- added to the pool. Note that when a label is removed, it is not deleted
- from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that
- this node pool can be auto-scaled to. The value will be ``0`` if
- ``auto_scale`` is set to ``false``.
- "name": "str", # Optional. A human-readable name for the
- node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was created.
- "droplet_id": "str", # Optional. The ID of
- the Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that
- can be used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" #
- Optional. A time value given in ISO8601 combined date and time
- format that represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type
- of Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags
- applied to the node pool. All node pools are automatically tagged
- ``k8s``"" , ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node
- reacts to pods that it won't tolerate. Available effect values
- are ``NoSchedule``"" , ``PreferNoSchedule``"" , and
- ``NoExecute``. Known values are: "NoSchedule",
- "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- "value": "str" # Optional. An arbitrary
- string. The ``key`` and ``value`` fields of the ``taint`` object
- form a key-value pair. For example, if the value of the ``key``
- field is "special" and the value of the ``value`` field is "gpu",
- the key value pair would be ``special=gpu``.
- }
- ]
- }
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
+ ],
+ "registries": [
+ "str" # Optional. An array containing the registry names.
]
}
- # 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,
@@ -189300,13 +196740,29 @@ def list_node_pools(self, cluster_id: str, **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 {}
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[None] = kwargs.pop("cls", None)
- _request = build_kubernetes_list_node_pools_request(
- cluster_id=cluster_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_kubernetes_add_registries_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -189321,75 +196777,46 @@ def list_node_pools(self, cluster_id: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [204]:
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
+ 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 cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
-
- return cast(JSON, deserialized) # type: ignore
+ return cls(pipeline_response, None, response_headers) # type: ignore
@overload
- def add_node_pool(
+ def remove_registries( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: JSON,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> JSON:
- # pylint: disable=line-too-long
- """Add a Node Pool to a Kubernetes Cluster.
+ ) -> None:
+ """Remove Container Registries from Kubernetes Clusters.
- To add an additional node pool to a Kubernetes clusters, send a POST request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
- attributes.
+ To remove the container registries from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -189397,297 +196824,52 @@ def add_node_pool(
# JSON input template you can fill out and use as your body input.
body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
- node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
- after the node pool is created. When omitted, the GPUs in the pool are left
- unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of Droplet used
- as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
+ "registries": [
+ "str" # Optional. An array containing the registry names.
]
}
-
- # response body for status code(s): 201
- response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
- }
- # 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 add_node_pool(
+ def remove_registries( # pylint: disable=inconsistent-return-statements
self,
- cluster_id: str,
- body: IO[bytes],
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> JSON:
- # pylint: disable=line-too-long
- """Add a Node Pool to a Kubernetes Cluster.
+ ) -> None:
+ """Remove Container Registries from Kubernetes Clusters.
- To add an additional node pool to a Kubernetes clusters, send a POST request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
- attributes.
+ To remove the container registries from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Required.
+ :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
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # response body for status code(s): 201
- response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
- }
- # 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 add_node_pool(
- self, cluster_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Add a Node Pool to a Kubernetes Cluster.
+ def remove_registries( # pylint: disable=inconsistent-return-statements
+ self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
+ ) -> None:
+ """Remove Container Registries from Kubernetes Clusters.
- To add an additional node pool to a Kubernetes clusters, send a POST request
- to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools`` with the following
- attributes.
+ To remove the container registries from Kubernetes clusters, send a DELETE request to
+ ``/v2/kubernetes/registries``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :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
+ :return: None
+ :rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -189695,161 +196877,14 @@ def add_node_pool(
# JSON input template you can fill out and use as your body input.
body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode for this
- node pool. Only applicable to AMD GPU sizes that support partitioning. Immutable
- after the node pool is created. When omitted, the GPUs in the pool are left
- unpartitioned. Known values are: "AMD_PARTITION_MODE_SPX_NPS1" and
- "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of Droplet used
- as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
+ "cluster_uuids": [
+ "str" # Optional. An array containing the UUIDs of Kubernetes
+ clusters.
],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
+ "registries": [
+ "str" # Optional. An array containing the registry names.
]
}
-
- # response body for status code(s): 201
- response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
- }
- # 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,
@@ -189870,7 +196905,7 @@ def add_node_pool(
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[JSON] = kwargs.pop("cls", None)
+ cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -189878,10 +196913,12 @@ def add_node_pool(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_kubernetes_add_node_pool_request(
- cluster_id=cluster_id,
+ _request = build_kubernetes_remove_registries_request(
content_type=content_type,
json=_json,
content=_content,
@@ -189899,63 +196936,46 @@ def add_node_pool(
response = pipeline_response.http_response
- if response.status_code not in [201, 404]:
+ if response.status_code not in [204]:
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
+ 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 cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
-
- return cast(JSON, deserialized) # type: ignore
+ return cls(pipeline_response, None, response_headers) # type: ignore
@distributed_trace
- def get_node_pool(self, cluster_id: str, node_pool_id: str, **kwargs: Any) -> JSON:
+ def get_status_messages(
+ self,
+ cluster_id: str,
+ *,
+ since: Optional[datetime.datetime] = None,
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve a Node Pool for a Kubernetes Cluster.
+ """Fetch Status Messages for a Kubernetes Cluster.
- To show information about a specific node pool in a Kubernetes cluster, send
- a GET request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
+ To retrieve status messages for a Kubernetes cluster, send a GET request to
+ ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/status_messages``. Status messages inform users of
+ any issues that come up during the cluster lifecycle.
:param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
:type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :keyword since: A timestamp used to return status messages emitted since the specified time.
+ The timestamp should be in ISO8601 format. Default value is None.
+ :paramtype since: ~datetime.datetime
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -189965,77 +196985,14 @@ def get_node_pool(self, cluster_id: str, node_pool_id: str, **kwargs: Any) -> JS
# response body for status code(s): 200
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
- }
- ],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- }
- ]
- }
+ "messages": [
+ {
+ "message": "str", # Optional. Status information about the
+ cluster which impacts it's lifecycle.
+ "timestamp": "2020-02-20 00:00:00" # Optional. A timestamp
+ in ISO8601 format that represents when the status message was emitted.
+ }
+ ]
}
# response body for status code(s): 404
response == {
@@ -190067,9 +197024,9 @@ def get_node_pool(self, cluster_id: str, node_pool_id: str, **kwargs: Any) -> JS
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_node_pool_request(
+ _request = build_kubernetes_get_status_messages_request(
cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ since=since,
headers=_headers,
params=_params,
)
@@ -190128,29 +197085,47 @@ def get_node_pool(self, cluster_id: str, node_pool_id: str, **kwargs: Any) -> JS
return cast(JSON, deserialized) # type: ignore
+
+class LoadBalancersOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`load_balancers` 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 update_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: JSON,
- *,
- 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
- """Update a Node Pool in a Kubernetes Cluster.
+ """Create a New Load Balancer.
- To update the name of a node pool, edit the tags applied to it, or adjust its
- number of nodes, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
- following attributes.
+ To create a new load balancer instance, send a POST request to
+ ``/v2/load_balancers``.
+
+ You can specify the Droplets that will sit behind the load balancer using one
+ of two methods:
+
+
+ * Set ``droplet_ids`` to a list of specific Droplet IDs.
+ * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
+ assigned to the load balancer. Additional Droplets will be automatically
+ assigned as they are tagged.
+
+ These methods are mutually exclusive.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
:param body: Required.
:type body: JSON
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
@@ -190164,180 +197139,247 @@ def update_node_pool(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
+ body = {}
# response body for status code(s): 202
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
+ "load_balancer": {
+ "forwarding_rules": [
{
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
}
],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
{
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
}
- ]
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
}
}
- # 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_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: IO[bytes],
- *,
- 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
- """Update a Node Pool in a Kubernetes Cluster.
+ """Create a New Load Balancer.
- To update the name of a node pool, edit the tags applied to it, or adjust its
- number of nodes, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
- following attributes.
+ To create a new load balancer instance, send a POST request to
+ ``/v2/load_balancers``.
+
+ You can specify the Droplets that will sit behind the load balancer using one
+ of two methods:
+
+
+ * Set ``droplet_ids`` to a list of specific Droplet IDs.
+ * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
+ assigned to the load balancer. Additional Droplets will be automatically
+ assigned as they are tagged.
+
+ These methods are mutually exclusive.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
:param body: Required.
:type body: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -190352,112 +197394,241 @@ def update_node_pool(
# response body for status code(s): 202
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
+ "load_balancer": {
+ "forwarding_rules": [
{
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
}
],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
{
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
}
- ]
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
}
}
- # 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 update_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: Union[JSON, IO[bytes]],
- **kwargs: Any,
- ) -> JSON:
+ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Update a Node Pool in a Kubernetes Cluster.
+ """Create a New Load Balancer.
- To update the name of a node pool, edit the tags applied to it, or adjust its
- number of nodes, send a PUT request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID`` with the
- following attributes.
+ To create a new load balancer instance, send a POST request to
+ ``/v2/load_balancers``.
+
+ You can specify the Droplets that will sit behind the load balancer using one
+ of two methods:
+
+
+ * Set ``droplet_ids`` to a list of specific Droplet IDs.
+ * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
+ assigned to the load balancer. Additional Droplets will be automatically
+ assigned as they are tagged.
+
+ These methods are mutually exclusive.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
:return: JSON object
@@ -190468,155 +197639,224 @@ def update_node_pool(
.. code-block:: python
# JSON input template you can fill out and use as your body input.
- body = {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node pool.
- "id": "str", # Optional. A unique ID that can be used to identify and
- reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying labels
- to apply to all nodes in a pool. Labels will automatically be applied to all
- existing nodes and any subsequent nodes added to the pool. Note that when a label
- is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this node pool
- can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is set to
- ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
- {
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the node was created.
- "droplet_id": "str", # Optional. The ID of the Droplet used
- for the worker node.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference the node.
- "name": "str", # Optional. An automatically generated,
- human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string indicating the
- current status of the node. Known values are: "provisioning",
- "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A time value
- given in ISO8601 combined date and time format that represents when the
- node was last updated.
- }
- ],
- "tags": [
- "str" # Optional. An array containing the tags applied to the node
- pool. All node pools are automatically tagged ``k8s``"" , ``k8s-worker``"" ,
- and ``k8s:$K8S_CLUSTER_ID``. :code:`
`:code:`
`Requires ``tag:read``
- scope.
- ],
- "taints": [
- {
- "effect": "str", # Optional. How the node reacts to pods
- that it won't tolerate. Available effect values are ``NoSchedule``"" ,
- ``PreferNoSchedule``"" , and ``NoExecute``. Known values are:
- "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The ``key``
- and ``value`` fields of the ``taint`` object form a key-value pair. For
- example, if the value of the ``key`` field is "special" and the value of
- the ``value`` field is "gpu", the key value pair would be
- ``special=gpu``.
- }
- ]
- }
+ body = {}
# response body for status code(s): 202
response == {
- "node_pool": {
- "auto_scale": bool, # Optional. A boolean value indicating whether
- auto-scaling is enabled for this node pool.
- "count": 0, # Optional. The number of Droplet instances in the node
- pool.
- "gpu_partition_mode": "str", # Optional. The AMD GPU partition mode
- for this node pool. Only applicable to AMD GPU sizes that support
- partitioning. Immutable after the node pool is created. When omitted, the
- GPUs in the pool are left unpartitioned. Known values are:
- "AMD_PARTITION_MODE_SPX_NPS1" and "AMD_PARTITION_MODE_DPX_NPS2".
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a specific node pool.
- "labels": {}, # Optional. An object of key/value mappings specifying
- labels to apply to all nodes in a pool. Labels will automatically be applied
- to all existing nodes and any subsequent nodes added to the pool. Note that
- when a label is removed, it is not deleted from the nodes in the pool.
- "max_nodes": 0, # Optional. The maximum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "min_nodes": 0, # Optional. The minimum number of nodes that this
- node pool can be auto-scaled to. The value will be ``0`` if ``auto_scale`` is
- set to ``false``.
- "name": "str", # Optional. A human-readable name for the node pool.
- "nodes": [
+ "load_balancer": {
+ "forwarding_rules": [
{
- "created_at": "2020-02-20 00:00:00", # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was created.
- "droplet_id": "str", # Optional. The ID of the
- Droplet used for the worker node.
- "id": "str", # Optional. A unique ID that can be
- used to identify and reference the node.
- "name": "str", # Optional. An automatically
- generated, human-readable name for the node.
- "status": {
- "state": "str" # Optional. A string
- indicating the current status of the node. Known values are:
- "provisioning", "running", "draining", and "deleting".
- },
- "updated_at": "2020-02-20 00:00:00" # Optional. A
- time value given in ISO8601 combined date and time format that
- represents when the node was last updated.
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
}
],
- "size": "str", # Optional. The slug identifier for the type of
- Droplet used as workers in the node pool.
- "tags": [
- "str" # Optional. An array containing the tags applied to
- the node pool. All node pools are automatically tagged ``k8s``"" ,
- ``k8s-worker``"" , and ``k8s:$K8S_CLUSTER_ID``.
- :code:`
`:code:`
`Requires ``tag:read`` scope.
- ],
- "taints": [
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
{
- "effect": "str", # Optional. How the node reacts to
- pods that it won't tolerate. Available effect values are
- ``NoSchedule``"" , ``PreferNoSchedule``"" , and ``NoExecute``. Known
- values are: "NoSchedule", "PreferNoSchedule", and "NoExecute".
- "key": "str", # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
- "value": "str" # Optional. An arbitrary string. The
- ``key`` and ``value`` fields of the ``taint`` object form a key-value
- pair. For example, if the value of the ``key`` field is "special" and
- the value of the ``value`` field is "gpu", the key value pair would
- be ``special=gpu``.
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
}
- ]
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
}
}
- # 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,
@@ -190647,9 +197887,7 @@ def update_node_pool(
else:
_json = body
- _request = build_kubernetes_update_node_pool_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ _request = build_load_balancers_create_request(
content_type=content_type,
json=_json,
content=_content,
@@ -190667,44 +197905,27 @@ def update_node_pool(
response = pipeline_response.http_response
- if response.status_code not in [202, 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 == 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")
- )
+ 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
@@ -190712,40 +197933,259 @@ def update_node_pool(
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def delete_node_pool(
- self, cluster_id: str, node_pool_id: str, **kwargs: Any
- ) -> Optional[JSON]:
+ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Node Pool in a Kubernetes Cluster.
-
- To delete a node pool, send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID``.
+ """List All Load Balancers.
- A 204 status code with no body will be returned in response to a successful
- request. Nodes in the pool will subsequently be drained and deleted.
+ To list all of the load balancer instances on your account, send a GET request
+ to ``/v2/load_balancers``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: 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
+ # 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": {}
+ },
+ "load_balancers": [
+ {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing
+ the port on which the load balancer instance will listen.
+ Required.
+ "entry_protocol": "str", # The protocol used
+ for traffic to the load balancer. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``http3``"" , ``tcp``""
+ , or ``udp``. If you set the ``entry_protocol`` to ``udp``"" ,
+ the ``target_protocol`` must be set to ``udp``. When using UDP,
+ the load balancer requires that you set up a health check with a
+ port that uses TCP, HTTP, or HTTPS to work properly. Required.
+ Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing
+ the port on the backend Droplets to which the load balancer will
+ send traffic. Required.
+ "target_protocol": "str", # The protocol
+ used for traffic from the load balancer to the backend Droplets.
+ The possible values are: ``http``"" , ``https``"" , ``http2``"" ,
+ ``tcp``"" , or ``udp``. If you set the ``target_protocol`` to
+ ``udp``"" , the ``entry_protocol`` must be set to ``udp``. When
+ using UDP, the load balancer requires that you set up a health
+ check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "tcp", and
+ "udp".
+ "certificate_id": "str", # Optional. The ID
+ of the TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A
+ boolean value indicating whether SSL encrypted traffic will be
+ passed through to the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify
+ an algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time
+ value given in ISO8601 combined date and time format that represents when
+ the load balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional.
+ Default value is False. A boolean value indicating whether to disable
+ automatic DNS record creation for Let's Encrypt certificates that are
+ added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID
+ of the TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean
+ value indicating if the domain is already managed by
+ DigitalOcean. If true, all A and AAAA records required to enable
+ Global load balancers will be automatically added.
+ "name": "str" # Optional. FQDN to associate
+ with a Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the
+ Droplets assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value
+ is False. A boolean value indicating whether HTTP keepalive connections
+ are maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is
+ False. A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing
+ traffic to the load balancer (in the form 'ip:1.2.3.4' or
+ 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying
+ traffic to the load balancer (in the form 'ip:1.2.3.4' or
+ 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean
+ flag to enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer
+ value as a percentage to indicate failure threshold to decide how the
+ regional priorities will take effect. A value of ``50`` would
+ indicate that the Global load balancer will choose a lower priority
+ region to forward traffic to once this failure threshold has been
+ reached for the higher priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string
+ to an integer priority value indicating preference for which
+ regional target a Global load balancer will forward traffic to. A
+ lower value indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer
+ representing the port on the target backends which the load balancer
+ will forward traffic to.
+ "target_protocol": "str" # Optional. The protocol
+ used for forwarding traffic from the load balancer to the target
+ backends. The possible values are ``http``"" , ``https`` and
+ ``http2``. Known values are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default
+ value is 10. The number of seconds between between two consecutive
+ health checks.
+ "healthy_threshold": 3, # Optional. Default value is
+ 3. The number of times a health check must pass for a backend Droplet
+ to be marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The
+ path on the backend Droplets to which the load balancer instance will
+ send a request.
+ "port": 80, # Optional. Default value is 80. An
+ integer representing the port on the backend Droplets on which the
+ health check will attempt a connection.
+ "protocol": "http", # Optional. Default value is
+ "http". The protocol used for health checks sent to the backend
+ Droplets. The possible values are ``http``"" , ``https``"" , or
+ ``tcp``. Known values are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default
+ value is 5. The number of seconds the load balancer instance will
+ wait for a response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value
+ is 5. The number of times a health check must fail for a backend
+ Droplet to be marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value
+ is 60. An integer value which configures the idle timeout for HTTP
+ requests to the target droplets.
+ "id": "str", # Optional. A unique ID that can be used to
+ identify and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the
+ public-facing IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load
+ balancer instance.
+ "network": "EXTERNAL", # Optional. Default value is
+ "EXTERNAL". A string indicating whether the load balancer should be
+ external or internal. Internal load balancers have no public IPs and are
+ only accessible to resources on the same VPC network. This property
+ cannot be updated after creating the load balancer. Known values are:
+ "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is
+ "IPV4". A string indicating whether the load balancer will support IPv4
+ or both IPv4 and IPv6 networking. This property cannot be updated after
+ creating the load balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that
+ the load balancer is associated with. If no ID is provided at creation,
+ the load balancer associates with the user's default project. If an
+ invalid project ID is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value
+ is False. A boolean value indicating whether HTTP requests to the load
+ balancer on port 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small".
+ This field has been replaced by the ``size_unit`` field for all regions
+ except in AMS2, NYC2, and SFO1. Each available load balancer size now
+ equates to the load balancer having a set number of nodes. *
+ ``lb-small`` = 1 node * ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes
+ You can resize load balancers after creation up to once per hour. You
+ cannot resize a load balancer within the first hour of its creation.
+ Known values are: "lb-small", "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many
+ nodes the load balancer contains. Each additional node increases the load
+ balancer's ability to manage more connections. Load balancers can be
+ scaled up or down, and you can change the number of nodes after creation
+ up to once per hour. This field is currently not available in the AMS2,
+ NYC2, or SFO1 regions. Use the ``size`` field to scale load balancers
+ that reside in these regions.
+ "status": "str", # Optional. A status string indicating the
+ current state of the load balancer. This can be ``new``"" , ``active``""
+ , or ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the
+ cookie sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of
+ seconds until the cookie set by the load balancer expires. This
+ attribute is only returned when using ``cookies`` for the sticky
+ sessions type.
+ "type": "none" # Optional. Default value is "none".
+ An attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values
+ are ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the
+ UUID of the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag
+ corresponding to Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of
+ the Regional load balancers to be used as target backends for a
+ Global load balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used
+ by the load balancer. The possible values are ``DEFAULT`` or ``STRONG``.
+ The default value is ``DEFAULT``. Known values are: "DEFAULT" and
+ "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL".
+ A string indicating whether the load balancer should be a standard
+ regional HTTP load balancer, a regional network load balancer that routes
+ traffic at the TCP/UDP transport layer, or a global load balancer. Known
+ values are: "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID
+ of the VPC to which the load balancer is assigned.
+ }
+ ]
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -190764,11 +198204,11 @@ def delete_node_pool(
_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_kubernetes_delete_node_pool_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ _request = build_load_balancers_list_request(
+ per_page=per_page,
+ page=page,
headers=_headers,
params=_params,
)
@@ -190783,94 +198223,266 @@ def delete_node_pool(
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
@distributed_trace
- def delete_node(
- self,
- cluster_id: str,
- node_pool_id: str,
- node_id: str,
- *,
- skip_drain: int = 0,
- replace: int = 0,
- **kwargs: Any,
- ) -> Optional[JSON]:
+ def get(self, lb_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Node in a Kubernetes Cluster.
-
- To delete a single node in a pool, send a DELETE request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``.
-
- Appending the ``skip_drain=1`` query parameter to the request causes node
- draining to be skipped. Omitting the query parameter or setting its value to
- ``0`` carries out draining prior to deletion.
+ """Retrieve an Existing Load Balancer.
- Appending the ``replace=1`` query parameter to the request causes the node to
- be replaced by a new one after deletion. Omitting the query parameter or
- setting its value to ``0`` deletes without replacement.
+ To show information about a load balancer instance, send a GET request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
- :param node_id: A unique ID that can be used to reference a node in a Kubernetes node pool.
- Required.
- :type node_id: str
- :keyword skip_drain: Specifies whether or not to drain workloads from a node before it is
- deleted. Setting it to ``1`` causes node draining to be skipped. Omitting the query parameter
- or setting its value to ``0`` carries out draining prior to deletion. Default value is 0.
- :paramtype skip_drain: int
- :keyword replace: Specifies whether or not to replace a node after it has been deleted. Setting
- it to ``1`` causes the node to be replaced by a new one after deletion. Omitting the query
- parameter or setting its value to ``0`` deletes without replacement. Default value is 0.
- :paramtype replace: int
- :return: JSON object or None
- :rtype: JSON or None
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
+ # response body for status code(s): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -190899,14 +198511,10 @@ def delete_node(
_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_kubernetes_delete_node_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
- node_id=node_id,
- skip_drain=skip_drain,
- replace=replace,
+ _request = build_load_balancers_get_request(
+ lb_id=lb_id,
headers=_headers,
params=_params,
)
@@ -190921,15 +198529,14 @@ def delete_node(
response = pipeline_response.http_response
- if response.status_code not in [202, 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 == 202:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -190940,6 +198547,11 @@ def delete_node(
"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")
@@ -190957,51 +198569,262 @@ def delete_node(
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 recycle_node_pool(
+ def update(
self,
- cluster_id: str,
- node_pool_id: str,
+ lb_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Recycle a Kubernetes Node Pool.
+ """Update a Load Balancer.
- The endpoint has been deprecated. Please use the DELETE
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
- method instead.
+ To update a load balancer's settings, send a PUT request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
+ representation of the load balancer including existing attributes. It may
+ contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
+ exclusive. **Note that any attribute that is not provided will be reset to its
+ default value.**.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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
# JSON input template you can fill out and use as your body input.
- body = {
- "nodes": [
- "str" # Optional.
- ]
- }
+ body = {}
+ # response body for status code(s): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -191016,39 +198839,254 @@ def recycle_node_pool(
"""
@overload
- def recycle_node_pool(
+ def update(
self,
- cluster_id: str,
- node_pool_id: str,
+ lb_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Recycle a Kubernetes Node Pool.
+ """Update a Load Balancer.
- The endpoint has been deprecated. Please use the DELETE
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
- method instead.
+ To update a load balancer's settings, send a PUT request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
+ representation of the load balancer including existing attributes. It may
+ contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
+ exclusive. **Note that any attribute that is not provided will be reset to its
+ default value.**.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
+ }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -191063,41 +199101,247 @@ def recycle_node_pool(
"""
@distributed_trace
- def recycle_node_pool(
- self,
- cluster_id: str,
- node_pool_id: str,
- body: Union[JSON, IO[bytes]],
- **kwargs: Any,
- ) -> Optional[JSON]:
+ def update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Recycle a Kubernetes Node Pool.
+ """Update a Load Balancer.
- The endpoint has been deprecated. Please use the DELETE
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/node_pools/$NODE_POOL_ID/nodes/$NODE_ID``
- method instead.
+ To update a load balancer's settings, send a PUT request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
+ representation of the load balancer including existing attributes. It may
+ contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
+ exclusive. **Note that any attribute that is not provided will be reset to its
+ default value.**.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param node_pool_id: A unique ID that can be used to reference a Kubernetes node pool.
- Required.
- :type node_pool_id: str
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
: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 = {
- "nodes": [
- "str" # Optional.
- ]
+ body = {}
+
+ # response body for status code(s): 200
+ response == {
+ "load_balancer": {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port
+ on which the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for
+ traffic to the load balancer. The possible values are: ``http``"" ,
+ ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
+ you set the ``entry_protocol`` to ``udp``"" , the
+ ``target_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "http3", "tcp", and "udp".
+ "target_port": 0, # An integer representing the port
+ on the backend Droplets to which the load balancer will send traffic.
+ Required.
+ "target_protocol": "str", # The protocol used for
+ traffic from the load balancer to the backend Droplets. The possible
+ values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
+ ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
+ ``entry_protocol`` must be set to ``udp``. When using UDP, the load
+ balancer requires that you set up a health check with a port that
+ uses TCP, HTTP, or HTTPS to work properly. Required. Known values
+ are: "http", "https", "http2", "tcp", and "udp".
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to
+ the backend Droplets.
+ }
+ ],
+ "algorithm": "round_robin", # Optional. Default value is
+ "round_robin". This field has been deprecated. You can no longer specify an
+ algorithm for load balancers. Known values are: "round_robin" and
+ "least_connections".
+ "created_at": "2020-02-20 00:00:00", # Optional. A time value given
+ in ISO8601 combined date and time format that represents when the load
+ balancer was created.
+ "disable_lets_encrypt_dns_records": False, # Optional. Default value
+ is False. A boolean value indicating whether to disable automatic DNS record
+ creation for Let's Encrypt certificates that are added to the load balancer.
+ "domains": [
+ {
+ "certificate_id": "str", # Optional. The ID of the
+ TLS certificate used for SSL termination.
+ "is_managed": bool, # Optional. A boolean value
+ indicating if the domain is already managed by DigitalOcean. If true,
+ all A and AAAA records required to enable Global load balancers will
+ be automatically added.
+ "name": "str" # Optional. FQDN to associate with a
+ Global load balancer.
+ }
+ ],
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets
+ assigned to the load balancer.
+ ],
+ "enable_backend_keepalive": False, # Optional. Default value is
+ False. A boolean value indicating whether HTTP keepalive connections are
+ maintained to target Droplets.
+ "enable_proxy_protocol": False, # Optional. Default value is False.
+ A boolean value indicating whether PROXY Protocol is in use.
+ "firewall": {
+ "allow": [
+ "str" # Optional. the rules for allowing traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ],
+ "deny": [
+ "str" # Optional. the rules for denying traffic to
+ the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
+ ]
+ },
+ "glb_settings": {
+ "cdn": {
+ "is_enabled": bool # Optional. A boolean flag to
+ enable CDN caching.
+ },
+ "failover_threshold": 0, # Optional. An integer value as a
+ percentage to indicate failure threshold to decide how the regional
+ priorities will take effect. A value of ``50`` would indicate that the
+ Global load balancer will choose a lower priority region to forward
+ traffic to once this failure threshold has been reached for the higher
+ priority region.
+ "region_priorities": {
+ "str": 0 # Optional. A map of region string to an
+ integer priority value indicating preference for which regional
+ target a Global load balancer will forward traffic to. A lower value
+ indicates a higher priority.
+ },
+ "target_port": 0, # Optional. An integer representing the
+ port on the target backends which the load balancer will forward traffic
+ to.
+ "target_protocol": "str" # Optional. The protocol used for
+ forwarding traffic from the load balancer to the target backends. The
+ possible values are ``http``"" , ``https`` and ``http2``. Known values
+ are: "http", "https", and "http2".
+ },
+ "health_check": {
+ "check_interval_seconds": 10, # Optional. Default value is
+ 10. The number of seconds between between two consecutive health checks.
+ "healthy_threshold": 3, # Optional. Default value is 3. The
+ number of times a health check must pass for a backend Droplet to be
+ marked "healthy" and be re-added to the pool.
+ "path": "/", # Optional. Default value is "/". The path on
+ the backend Droplets to which the load balancer instance will send a
+ request.
+ "port": 80, # Optional. Default value is 80. An integer
+ representing the port on the backend Droplets on which the health check
+ will attempt a connection.
+ "protocol": "http", # Optional. Default value is "http". The
+ protocol used for health checks sent to the backend Droplets. The
+ possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
+ are: "http", "https", and "tcp".
+ "response_timeout_seconds": 5, # Optional. Default value is
+ 5. The number of seconds the load balancer instance will wait for a
+ response until marking a health check as failed.
+ "unhealthy_threshold": 5 # Optional. Default value is 5. The
+ number of times a health check must fail for a backend Droplet to be
+ marked "unhealthy" and be removed from the pool.
+ },
+ "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
+ integer value which configures the idle timeout for HTTP requests to the
+ target droplets.
+ "id": "str", # Optional. A unique ID that can be used to identify
+ and reference a load balancer.
+ "ipv6": "str", # Optional. An attribute containing the public-facing
+ IPv6 address of the load balancer.
+ "name": "str", # Optional. A human-readable name for a load balancer
+ instance.
+ "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
+ string indicating whether the load balancer should be external or internal.
+ Internal load balancers have no public IPs and are only accessible to
+ resources on the same VPC network. This property cannot be updated after
+ creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
+ "network_stack": "IPV4", # Optional. Default value is "IPV4". A
+ string indicating whether the load balancer will support IPv4 or both IPv4
+ and IPv6 networking. This property cannot be updated after creating the load
+ balancer. Known values are: "IPV4" and "DUALSTACK".
+ "project_id": "str", # Optional. The ID of the project that the load
+ balancer is associated with. If no ID is provided at creation, the load
+ balancer associates with the user's default project. If an invalid project ID
+ is provided, the load balancer will not be created.
+ "redirect_http_to_https": False, # Optional. Default value is False.
+ A boolean value indicating whether HTTP requests to the load balancer on port
+ 80 will be redirected to HTTPS on port 443.
+ "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": "lb-small", # Optional. Default value is "lb-small". This
+ field has been replaced by the ``size_unit`` field for all regions except in
+ AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
+ load balancer having a set number of nodes. * ``lb-small`` = 1 node *
+ ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
+ balancers after creation up to once per hour. You cannot resize a load
+ balancer within the first hour of its creation. Known values are: "lb-small",
+ "lb-medium", and "lb-large".
+ "size_unit": 1, # Optional. Default value is 1. How many nodes the
+ load balancer contains. Each additional node increases the load balancer's
+ ability to manage more connections. Load balancers can be scaled up or down,
+ and you can change the number of nodes after creation up to once per hour.
+ This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
+ the ``size`` field to scale load balancers that reside in these regions.
+ "status": "str", # Optional. A status string indicating the current
+ state of the load balancer. This can be ``new``"" , ``active``"" , or
+ ``errored``. Known values are: "new", "active", and "errored".
+ "sticky_sessions": {
+ "cookie_name": "str", # Optional. The name of the cookie
+ sent to the client. This attribute is only returned when using
+ ``cookies`` for the sticky sessions type.
+ "cookie_ttl_seconds": 0, # Optional. The number of seconds
+ until the cookie set by the load balancer expires. This attribute is only
+ returned when using ``cookies`` for the sticky sessions type.
+ "type": "none" # Optional. Default value is "none". An
+ attribute indicating how and if requests from a client will be
+ persistently served by the same backend Droplet. The possible values are
+ ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ },
+ "subnet_uuid": "str", # Optional. A string specifying the UUID of
+ the VPC subnet to which the load balancer is assigned.
+ "tag": "str", # Optional. The name of a Droplet tag corresponding to
+ Droplets assigned to the load balancer.
+ "target_load_balancer_ids": [
+ "str" # Optional. An array containing the UUIDs of the
+ Regional load balancers to be used as target backends for a Global load
+ balancer.
+ ],
+ "tls_cipher_policy": "DEFAULT", # Optional. Default value is
+ "DEFAULT". A string indicating the policy for the TLS cipher suites used by
+ the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
+ default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
+ "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
+ string indicating whether the load balancer should be a standard regional
+ HTTP load balancer, a regional network load balancer that routes traffic at
+ the TCP/UDP transport layer, or a global load balancer. Known values are:
+ "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
+ "vpc_uuid": "str" # Optional. A string specifying the UUID of the
+ VPC to which the load balancer is assigned.
+ }
}
-
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -191129,7 +199373,7 @@ def recycle_node_pool(
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
@@ -191139,9 +199383,8 @@ def recycle_node_pool(
else:
_json = body
- _request = build_kubernetes_recycle_node_pool_request(
- cluster_id=cluster_id,
- node_pool_id=node_pool_id,
+ _request = build_load_balancers_update_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -191159,15 +199402,14 @@ def recycle_node_pool(
response = pipeline_response.http_response
- if response.status_code not in [202, 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 == 202:
+ if response.status_code == 200:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -191178,6 +199420,11 @@ def recycle_node_pool(
"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")
@@ -191195,38 +199442,31 @@ def recycle_node_pool(
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_cluster_user(self, cluster_id: str, **kwargs: Any) -> JSON:
+ def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Retrieve User Information for a Kubernetes Cluster.
+ """Delete a Load Balancer.
- To show information the user associated with a Kubernetes cluster, send a GET
- request to ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/user``.
+ To delete a load balancer instance, disassociating any Droplets assigned to it
+ and removing it from your account, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID``.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :return: JSON object
- :rtype: JSON
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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 == {
- "kubernetes_cluster_user": {
- "groups": [
- "str" # Optional. A list of in-cluster groups that the user
- belongs to.
- ],
- "username": "str" # Optional. The username for the cluster admin
- user.
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -191255,10 +199495,10 @@ def get_cluster_user(self, cluster_id: 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_kubernetes_get_cluster_user_request(
- cluster_id=cluster_id,
+ _request = build_load_balancers_delete_request(
+ lb_id=lb_id,
headers=_headers,
params=_params,
)
@@ -191273,14 +199513,15 @@ def get_cluster_user(self, cluster_id: 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")
)
@@ -191291,11 +199532,6 @@ def get_cluster_user(self, cluster_id: 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")
@@ -191313,61 +199549,30 @@ def get_cluster_user(self, cluster_id: 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 list_options(self, **kwargs: Any) -> JSON:
+ def delete_cache(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
# pylint: disable=line-too-long
- """List Available Regions, Node Sizes, and Versions of Kubernetes.
+ """Delete a Global Load Balancer CDN Cache.
- To list the versions of Kubernetes available for use, the regions that support Kubernetes, and
- the available node sizes, send a GET request to ``/v2/kubernetes/options``.
+ To delete a Global load balancer CDN cache, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/cache``.
- :return: JSON object
- :rtype: JSON
+ A successful request will receive a 204 status code with no body in response.
+ This indicates that the request was processed successfully.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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 == {
- "options": {
- "regions": [
- {
- "name": "str", # Optional. A DigitalOcean region
- where Kubernetes is available.
- "slug": "str" # Optional. The identifier for a
- region for use when creating a new cluster.
- }
- ],
- "sizes": [
- {
- "name": "str", # Optional. A Droplet size available
- for use in a Kubernetes node pool.
- "slug": "str" # Optional. The identifier for a size
- for use when creating a new cluster.
- }
- ],
- "versions": [
- {
- "kubernetes_version": "str", # Optional. The
- upstream version string for the version of Kubernetes provided by a
- given slug.
- "slug": "str", # Optional. The slug identifier for
- an available version of Kubernetes for use when creating or updating
- a cluster. The string contains both the upstream version of
- Kubernetes as well as the DigitalOcean revision.
- "supported_features": [
- "str" # Optional. The features available
- with the version of Kubernetes provided by a given slug.
- ]
- }
- ]
- }
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -191396,9 +199601,10 @@ def list_options(self, **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_kubernetes_list_options_request(
+ _request = build_load_balancers_delete_cache_request(
+ lb_id=lb_id,
headers=_headers,
params=_params,
)
@@ -191413,14 +199619,15 @@ def list_options(self, **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")
)
@@ -191431,11 +199638,6 @@ def list_options(self, **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")
@@ -191453,44 +199655,42 @@ def list_options(self, **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
@overload
- def run_cluster_lint(
+ def add_droplets(
self,
- cluster_id: str,
- body: Optional[JSON] = None,
+ lb_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Run Clusterlint Checks on a Kubernetes Cluster.
-
- Clusterlint helps operators conform to Kubernetes best practices around
- resources, security and reliability to avoid common problems while operating
- or upgrading the clusters.
+ """Add Droplets to a Load Balancer.
- To request a clusterlint run on your cluster, send a POST request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
- checks present in the ``doks`` group by default, if a request body is not
- specified. Optionally specify the below attributes.
+ To assign a Droplet to a load balancer instance, send a POST request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ Individual Droplets can not be added to a load balancer configured with a
+ Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
+ response from the API.
- For information about the available checks, please refer to
- `the clusterlint check documentation
- `_.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Default value is None.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
:paramtype content_type: str
- :return: JSON object
- :rtype: JSON
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -191498,29 +199698,12 @@ def run_cluster_lint(
# JSON input template you can fill out and use as your body input.
body = {
- "exclude_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "exclude_groups": [
- "str" # Optional. An array of check groups that will be omitted when
- clusterlint executes checks.
- ],
- "include_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "include_groups": [
- "str" # Optional. An array of check groups that will be run when
- clusterlint executes checks.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
- # response body for status code(s): 202
- response == {
- "run_id": "str" # Optional. ID of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -191535,121 +199718,42 @@ def run_cluster_lint(
"""
@overload
- def run_cluster_lint(
+ def add_droplets(
self,
- cluster_id: str,
- body: Optional[IO[bytes]] = None,
+ lb_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Run Clusterlint Checks on a Kubernetes Cluster.
-
- Clusterlint helps operators conform to Kubernetes best practices around
- resources, security and reliability to avoid common problems while operating
- or upgrading the clusters.
+ """Add Droplets to a Load Balancer.
- To request a clusterlint run on your cluster, send a POST request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
- checks present in the ``doks`` group by default, if a request body is not
- specified. Optionally specify the below attributes.
+ To assign a Droplet to a load balancer instance, send a POST request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ Individual Droplets can not be added to a load balancer configured with a
+ Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
+ response from the API.
- For information about the available checks, please refer to
- `the clusterlint check documentation
- `_.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :param body: Default value is None.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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 == {
- "run_id": "str" # Optional. ID of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
- # 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_cluster_lint(
- self,
- cluster_id: str,
- body: Optional[Union[JSON, IO[bytes]]] = None,
- **kwargs: Any,
- ) -> JSON:
- # pylint: disable=line-too-long
- """Run Clusterlint Checks on a Kubernetes Cluster.
-
- Clusterlint helps operators conform to Kubernetes best practices around
- resources, security and reliability to avoid common problems while operating
- or upgrading the clusters.
-
- To request a clusterlint run on your cluster, send a POST request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. This will run all
- checks present in the ``doks`` group by default, if a request body is not
- specified. Optionally specify the below attributes.
-
- For information about the available checks, please refer to
- `the clusterlint check documentation
- `_.
-
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: 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
+ :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 = {
- "exclude_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "exclude_groups": [
- "str" # Optional. An array of check groups that will be omitted when
- clusterlint executes checks.
- ],
- "include_checks": [
- "str" # Optional. An array of checks that will be run when
- clusterlint executes checks.
- ],
- "include_groups": [
- "str" # Optional. An array of check groups that will be run when
- clusterlint executes checks.
- ]
- }
-
- # response body for status code(s): 202
- response == {
- "run_id": "str" # Optional. ID of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -191662,627 +199766,31 @@ def run_cluster_lint(
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_kubernetes_run_cluster_lint_request(
- cluster_id=cluster_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 [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 == 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 cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
-
- return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def get_cluster_lint_results(
- self, cluster_id: str, *, run_id: Optional[str] = None, **kwargs: Any
- ) -> JSON:
+ def add_droplets(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Fetch Clusterlint Diagnostics for a Kubernetes Cluster.
-
- To request clusterlint diagnostics for your cluster, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/clusterlint``. If the ``run_id`` query
- parameter is provided, then the diagnostics for the specific run is fetched.
- By default, the latest results are shown.
-
- To find out how to address clusterlint feedback, please refer to
- `the clusterlint check documentation
- `_.
-
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :keyword run_id: Specifies the clusterlint run whose results will be retrieved. Default value
- is None.
- :paramtype run_id: str
- :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 that represents when the schedule
- clusterlint run request was completed.
- "diagnostics": [
- {
- "check_name": "str", # Optional. The clusterlint check that
- resulted in the diagnostic.
- "message": "str", # Optional. Feedback about the object for
- users to fix.
- "object": {
- "kind": "str", # Optional. The kind of Kubernetes
- API object.
- "name": "str", # Optional. Name of the object.
- "namespace": "str" # Optional. The namespace the
- object resides in the cluster.
- },
- "severity": "str" # Optional. Can be one of error, warning
- or suggestion.
- }
- ],
- "requested_at": "2020-02-20 00:00:00", # Optional. A time value given in
- ISO8601 combined date and time format that represents when the schedule
- clusterlint run request was made.
- "run_id": "str" # Optional. Id of the clusterlint run that can be used later
- to fetch the diagnostics.
- }
- # 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_kubernetes_get_cluster_lint_results_request(
- cluster_id=cluster_id,
- run_id=run_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 add_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> None:
- """Add Container Registry to Kubernetes Clusters.
-
- To integrate the container registry with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
-
- @overload
- def add_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> None:
- """Add Container Registry to Kubernetes Clusters.
-
- To integrate the container registry with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
-
- @distributed_trace
- def add_registry( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Add Container Registry to Kubernetes Clusters.
-
- To integrate the container registry with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registry``.
-
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
- :return: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
- 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[None] = 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_kubernetes_add_registry_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 [204]:
- 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 cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
-
- @overload
- def remove_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> None:
- """Remove Container Registry from Kubernetes Clusters.
-
- To remove the container registry from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
-
- @overload
- def remove_registry( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> None:
- """Remove Container Registry from Kubernetes Clusters.
-
- To remove the container registry from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registry``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
-
- @distributed_trace
- def remove_registry( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Remove Container Registry from Kubernetes Clusters.
-
- To remove the container registry from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registry``.
-
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
- :type body: JSON or IO[bytes]
- :return: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ]
- }
- """
- 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[None] = 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_kubernetes_remove_registry_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 [204]:
- 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 cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
-
- @overload
- def add_registries( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[JSON] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> None:
- """Add Container Registries to Kubernetes Clusters.
-
- To integrate the container registries with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registries``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
-
- Example:
- .. code-block:: python
-
- # JSON input template you can fill out and use as your body input.
- body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
- ]
- }
- """
-
- @overload
- def add_registries( # pylint: disable=inconsistent-return-statements
- self,
- body: Optional[IO[bytes]] = None,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> None:
- """Add Container Registries to Kubernetes Clusters.
-
- To integrate the container registries with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registries``.
-
- :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: None
- :rtype: None
- :raises ~azure.core.exceptions.HttpResponseError:
- """
+ """Add Droplets to a Load Balancer.
- @distributed_trace
- def add_registries( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Add Container Registries to Kubernetes Clusters.
+ To assign a Droplet to a load balancer instance, send a POST request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ Individual Droplets can not be added to a load balancer configured with a
+ Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
+ response from the API.
- To integrate the container registries with Kubernetes clusters, send a POST request to
- ``/v2/kubernetes/registries``.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: None
- :rtype: None
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -192290,14 +199798,23 @@ def add_registries( # pylint: disable=inconsistent-return-statements
# JSON input template you can fill out and use as your body input.
body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
+
+ # 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,
@@ -192318,7 +199835,7 @@ def add_registries( # pylint: disable=inconsistent-return-statements
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -192326,12 +199843,10 @@ def add_registries( # pylint: disable=inconsistent-return-statements
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_kubernetes_add_registries_request(
+ _request = build_load_balancers_add_droplets_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -192349,46 +199864,75 @@ def add_registries( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [204]:
+ 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.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, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@overload
- def remove_registries( # pylint: disable=inconsistent-return-statements
+ def remove_droplets(
self,
- body: Optional[JSON] = None,
+ lb_id: str,
+ body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> None:
- """Remove Container Registries from Kubernetes Clusters.
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Droplets from a Load Balancer.
- To remove the container registries from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registries``.
+ To remove a Droplet from a load balancer instance, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- :param body: Default value is None.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
:paramtype content_type: str
- :return: None
- :rtype: None
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -192396,52 +199940,93 @@ def remove_registries( # pylint: disable=inconsistent-return-statements
# JSON input template you can fill out and use as your body input.
body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
+
+ # 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 remove_registries( # pylint: disable=inconsistent-return-statements
+ def remove_droplets(
self,
- body: Optional[IO[bytes]] = None,
+ lb_id: str,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> None:
- """Remove Container Registries from Kubernetes Clusters.
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Droplets from a Load Balancer.
- To remove the container registries from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registries``.
+ To remove a Droplet from a load balancer instance, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- :param body: Default value is None.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
:paramtype content_type: str
- :return: None
- :rtype: None
+ :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
- def remove_registries( # pylint: disable=inconsistent-return-statements
- self, body: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
- ) -> None:
- """Remove Container Registries from Kubernetes Clusters.
+ def remove_droplets(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Droplets from a Load Balancer.
- To remove the container registries from Kubernetes clusters, send a DELETE request to
- ``/v2/kubernetes/registries``.
+ To remove a Droplet from a load balancer instance, send a DELETE request to
+ ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
+ there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- :param body: Is either a JSON type or a IO[bytes] type. Default value is None.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
:type body: JSON or IO[bytes]
- :return: None
- :rtype: None
+ :return: JSON object or None
+ :rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -192449,14 +200034,23 @@ def remove_registries( # pylint: disable=inconsistent-return-statements
# JSON input template you can fill out and use as your body input.
body = {
- "cluster_uuids": [
- "str" # Optional. An array containing the UUIDs of Kubernetes
- clusters.
- ],
- "registries": [
- "str" # Optional. An array containing the registry names.
+ "droplet_ids": [
+ 0 # Optional. An array containing the IDs of the Droplets assigned
+ to the load balancer.
]
}
+
+ # 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,
@@ -192477,7 +200071,7 @@ def remove_registries( # pylint: disable=inconsistent-return-statements
content_type: Optional[str] = kwargs.pop(
"content_type", _headers.pop("Content-Type", None)
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -192485,12 +200079,10 @@ def remove_registries( # pylint: disable=inconsistent-return-statements
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- if body is not None:
- _json = body
- else:
- _json = None
+ _json = body
- _request = build_kubernetes_remove_registries_request(
+ _request = build_load_balancers_remove_droplets_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -192508,64 +200100,235 @@ def remove_registries( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [204]:
+ 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.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, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- @distributed_trace
- def get_status_messages(
+ return deserialized # type: ignore
+
+ @overload
+ def add_forwarding_rules(
self,
- cluster_id: str,
+ lb_id: str,
+ body: JSON,
*,
- since: Optional[datetime.datetime] = None,
+ content_type: str = "application/json",
**kwargs: Any,
- ) -> JSON:
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Fetch Status Messages for a Kubernetes Cluster.
+ """Add Forwarding Rules to a Load Balancer.
- To retrieve status messages for a Kubernetes cluster, send a GET request to
- ``/v2/kubernetes/clusters/$K8S_CLUSTER_ID/status_messages``. Status messages inform users of
- any issues that come up during the cluster lifecycle.
+ To add an additional forwarding rule to a load balancer instance, send a POST
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
+ of the request, there should be a ``forwarding_rules`` attribute containing an
+ array of rules to be added.
- :param cluster_id: A unique ID that can be used to reference a Kubernetes cluster. Required.
- :type cluster_id: str
- :keyword since: A timestamp used to return status messages emitted since the specified time.
- The timestamp should be in ISO8601 format. Default value is None.
- :paramtype since: ~datetime.datetime
- :return: JSON object
- :rtype: JSON
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
+ :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): 200
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
+ }
+ ]
+ }
+
+ # response body for status code(s): 404
response == {
- "messages": [
+ "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 add_forwarding_rules(
+ self,
+ lb_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Add Forwarding Rules to a Load Balancer.
+
+ To add an additional forwarding rule to a load balancer instance, send a POST
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
+ of the request, there should be a ``forwarding_rules`` attribute containing an
+ array of rules to be added.
+
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
+ :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
+ def add_forwarding_rules(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Add Forwarding Rules to a Load Balancer.
+
+ To add an additional forwarding rule to a load balancer instance, send a POST
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
+ of the request, there should be a ``forwarding_rules`` attribute containing an
+ array of rules to be added.
+
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :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 = {
+ "forwarding_rules": [
{
- "message": "str", # Optional. Status information about the
- cluster which impacts it's lifecycle.
- "timestamp": "2020-02-20 00:00:00" # Optional. A timestamp
- in ISO8601 format that represents when the status message was emitted.
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
}
]
}
+
# response body for status code(s): 404
response == {
"id": "str", # A short identifier corresponding to the HTTP status code
@@ -192591,14 +200354,27 @@ def get_status_messages(
}
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[JSON] = kwargs.pop("cls", None)
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_kubernetes_get_status_messages_request(
- cluster_id=cluster_id,
- since=since,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_load_balancers_add_forwarding_rules_request(
+ lb_id=lb_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -192613,14 +200389,15 @@ def get_status_messages(
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")
)
@@ -192631,11 +200408,6 @@ def get_status_messages(
"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")
@@ -192653,781 +200425,209 @@ def get_status_messages(
deserialized = None
if cls:
- return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
-
- return cast(JSON, deserialized) # type: ignore
-
-
-class LoadBalancersOperations:
- """
- .. warning::
- **DO NOT** instantiate this class directly.
-
- Instead, you should access the following operations through
- :class:`~pydo.GeneratedClient`'s
- :attr:`load_balancers` attribute.
- """
+ return cls(pipeline_response, 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 deserialized # type: ignore
@overload
- def create(
- self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
+ def remove_forwarding_rules(
+ self,
+ lb_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a New Load Balancer.
-
- To create a new load balancer instance, send a POST request to
- ``/v2/load_balancers``.
-
- You can specify the Droplets that will sit behind the load balancer using one
- of two methods:
-
+ """Remove Forwarding Rules from a Load Balancer.
- * Set ``droplet_ids`` to a list of specific Droplet IDs.
- * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
- assigned to the load balancer. Additional Droplets will be automatically
- assigned as they are tagged.
+ To remove forwarding rules from a load balancer instance, send a DELETE
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
+ body of the request, there should be a ``forwarding_rules`` attribute containing
+ an array of rules to be removed.
- These methods are mutually exclusive.
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
: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
# JSON input template you can fill out and use as your body input.
- body = {}
-
- # response body for status code(s): 202
- response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
- }
- """
-
- @overload
- def create(
- self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
- ) -> JSON:
- # pylint: disable=line-too-long
- """Create a New Load Balancer.
-
- To create a new load balancer instance, send a POST request to
- ``/v2/load_balancers``.
-
- You can specify the Droplets that will sit behind the load balancer using one
- of two methods:
-
-
- * Set ``droplet_ids`` to a list of specific Droplet IDs.
- * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
- assigned to the load balancer. Additional Droplets will be automatically
- assigned as they are tagged.
-
- These methods are mutually exclusive.
-
- :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 == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
+ body = {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
+ }
+ ]
+ }
+
+ # 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: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ @overload
+ def remove_forwarding_rules(
+ self,
+ lb_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> Optional[JSON]:
# pylint: disable=line-too-long
- """Create a New Load Balancer.
+ """Remove Forwarding Rules from a Load Balancer.
- To create a new load balancer instance, send a POST request to
- ``/v2/load_balancers``.
+ To remove forwarding rules from a load balancer instance, send a DELETE
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
+ body of the request, there should be a ``forwarding_rules`` attribute containing
+ an array of rules to be removed.
- You can specify the Droplets that will sit behind the load balancer using one
- of two methods:
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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".
+ :paramtype content_type: str
+ :return: JSON object or None
+ :rtype: JSON or None
+ :raises ~azure.core.exceptions.HttpResponseError:
- * Set ``droplet_ids`` to a list of specific Droplet IDs.
- * Set ``tag`` to the name of a tag. All Droplets with this tag applied will be
- assigned to the load balancer. Additional Droplets will be automatically
- assigned as they are tagged.
+ Example:
+ .. code-block:: python
- These methods are mutually exclusive.
+ # 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 remove_forwarding_rules(
+ self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> Optional[JSON]:
+ # pylint: disable=line-too-long
+ """Remove Forwarding Rules from a Load Balancer.
+
+ To remove forwarding rules from a load balancer instance, send a DELETE
+ request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
+ body of the request, there should be a ``forwarding_rules`` attribute containing
+ an array of rules to be removed.
+
+ No response body will be sent back, but the response code will indicate
+ success. Specifically, the response code will be a 204, which means that the
+ action was successful with no returned body data.
+ :param lb_id: A unique identifier for a load balancer. Required.
+ :type lb_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
+ :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 = {}
+ body = {
+ "forwarding_rules": [
+ {
+ "entry_port": 0, # An integer representing the port on which
+ the load balancer instance will listen. Required.
+ "entry_protocol": "str", # The protocol used for traffic to
+ the load balancer. The possible values are: ``http``"" , ``https``"" ,
+ ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
+ ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
+ ``udp``. When using UDP, the load balancer requires that you set up a
+ health check with a port that uses TCP, HTTP, or HTTPS to work properly.
+ Required. Known values are: "http", "https", "http2", "http3", "tcp", and
+ "udp".
+ "target_port": 0, # An integer representing the port on the
+ backend Droplets to which the load balancer will send traffic. Required.
+ "target_protocol": "str", # The protocol used for traffic
+ from the load balancer to the backend Droplets. The possible values are:
+ ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
+ set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
+ set to ``udp``. When using UDP, the load balancer requires that you set
+ up a health check with a port that uses TCP, HTTP, or HTTPS to work
+ properly. Required. Known values are: "http", "https", "http2", "tcp",
+ and "udp".
+ "certificate_id": "str", # Optional. The ID of the TLS
+ certificate used for SSL termination if enabled.
+ "tls_passthrough": bool # Optional. A boolean value
+ indicating whether SSL encrypted traffic will be passed through to the
+ backend Droplets.
+ }
+ ]
+ }
- # response body for status code(s): 202
+ # response body for status code(s): 404
response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
+ "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]] = {
@@ -193449,7 +200649,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
@@ -193459,7 +200659,8 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
else:
_json = body
- _request = build_load_balancers_create_request(
+ _request = build_load_balancers_remove_forwarding_rules_request(
+ lb_id=lb_id,
content_type=content_type,
json=_json,
content=_content,
@@ -193477,45 +200678,95 @@ 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 [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
+
+
+class MicrovmsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`microvms` 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 list(
+ self,
+ *,
+ page: int = 1,
+ per_page: int = 25,
+ region: Optional[str] = None,
+ name: Optional[str] = None,
+ tag_name: Optional[str] = None,
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """List All Load Balancers.
+ """List all MicroVMs.
- To list all of the load balancer instances on your account, send a GET request
- to ``/v2/load_balancers``.
+ To list all of the MicroVMs on your team, send a GET request to ``/v2/microvms``.
+
+ The ``region``\\ , ``name``\\ , and ``tag_name`` filters combine with AND.
- :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 per_page: Number of items returned per page. Default value is 25.
+ :paramtype per_page: int
+ :keyword region: Only return MicroVMs in this region. Default value is None.
+ :paramtype region: str
+ :keyword name: Only return the MicroVM with this exact name. Default value is None.
+ :paramtype name: str
+ :keyword tag_name: Only return MicroVMs with this tag. A tag that matches no MicroVMs returns
+ an empty list. Default value is None.
+ :paramtype tag_name: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -193531,231 +200782,83 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
"links": {
"pages": {}
},
- "load_balancers": [
+ "microvms": [
{
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing
- the port on which the load balancer instance will listen.
- Required.
- "entry_protocol": "str", # The protocol used
- for traffic to the load balancer. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``http3``"" , ``tcp``""
- , or ``udp``. If you set the ``entry_protocol`` to ``udp``"" ,
- the ``target_protocol`` must be set to ``udp``. When using UDP,
- the load balancer requires that you set up a health check with a
- port that uses TCP, HTTP, or HTTPS to work properly. Required.
- Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing
- the port on the backend Droplets to which the load balancer will
- send traffic. Required.
- "target_protocol": "str", # The protocol
- used for traffic from the load balancer to the backend Droplets.
- The possible values are: ``http``"" , ``https``"" , ``http2``"" ,
- ``tcp``"" , or ``udp``. If you set the ``target_protocol`` to
- ``udp``"" , the ``entry_protocol`` must be set to ``udp``. When
- using UDP, the load balancer requires that you set up a health
- check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "tcp", and
- "udp".
- "certificate_id": "str", # Optional. The ID
- of the TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A
- boolean value indicating whether SSL encrypted traffic will be
- passed through to the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify
- an algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time
- value given in ISO8601 combined date and time format that represents when
- the load balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional.
- Default value is False. A boolean value indicating whether to disable
- automatic DNS record creation for Let's Encrypt certificates that are
- added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID
- of the TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean
- value indicating if the domain is already managed by
- DigitalOcean. If true, all A and AAAA records required to enable
- Global load balancers will be automatically added.
- "name": "str" # Optional. FQDN to associate
- with a Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the
- Droplets assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value
- is False. A boolean value indicating whether HTTP keepalive connections
- are maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is
- False. A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing
- traffic to the load balancer (in the form 'ip:1.2.3.4' or
- 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying
- traffic to the load balancer (in the form 'ip:1.2.3.4' or
- 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean
- flag to enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer
- value as a percentage to indicate failure threshold to decide how the
- regional priorities will take effect. A value of ``50`` would
- indicate that the Global load balancer will choose a lower priority
- region to forward traffic to once this failure threshold has been
- reached for the higher priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string
- to an integer priority value indicating preference for which
- regional target a Global load balancer will forward traffic to. A
- lower value indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer
- representing the port on the target backends which the load balancer
- will forward traffic to.
- "target_protocol": "str" # Optional. The protocol
- used for forwarding traffic from the load balancer to the target
- backends. The possible values are ``http``"" , ``https`` and
- ``http2``. Known values are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default
- value is 10. The number of seconds between between two consecutive
- health checks.
- "healthy_threshold": 3, # Optional. Default value is
- 3. The number of times a health check must pass for a backend Droplet
- to be marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The
- path on the backend Droplets to which the load balancer instance will
- send a request.
- "port": 80, # Optional. Default value is 80. An
- integer representing the port on the backend Droplets on which the
- health check will attempt a connection.
- "protocol": "http", # Optional. Default value is
- "http". The protocol used for health checks sent to the backend
- Droplets. The possible values are ``http``"" , ``https``"" , or
- ``tcp``. Known values are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default
- value is 5. The number of seconds the load balancer instance will
- wait for a response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value
- is 5. The number of times a health check must fail for a backend
- Droplet to be marked "unhealthy" and be removed from the pool.
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is
+ on. Always ``true``.
+ "idle_timeout": "str" # Optional. How long the
+ MicroVM is idle before it pauses, as a duration such as ``30s``"" ,
+ ``5m``"" , or ``1h``. Defaults to ``5m``. The maximum is ``4h``.
+ Responses show the duration in the form ``5m0s``.
},
- "http_idle_timeout_seconds": 60, # Optional. Default value
- is 60. An integer value which configures the idle timeout for HTTP
- requests to the target droplets.
- "id": "str", # Optional. A unique ID that can be used to
- identify and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the
- public-facing IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load
- balancer instance.
- "network": "EXTERNAL", # Optional. Default value is
- "EXTERNAL". A string indicating whether the load balancer should be
- external or internal. Internal load balancers have no public IPs and are
- only accessible to resources on the same VPC network. This property
- cannot be updated after creating the load balancer. Known values are:
- "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is
- "IPV4". A string indicating whether the load balancer will support IPv4
- or both IPv4 and IPv6 networking. This property cannot be updated after
- creating the load balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that
- the load balancer is associated with. If no ID is provided at creation,
- the load balancer associates with the user's default project. If an
- invalid project ID is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value
- is False. A boolean value indicating whether HTTP requests to the load
- balancer on port 80 will be redirected to HTTPS on port 443.
- "region": {
- "available": bool, # This is a boolean value that
- represents whether new Droplets can be created in this region.
+ "auto_resume": True, # Optional. Default value is True.
+ Whether an HTTP request, command, or console session resumes the MicroVM
+ when it is paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the
+ MicroVM was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed.
+ Present only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the
+ MicroVM's HTTP port serves. ``null`` if the protocol was not set when the
+ MicroVM was created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be
+ unique in the region and contain 1 to 63 lowercase letters, digits, and
+ hyphens.
+ "networking": "public", # Optional. Default value is
+ "public". ``public`` sends outbound traffic through a shared NAT gateway.
+ ``vpc`` places the MicroVM in the VPC network set by ``vpc_uuid``. Known
+ values are: "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the
+ MicroVM, including the HTTP port. During the public preview, only the
+ HTTP port is reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the
+ MicroVM is in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB.
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.
+ "disk": 0 # Optional. The size of the disk, in GB.
+ Set by the size.
},
- "size": "lb-small", # Optional. Default value is "lb-small".
- This field has been replaced by the ``size_unit`` field for all regions
- except in AMS2, NYC2, and SFO1. Each available load balancer size now
- equates to the load balancer having a set number of nodes. *
- ``lb-small`` = 1 node * ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes
- You can resize load balancers after creation up to once per hour. You
- cannot resize a load balancer within the first hour of its creation.
- Known values are: "lb-small", "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many
- nodes the load balancer contains. Each additional node increases the load
- balancer's ability to manage more connections. Load balancers can be
- scaled up or down, and you can change the number of nodes after creation
- up to once per hour. This field is currently not available in the AMS2,
- NYC2, or SFO1 regions. Use the ``size`` field to scale load balancers
- that reside in these regions.
- "status": "str", # Optional. A status string indicating the
- current state of the load balancer. This can be ``new``"" , ``active``""
- , or ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the
- cookie sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of
- seconds until the cookie set by the load balancer expires. This
- attribute is only returned when using ``cookies`` for the sticky
- sessions type.
- "type": "none" # Optional. Default value is "none".
- An attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values
- are ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a
+ checkpoint to create the MicroVM from. The new MicroVM inherits the
+ checkpoint's region, size, container image, and environment
+ variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form
+ ``registry/repository:tag``. The image can be public, such as an
+ image on Docker Hub, or private in your team's DigitalOcean Container
+ Registry.
},
- "subnet_uuid": "str", # Optional. A string specifying the
- UUID of the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag
- corresponding to Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of
- the Regional load balancers to be used as target backends for a
- Global load balancer.
+ "state": "str", # Optional. The MicroVM's current state.
+ Known values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used
- by the load balancer. The possible values are ``DEFAULT`` or ``STRONG``.
- The default value is ``DEFAULT``. Known values are: "DEFAULT" and
- "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL".
- A string indicating whether the load balancer should be a standard
- regional HTTP load balancer, a regional network load balancer that routes
- traffic at the TCP/UDP transport layer, or a global load balancer. Known
- values are: "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID
- of the VPC to which the load balancer is assigned.
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is
+ the endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The
+ endpoint's hostname. Empty until provisioning finishes. Requests
+ to the endpoint must include a DigitalOcean API token with the
+ ``microvm:access`` scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the
+ endpoint serves.
+ "status": "str" # Optional. ``PENDING``
+ until provisioning finishes, then ``ACTIVE``. Known values are:
+ "PENDING" and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the
+ same region that belongs to your team. Present only when ``networking``
+ is ``vpc``.
}
]
}
@@ -193778,9 +200881,12 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
cls: ClsType[JSON] = kwargs.pop("cls", None)
- _request = build_load_balancers_list_request(
- per_page=per_page,
+ _request = build_microvms_list_request(
page=page,
+ per_page=per_page,
+ region=region,
+ name=name,
+ tag_name=tag_name,
headers=_headers,
params=_params,
)
@@ -193822,16 +200928,30 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
- @distributed_trace
- def get(self, lb_id: str, **kwargs: Any) -> JSON:
+ @overload
+ def create(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
# pylint: disable=line-too-long
- """Retrieve an Existing Load Balancer.
+ """Create a MicroVM.
- To show information about a load balancer instance, send a GET request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``.
+ To create a MicroVM, send a POST request to ``/v2/microvms``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ ``name`` and ``source`` are required. Set ``source.oci_ref`` to create the MicroVM from a
+ ``linux/amd64`` container image, or ``source.checkpoint_id`` to create it from a checkpoint.
+ With ``oci_ref``\\ , ``region`` and ``size`` are also required.
+
+ A MicroVM created from an image is returned with ``state`` set to ``creating``. Poll
+ ``GET /v2/microvms/{microvm_id}`` until ``state`` is ``running``. A MicroVM created from a
+ checkpoint is usually returned already ``running``.
+
+ All settings are fixed at creation. There is no update endpoint.
+
+ :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:
@@ -193839,232 +200959,421 @@ def get(self, lb_id: 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 = {
+ "name": "str", # The name of the MicroVM. Must be unique in the region and
+ contain 1 to 63 lowercase letters, digits, and hyphens. Required.
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint to create
+ the MicroVM from. The new MicroVM inherits the checkpoint's region, size,
+ container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a ``linux/amd64``
+ container image in the form ``registry/repository:tag``. The image can be
+ public, such as an image on Docker Hub, or private in your team's
+ DigitalOcean Container Registry.
+ },
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on. Always
+ ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is idle
+ before it pauses, as a duration such as ``30s``"" , ``5m``"" , or ``1h``.
+ Defaults to ``5m``. The maximum is ``4h``. Responses show the duration in the
+ form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an HTTP
+ request, command, or console session resumes the MicroVM when it is paused. Set
+ to ``false`` to require a manual resume.
+ "environment": {
+ "str": "str" # Optional. Environment variables passed into the
+ MicroVM at boot, as key and value pairs. Not returned in responses.
+ },
+ "http_port": 8080, # Optional. Default value is 8080. The guest port the
+ workload serves HTTP on. Defaults to ``8080``. Not returned in responses. When
+ creating from a checkpoint without ``ports``"" , must be one of the checkpoint's
+ ports.
+ "http_protocol": "str", # Optional. The protocol the HTTP port serves. Known
+ values are: "http" and "http2".
+ "networking": "public", # Optional. Default value is "public". ``public``
+ sends outbound traffic through a shared NAT gateway. ``vpc`` places the MicroVM
+ in the VPC network set by ``vpc_uuid``. Known values are: "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports to declare, up to five. Must include
+ ``http_port``. Defaults to only the HTTP port. During the public preview,
+ only the HTTP port is reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region to create the MicroVM
+ in. Required with ``source.oci_ref``.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by the size.
+ },
+ "tags": [
+ "str" # Optional. Tags to apply to the MicroVM.
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same region
+ that belongs to your team. Required when ``networking`` is ``vpc``.
+ }
+
+ # response body for status code(s): 201
response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
+ },
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
{
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
}
],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 403
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
+ }
+ """
+
+ @overload
+ def create(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a MicroVM.
+
+ To create a MicroVM, send a POST request to ``/v2/microvms``.
+
+ ``name`` and ``source`` are required. Set ``source.oci_ref`` to create the MicroVM from a
+ ``linux/amd64`` container image, or ``source.checkpoint_id`` to create it from a checkpoint.
+ With ``oci_ref``\\ , ``region`` and ``size`` are also required.
+
+ A MicroVM created from an image is returned with ``state`` set to ``creating``. Poll
+ ``GET /v2/microvms/{microvm_id}`` until ``state`` is ``running``. A MicroVM created from a
+ checkpoint is usually returned already ``running``.
+
+ All settings are fixed at creation. There is no update endpoint.
+
+ :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 == {
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
},
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
},
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 403
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
+ }
+ """
+
+ @distributed_trace
+ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create a MicroVM.
+
+ To create a MicroVM, send a POST request to ``/v2/microvms``.
+
+ ``name`` and ``source`` are required. Set ``source.oci_ref`` to create the MicroVM from a
+ ``linux/amd64`` container image, or ``source.checkpoint_id`` to create it from a checkpoint.
+ With ``oci_ref``\\ , ``region`` and ``size`` are also required.
+
+ A MicroVM created from an image is returned with ``state`` set to ``creating``. Poll
+ ``GET /v2/microvms/{microvm_id}`` until ``state`` is ``running``. A MicroVM created from a
+ checkpoint is usually returned already ``running``.
+
+ All settings are fixed at creation. There is no update endpoint.
+
+ :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", # The name of the MicroVM. Must be unique in the region and
+ contain 1 to 63 lowercase letters, digits, and hyphens. Required.
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint to create
+ the MicroVM from. The new MicroVM inherits the checkpoint's region, size,
+ container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a ``linux/amd64``
+ container image in the form ``registry/repository:tag``. The image can be
+ public, such as an image on Docker Hub, or private in your team's
+ DigitalOcean Container Registry.
+ },
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on. Always
+ ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is idle
+ before it pauses, as a duration such as ``30s``"" , ``5m``"" , or ``1h``.
+ Defaults to ``5m``. The maximum is ``4h``. Responses show the duration in the
+ form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an HTTP
+ request, command, or console session resumes the MicroVM when it is paused. Set
+ to ``false`` to require a manual resume.
+ "environment": {
+ "str": "str" # Optional. Environment variables passed into the
+ MicroVM at boot, as key and value pairs. Not returned in responses.
+ },
+ "http_port": 8080, # Optional. Default value is 8080. The guest port the
+ workload serves HTTP on. Defaults to ``8080``. Not returned in responses. When
+ creating from a checkpoint without ``ports``"" , must be one of the checkpoint's
+ ports.
+ "http_protocol": "str", # Optional. The protocol the HTTP port serves. Known
+ values are: "http" and "http2".
+ "networking": "public", # Optional. Default value is "public". ``public``
+ sends outbound traffic through a shared NAT gateway. ``vpc`` places the MicroVM
+ in the VPC network set by ``vpc_uuid``. Known values are: "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports to declare, up to five. Must include
+ ``http_port``. Defaults to only the HTTP port. During the public preview,
+ only the HTTP port is reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region to create the MicroVM
+ in. Required with ``source.oci_ref``.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by the size.
+ },
+ "tags": [
+ "str" # Optional. Tags to apply to the MicroVM.
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same region
+ that belongs to your team. Required when ``networking`` is ``vpc``.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
},
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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.
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
},
- "size": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
},
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
}
}
- # response body for status code(s): 404
+ # response body for status code(s): 400, 403
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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -194080,13 +201389,26 @@ def get(self, lb_id: str, **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_load_balancers_get_request(
- lb_id=lb_id,
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_microvms_create_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
headers=_headers,
params=_params,
)
@@ -194101,14 +201423,14 @@ def get(self, lb_id: str, **kwargs: Any) -> JSON:
response = pipeline_response.http_response
- if response.status_code not in [200, 404]:
+ if response.status_code not in [201, 400, 403]:
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")
)
@@ -194124,7 +201446,23 @@ def get(self, lb_id: str, **kwargs: Any) -> JSON:
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")
+ )
+ 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 == 403:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -194145,32 +201483,13 @@ def get(self, lb_id: str, **kwargs: Any) -> JSON:
return cast(JSON, deserialized) # type: ignore
- @overload
- def update(
- self,
- lb_id: str,
- body: JSON,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> JSON:
- # pylint: disable=line-too-long
- """Update a Load Balancer.
+ @distributed_trace
+ def get_options(self, **kwargs: Any) -> JSON:
+ """List MicroVM options.
- To update a load balancer's settings, send a PUT request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
- representation of the load balancer including existing attributes. It may
- contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
- exclusive. **Note that any attribute that is not provided will be reset to its
- default value.**.
+ To list the default region, sizes, prices, account limits, and features available to
+ your team, send a GET request to ``/v2/microvms/options``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -194178,516 +201497,130 @@ def update(
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 == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
+ "account_limits": {
+ "max_disk_bytes": 0, # Optional. The maximum disk per MicroVM, in
+ bytes.
+ "max_idle_timeout_seconds": 0, # Optional. The maximum auto-pause
+ idle timeout, in seconds.
+ "max_memory_bytes": 0, # Optional. The maximum memory per MicroVM,
+ in bytes.
+ "max_total_count": 0 # Optional. The maximum number of MicroVMs,
+ counting both running and paused MicroVMs.
+ },
+ "default_region": "str", # Optional. The slug of the region MicroVMs are
+ created in by default.
+ "features": [
+ {
+ "enabled": bool, # Optional. Whether the feature is enabled.
+ "name": "str" # Optional. The name of the feature.
+ }
+ ],
+ "resource_pricing": {
+ "price_per_gib_bandwidth": 0.0, # Optional. The price per GiB of
+ outbound data transfer.
+ "price_per_gib_memory_hour": 0.0, # Optional. The price per GiB of
+ memory per hour of running time.
+ "price_per_gib_storage_month": 0.0, # Optional. The price per
+ GiB-month of disk and checkpoint storage.
+ "price_per_vcpu_hour": 0.0 # Optional. The price per vCPU per hour
+ of running time.
+ },
+ "sizes": [
+ {
+ "available": bool, # Optional. Whether the size is available
+ on your team's plan.
+ "cpu": 0, # Optional. The number of vCPUs.
+ "disk": 0, # Optional. The size of the disk, in GB.
+ "memory": 0, # Optional. The amount of memory, in MiB.
+ "pricing": {
+ "price_per_hour": 0.0, # Optional. The price per
+ hour of running time, in USD.
+ "price_per_month": 0.0 # Optional. The price for
+ running continuously for a month (730 hours), in USD.
},
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
- }
- # 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.
+ "regions": [
+ "str" # Optional. The slugs of the regions the size
+ is available in.
+ ]
+ }
+ ]
}
"""
+ 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(
- self,
- lb_id: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> JSON:
- # pylint: disable=line-too-long
- """Update a Load Balancer.
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
- To update a load balancer's settings, send a PUT request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
- representation of the load balancer including existing attributes. It may
- contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
- exclusive. **Note that any attribute that is not provided will be reset to its
- default value.**.
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object
- :rtype: JSON
- :raises ~azure.core.exceptions.HttpResponseError:
+ _request = build_microvms_get_options_request(
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
- Example:
- .. code-block:: python
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
- # response body for status code(s): 200
- response == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
- },
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
- },
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
- ],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
- }
- }
- # 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 = 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 update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ def get(self, microvm_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Update a Load Balancer.
+ """Retrieve a MicroVM.
- To update a load balancer's settings, send a PUT request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``. The request should contain a full
- representation of the load balancer including existing attributes. It may
- contain *one of* the ``droplets_ids`` or ``tag`` attributes as they are mutually
- exclusive. **Note that any attribute that is not provided will be reset to its
- default value.**.
+ To show information about a MicroVM, send a GET request to ``/v2/microvms/{microvm_id}``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
+ The endpoint is in the ``urls`` entry with ``default`` set to ``true``. Its ``hostname`` is
+ empty
+ and its ``status`` is ``PENDING`` until provisioning finishes.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
:return: JSON object
:rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
@@ -194695,235 +201628,86 @@ def update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSO
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 == {
- "load_balancer": {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port
- on which the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for
- traffic to the load balancer. The possible values are: ``http``"" ,
- ``https``"" , ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If
- you set the ``entry_protocol`` to ``udp``"" , the
- ``target_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "http3", "tcp", and "udp".
- "target_port": 0, # An integer representing the port
- on the backend Droplets to which the load balancer will send traffic.
- Required.
- "target_protocol": "str", # The protocol used for
- traffic from the load balancer to the backend Droplets. The possible
- values are: ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or
- ``udp``. If you set the ``target_protocol`` to ``udp``"" , the
- ``entry_protocol`` must be set to ``udp``. When using UDP, the load
- balancer requires that you set up a health check with a port that
- uses TCP, HTTP, or HTTPS to work properly. Required. Known values
- are: "http", "https", "http2", "tcp", and "udp".
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to
- the backend Droplets.
- }
- ],
- "algorithm": "round_robin", # Optional. Default value is
- "round_robin". This field has been deprecated. You can no longer specify an
- algorithm for load balancers. Known values are: "round_robin" and
- "least_connections".
- "created_at": "2020-02-20 00:00:00", # Optional. A time value given
- in ISO8601 combined date and time format that represents when the load
- balancer was created.
- "disable_lets_encrypt_dns_records": False, # Optional. Default value
- is False. A boolean value indicating whether to disable automatic DNS record
- creation for Let's Encrypt certificates that are added to the load balancer.
- "domains": [
- {
- "certificate_id": "str", # Optional. The ID of the
- TLS certificate used for SSL termination.
- "is_managed": bool, # Optional. A boolean value
- indicating if the domain is already managed by DigitalOcean. If true,
- all A and AAAA records required to enable Global load balancers will
- be automatically added.
- "name": "str" # Optional. FQDN to associate with a
- Global load balancer.
- }
- ],
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets
- assigned to the load balancer.
- ],
- "enable_backend_keepalive": False, # Optional. Default value is
- False. A boolean value indicating whether HTTP keepalive connections are
- maintained to target Droplets.
- "enable_proxy_protocol": False, # Optional. Default value is False.
- A boolean value indicating whether PROXY Protocol is in use.
- "firewall": {
- "allow": [
- "str" # Optional. the rules for allowing traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ],
- "deny": [
- "str" # Optional. the rules for denying traffic to
- the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16').
- ]
- },
- "glb_settings": {
- "cdn": {
- "is_enabled": bool # Optional. A boolean flag to
- enable CDN caching.
- },
- "failover_threshold": 0, # Optional. An integer value as a
- percentage to indicate failure threshold to decide how the regional
- priorities will take effect. A value of ``50`` would indicate that the
- Global load balancer will choose a lower priority region to forward
- traffic to once this failure threshold has been reached for the higher
- priority region.
- "region_priorities": {
- "str": 0 # Optional. A map of region string to an
- integer priority value indicating preference for which regional
- target a Global load balancer will forward traffic to. A lower value
- indicates a higher priority.
- },
- "target_port": 0, # Optional. An integer representing the
- port on the target backends which the load balancer will forward traffic
- to.
- "target_protocol": "str" # Optional. The protocol used for
- forwarding traffic from the load balancer to the target backends. The
- possible values are ``http``"" , ``https`` and ``http2``. Known values
- are: "http", "https", and "http2".
- },
- "health_check": {
- "check_interval_seconds": 10, # Optional. Default value is
- 10. The number of seconds between between two consecutive health checks.
- "healthy_threshold": 3, # Optional. Default value is 3. The
- number of times a health check must pass for a backend Droplet to be
- marked "healthy" and be re-added to the pool.
- "path": "/", # Optional. Default value is "/". The path on
- the backend Droplets to which the load balancer instance will send a
- request.
- "port": 80, # Optional. Default value is 80. An integer
- representing the port on the backend Droplets on which the health check
- will attempt a connection.
- "protocol": "http", # Optional. Default value is "http". The
- protocol used for health checks sent to the backend Droplets. The
- possible values are ``http``"" , ``https``"" , or ``tcp``. Known values
- are: "http", "https", and "tcp".
- "response_timeout_seconds": 5, # Optional. Default value is
- 5. The number of seconds the load balancer instance will wait for a
- response until marking a health check as failed.
- "unhealthy_threshold": 5 # Optional. Default value is 5. The
- number of times a health check must fail for a backend Droplet to be
- marked "unhealthy" and be removed from the pool.
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
},
- "http_idle_timeout_seconds": 60, # Optional. Default value is 60. An
- integer value which configures the idle timeout for HTTP requests to the
- target droplets.
- "id": "str", # Optional. A unique ID that can be used to identify
- and reference a load balancer.
- "ipv6": "str", # Optional. An attribute containing the public-facing
- IPv6 address of the load balancer.
- "name": "str", # Optional. A human-readable name for a load balancer
- instance.
- "network": "EXTERNAL", # Optional. Default value is "EXTERNAL". A
- string indicating whether the load balancer should be external or internal.
- Internal load balancers have no public IPs and are only accessible to
- resources on the same VPC network. This property cannot be updated after
- creating the load balancer. Known values are: "EXTERNAL" and "INTERNAL".
- "network_stack": "IPV4", # Optional. Default value is "IPV4". A
- string indicating whether the load balancer will support IPv4 or both IPv4
- and IPv6 networking. This property cannot be updated after creating the load
- balancer. Known values are: "IPV4" and "DUALSTACK".
- "project_id": "str", # Optional. The ID of the project that the load
- balancer is associated with. If no ID is provided at creation, the load
- balancer associates with the user's default project. If an invalid project ID
- is provided, the load balancer will not be created.
- "redirect_http_to_https": False, # Optional. Default value is False.
- A boolean value indicating whether HTTP requests to the load balancer on port
- 80 will be redirected to HTTPS on port 443.
- "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.
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
},
- "size": "lb-small", # Optional. Default value is "lb-small". This
- field has been replaced by the ``size_unit`` field for all regions except in
- AMS2, NYC2, and SFO1. Each available load balancer size now equates to the
- load balancer having a set number of nodes. * ``lb-small`` = 1 node *
- ``lb-medium`` = 3 nodes * ``lb-large`` = 6 nodes You can resize load
- balancers after creation up to once per hour. You cannot resize a load
- balancer within the first hour of its creation. Known values are: "lb-small",
- "lb-medium", and "lb-large".
- "size_unit": 1, # Optional. Default value is 1. How many nodes the
- load balancer contains. Each additional node increases the load balancer's
- ability to manage more connections. Load balancers can be scaled up or down,
- and you can change the number of nodes after creation up to once per hour.
- This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use
- the ``size`` field to scale load balancers that reside in these regions.
- "status": "str", # Optional. A status string indicating the current
- state of the load balancer. This can be ``new``"" , ``active``"" , or
- ``errored``. Known values are: "new", "active", and "errored".
- "sticky_sessions": {
- "cookie_name": "str", # Optional. The name of the cookie
- sent to the client. This attribute is only returned when using
- ``cookies`` for the sticky sessions type.
- "cookie_ttl_seconds": 0, # Optional. The number of seconds
- until the cookie set by the load balancer expires. This attribute is only
- returned when using ``cookies`` for the sticky sessions type.
- "type": "none" # Optional. Default value is "none". An
- attribute indicating how and if requests from a client will be
- persistently served by the same backend Droplet. The possible values are
- ``cookies`` or ``none``. Known values are: "cookies" and "none".
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
},
- "subnet_uuid": "str", # Optional. A string specifying the UUID of
- the VPC subnet to which the load balancer is assigned.
- "tag": "str", # Optional. The name of a Droplet tag corresponding to
- Droplets assigned to the load balancer.
- "target_load_balancer_ids": [
- "str" # Optional. An array containing the UUIDs of the
- Regional load balancers to be used as target backends for a Global load
- balancer.
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
],
- "tls_cipher_policy": "DEFAULT", # Optional. Default value is
- "DEFAULT". A string indicating the policy for the TLS cipher suites used by
- the load balancer. The possible values are ``DEFAULT`` or ``STRONG``. The
- default value is ``DEFAULT``. Known values are: "DEFAULT" and "STRONG".
- "type": "REGIONAL", # Optional. Default value is "REGIONAL". A
- string indicating whether the load balancer should be a standard regional
- HTTP load balancer, a regional network load balancer that routes traffic at
- the TCP/UDP transport layer, or a global load balancer. Known values are:
- "REGIONAL", "REGIONAL_NETWORK", and "GLOBAL".
- "vpc_uuid": "str" # Optional. A string specifying the UUID of the
- VPC to which the load balancer is assigned.
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
}
}
# 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -194939,27 +201723,13 @@ def update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSO
}
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:
- _json = body
-
- _request = build_load_balancers_update_request(
- lb_id=lb_id,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_microvms_get_request(
+ microvm_id=microvm_id,
headers=_headers,
params=_params,
)
@@ -195019,19 +201789,16 @@ def update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSO
return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Delete a Load Balancer.
+ def delete(self, microvm_id: str, **kwargs: Any) -> Optional[JSON]:
+ """Delete a MicroVM.
- To delete a load balancer instance, disassociating any Droplets assigned to it
- and removing it from your account, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID``.
+ To delete a MicroVM and the data on its disk, send a DELETE request to
+ ``/v2/microvms/{microvm_id}``. The MicroVM's checkpoints are not deleted.
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ A successful request returns a ``204 No Content`` status code.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -195041,14 +201808,8 @@ def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
# 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -195069,8 +201830,8 @@ def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None)
- _request = build_load_balancers_delete_request(
- lb_id=lb_id,
+ _request = build_microvms_delete_request(
+ microvm_id=microvm_id,
headers=_headers,
params=_params,
)
@@ -195126,35 +201887,303 @@ def delete(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
return deserialized # type: ignore
@distributed_trace
- def delete_cache(self, lb_id: str, **kwargs: Any) -> Optional[JSON]:
+ def post_pause(self, microvm_id: str, **kwargs: Any) -> JSON:
# pylint: disable=line-too-long
- """Delete a Global Load Balancer CDN Cache.
+ """Pause a MicroVM.
- To delete a Global load balancer CDN cache, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/cache``.
+ To pause a MicroVM, send a POST request to ``/v2/microvms/{microvm_id}/pause``.
+
+ Pausing suspends the MicroVM's processes and preserves its memory, files, and processes.
+ A paused MicroVM incurs storage charges only. The request returns when the change
+ completes. Pausing a MicroVM that is already paused succeeds. The request returns HTTP 400
+ when the MicroVM is ``creating``\\ , ``terminated``\\ , or ``failed``.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
+ },
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
+ }
+ """
+ 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_microvms_post_pause_request(
+ microvm_id=microvm_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, 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 == 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 == 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 post_resume(self, microvm_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Resume a MicroVM.
+
+ To resume a paused MicroVM, send a POST request to ``/v2/microvms/{microvm_id}/resume``.
- A successful request will receive a 204 status code with no body in response.
- This indicates that the request was processed successfully.
+ The request returns when the change completes. Resuming a MicroVM that is already running
+ succeeds. The request returns HTTP 400 when the MicroVM is ``creating``\\ , ``terminated``\\ ,
+ or
+ ``failed``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :return: JSON object or None
- :rtype: JSON or None
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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.
+ "microvm": {
+ "auto_pause": {
+ "enabled": bool, # Optional. Whether auto-pause is on.
+ Always ``true``.
+ "idle_timeout": "str" # Optional. How long the MicroVM is
+ idle before it pauses, as a duration such as ``30s``"" , ``5m``"" , or
+ ``1h``. Defaults to ``5m``. The maximum is ``4h``. Responses show the
+ duration in the form ``5m0s``.
+ },
+ "auto_resume": True, # Optional. Default value is True. Whether an
+ HTTP request, command, or console session resumes the MicroVM when it is
+ paused.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the MicroVM
+ was created, in ISO 8601 format.
+ "failure_reason": "str", # Optional. Why the MicroVM failed. Present
+ only when ``state`` is ``failed``.
+ "http_protocol": "str", # Optional. The protocol the MicroVM's HTTP
+ port serves. ``null`` if the protocol was not set when the MicroVM was
+ created. Known values are: "http" and "http2".
+ "id": "str", # Optional. The unique ID of the MicroVM.
+ "name": "str", # Optional. The name of the MicroVM. Must be unique
+ in the region and contain 1 to 63 lowercase letters, digits, and hyphens.
+ "networking": "public", # Optional. Default value is "public".
+ ``public`` sends outbound traffic through a shared NAT gateway. ``vpc``
+ places the MicroVM in the VPC network set by ``vpc_uuid``. Known values are:
+ "public" and "vpc".
+ "ports": [
+ 0 # Optional. The guest ports declared on the MicroVM,
+ including the HTTP port. During the public preview, only the HTTP port is
+ reachable through the MicroVM's endpoint.
+ ],
+ "region": "str", # Optional. The slug of the region the MicroVM is
+ in.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "source": {
+ "checkpoint_id": "str", # Optional. The ID of a checkpoint
+ to create the MicroVM from. The new MicroVM inherits the checkpoint's
+ region, size, container image, and environment variables.
+ "oci_ref": "str" # Optional. A reference to a
+ ``linux/amd64`` container image in the form ``registry/repository:tag``.
+ The image can be public, such as an image on Docker Hub, or private in
+ your team's DigitalOcean Container Registry.
+ },
+ "state": "str", # Optional. The MicroVM's current state. Known
+ values are: "creating", "running", "pausing", "paused", "resuming",
+ "terminating", "terminated", "failed", and "unknown".
+ "tags": [
+ "str" # Optional. The tags applied to the MicroVM.
+ ],
+ "urls": [
+ {
+ "default": bool, # Optional. Whether this is the
+ endpoint for the MicroVM's HTTP port.
+ "hostname": "str", # Optional. The endpoint's
+ hostname. Empty until provisioning finishes. Requests to the endpoint
+ must include a DigitalOcean API token with the ``microvm:access``
+ scope in the ``Authorization`` header.
+ "port": 0, # Optional. The guest port the endpoint
+ serves.
+ "status": "str" # Optional. ``PENDING`` until
+ provisioning finishes, then ``ACTIVE``. Known values are: "PENDING"
+ and "ACTIVE".
+ }
+ ],
+ "vpc_uuid": "str" # Optional. The ID of a VPC network in the same
+ region that belongs to your team. Present only when ``networking`` is
+ ``vpc``.
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -195173,10 +202202,10 @@ def delete_cache(self, lb_id: 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_load_balancers_delete_cache_request(
- lb_id=lb_id,
+ _request = build_microvms_post_resume_request(
+ microvm_id=microvm_id,
headers=_headers,
params=_params,
)
@@ -195191,15 +202220,30 @@ def delete_cache(self, lb_id: 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, 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 == 204:
+ 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 == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -195210,6 +202254,11 @@ def delete_cache(self, lb_id: str, **kwargs: Any) -> Optional[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")
@@ -195227,42 +202276,39 @@ def delete_cache(self, lb_id: 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 add_droplets(
+ def run_command(
self,
- lb_id: str,
+ microvm_id: str,
body: JSON,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Droplets to a Load Balancer.
+ ) -> JSON:
+ """Run a command in a MicroVM.
- To assign a Droplet to a load balancer instance, send a POST request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- Individual Droplets can not be added to a load balancer configured with a
- Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
- response from the API.
+ To run a command in a MicroVM's workload container, send a POST request to
+ ``/v2/microvms/{microvm_id}/exec``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ ``argv`` runs directly, not through a shell, with standard input closed. If the MicroVM is
+ paused and auto-resume is on, the request resumes it and waits until it is running.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ A command has 60 seconds to finish. Your team can run 32 commands at once and 60 commands
+ per minute. Rejected requests count toward the per-minute limit.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_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".
:paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@@ -195270,99 +202316,101 @@ def add_droplets(
# JSON input template you can fill out and use as your body input.
body = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
+ "argv": [
+ "str" # The command and its arguments. Required.
+ ],
+ "cwd": "str" # Optional. The working directory to run the command in.
}
- # 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.
+ "exit_code": 0, # Optional. The command's exit code.
+ "stderr": "str", # Optional. The command's standard error. Bytes that are
+ not valid UTF-8 are replaced.
+ "stdout": "str", # Optional. The command's standard output. Bytes that are
+ not valid UTF-8 are replaced.
+ "truncated": bool # Optional. Present and ``true`` when the output exceeded
+ 4 MiB and was cut off.
+ }
+ # response body for status code(s): 400, 403, 404, 502
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@overload
- def add_droplets(
+ def run_command(
self,
- lb_id: str,
+ microvm_id: str,
body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Droplets to a Load Balancer.
+ ) -> JSON:
+ """Run a command in a MicroVM.
- To assign a Droplet to a load balancer instance, send a POST request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- Individual Droplets can not be added to a load balancer configured with a
- Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
- response from the API.
+ To run a command in a MicroVM's workload container, send a POST request to
+ ``/v2/microvms/{microvm_id}/exec``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ ``argv`` runs directly, not through a shell, with standard input closed. If the MicroVM is
+ paused and auto-resume is on, the request resumes it and waits until it is running.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ A command has 60 seconds to finish. Your team can run 32 commands at once and 60 commands
+ per minute. Rejected requests count toward the per-minute limit.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_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".
: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 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.
+ "exit_code": 0, # Optional. The command's exit code.
+ "stderr": "str", # Optional. The command's standard error. Bytes that are
+ not valid UTF-8 are replaced.
+ "stdout": "str", # Optional. The command's standard output. Bytes that are
+ not valid UTF-8 are replaced.
+ "truncated": bool # Optional. Present and ``true`` when the output exceeded
+ 4 MiB and was cut off.
+ }
+ # response body for status code(s): 400, 403, 404, 502
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@distributed_trace
- def add_droplets(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Droplets to a Load Balancer.
+ def run_command(
+ self, microvm_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ """Run a command in a MicroVM.
- To assign a Droplet to a load balancer instance, send a POST request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
- Individual Droplets can not be added to a load balancer configured with a
- Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
- response from the API.
+ To run a command in a MicroVM's workload container, send a POST request to
+ ``/v2/microvms/{microvm_id}/exec``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ ``argv`` runs directly, not through a shell, with standard input closed. If the MicroVM is
+ paused and auto-resume is on, the request resumes it and waits until it is running.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
+ A command has 60 seconds to finish. Your team can run 32 commands at once and 60 commands
+ per minute. Rejected requests count toward the per-minute limit.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
:param body: Is either a JSON type or a IO[bytes] type. Required.
: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:
@@ -195370,22 +202418,26 @@ def add_droplets(
# JSON input template you can fill out and use as your body input.
body = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
+ "argv": [
+ "str" # The command and its arguments. Required.
+ ],
+ "cwd": "str" # Optional. The working directory to run the command in.
}
- # 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.
+ "exit_code": 0, # Optional. The command's exit code.
+ "stderr": "str", # Optional. The command's standard error. Bytes that are
+ not valid UTF-8 are replaced.
+ "stdout": "str", # Optional. The command's standard output. Bytes that are
+ not valid UTF-8 are replaced.
+ "truncated": bool # Optional. Present and ``true`` when the output exceeded
+ 4 MiB and was cut off.
+ }
+ # response body for status code(s): 400, 403, 404, 502
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -195407,7 +202459,7 @@ def add_droplets(
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
@@ -195417,8 +202469,8 @@ def add_droplets(
else:
_json = body
- _request = build_load_balancers_add_droplets_request(
- lb_id=lb_id,
+ _request = build_microvms_run_command_request(
+ microvm_id=microvm_id,
content_type=content_type,
json=_json,
content=_content,
@@ -195436,15 +202488,14 @@ def add_droplets(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [200, 400, 403, 404, 502]:
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")
)
@@ -195455,7 +202506,12 @@ def add_droplets(
"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")
)
@@ -195471,132 +202527,79 @@ def add_droplets(
else:
deserialized = None
- if cls:
- return cls(pipeline_response, deserialized, response_headers) # type: ignore
-
- return deserialized # type: ignore
-
- @overload
- def remove_droplets(
- self,
- lb_id: str,
- body: JSON,
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Remove Droplets from a Load Balancer.
-
- To remove a Droplet from a load balancer instance, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
-
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
-
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :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 = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
- }
+ if response.status_code == 403:
+ 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 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.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- @overload
- def remove_droplets(
- self,
- lb_id: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Remove Droplets from a Load Balancer.
+ 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 remove a Droplet from a load balancer instance, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ if response.status_code == 502:
+ 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")
+ )
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
- :raises ~azure.core.exceptions.HttpResponseError:
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
- Example:
- .. code-block:: python
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
- # 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.
- }
- """
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def remove_droplets(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ def get_console(
+ self, microvm_id: str, *, rows: int = 24, cols: int = 80, **kwargs: Any
) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Remove Droplets from a Load Balancer.
-
- To remove a Droplet from a load balancer instance, send a DELETE request to
- ``/v2/load_balancers/$LOAD_BALANCER_ID/droplets``. In the body of the request,
- there should be a ``droplet_ids`` attribute containing a list of Droplet IDs.
-
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
-
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
+ """Open a console in a MicroVM.
+
+ To open an interactive ``/bin/sh`` console in a MicroVM's workload container, open a
+ WebSocket connection to ``wss://api.digitalocean.com/v2/microvms/{microvm_id}/console``.
+
+ Send the API token in the ``Authorization`` header of the handshake. Browsers cannot set this
+ header, so you cannot open the console from browser JavaScript. The image must include
+ ``/bin/sh``. A MicroVM can have four consoles open at a time. If the MicroVM is paused and
+ auto-resume is on, opening a console resumes it.
+
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: str
+ :keyword rows: The initial number of terminal rows. Default value is 24.
+ :paramtype rows: int
+ :keyword cols: The initial number of terminal columns. Default value is 80.
+ :paramtype cols: int
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -195604,24 +202607,10 @@ def remove_droplets(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "droplet_ids": [
- 0 # Optional. An array containing the IDs of the Droplets assigned
- to the load balancer.
- ]
- }
-
- # response body for status code(s): 404
+ # response body for status code(s): 403, 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -195637,27 +202626,15 @@ def remove_droplets(
}
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[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:
- _json = body
-
- _request = build_load_balancers_remove_droplets_request(
- lb_id=lb_id,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_microvms_get_console_request(
+ microvm_id=microvm_id,
+ rows=rows,
+ cols=cols,
headers=_headers,
params=_params,
)
@@ -195672,7 +202649,7 @@ def remove_droplets(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [101, 403, 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
@@ -195680,7 +202657,18 @@ def remove_droplets(
deserialized = None
response_headers = {}
- if response.status_code == 204:
+ if response.status_code == 101:
+ 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 == 403:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -195691,6 +202679,11 @@ def remove_droplets(
"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")
@@ -195712,155 +202705,301 @@ def remove_droplets(
return deserialized # type: ignore
- @overload
- def add_forwarding_rules(
+
+class MicrovmCheckpointsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`microvm_checkpoints` 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,
- lb_id: str,
- body: JSON,
*,
- content_type: str = "application/json",
+ page: int = 1,
+ per_page: int = 25,
+ microvm_id: Optional[str] = None,
**kwargs: Any,
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Add Forwarding Rules to a Load Balancer.
+ """List checkpoints.
- To add an additional forwarding rule to a load balancer instance, send a POST
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
- of the request, there should be a ``forwarding_rules`` attribute containing an
- array of rules to be added.
-
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ To list your team's checkpoints, newest first, send a GET request to
+ ``/v2/microvms/checkpoints``. To list one MicroVM's checkpoints, add the ``microvm_id`` query
+ parameter.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ :keyword page: Which 'page' of paginated results to return. Default value is 1.
+ :paramtype page: int
+ :keyword per_page: Number of items returned per page. Default value is 25.
+ :paramtype per_page: int
+ :keyword microvm_id: Only return checkpoints taken from this MicroVM. Default value is None.
+ :paramtype microvm_id: 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 = {
- "forwarding_rules": [
+ # response body for status code(s): 200
+ response == {
+ "meta": {
+ "total": 0 # Optional. Number of objects returned by the request.
+ },
+ "checkpoints": [
{
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
+ "created_at": "2020-02-20 00:00:00", # Optional. When the
+ checkpoint was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the
+ checkpoint's disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the
+ checkpoint's memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM
+ the checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If
+ you do not set one, a name such as ``checkpoint-20260929-143559`` is
+ generated.
+ "region": "str", # Optional. The slug of the checkpoint's
+ region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB.
+ Required.
+ "disk": 0 # Optional. The size of the disk, in GB.
+ Set by the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can
+ create MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``.
+ Known values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
}
- ]
- }
-
- # 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]] = {
+ 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 add_forwarding_rules(
- self,
- lb_id: str,
- body: IO[bytes],
- *,
- content_type: str = "application/json",
- **kwargs: Any,
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Forwarding Rules to a Load Balancer.
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
- To add an additional forwarding rule to a load balancer instance, send a POST
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
- of the request, there should be a ``forwarding_rules`` attribute containing an
- array of rules to be added.
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ _request = build_microvm_checkpoints_list_request(
+ page=page,
+ per_page=per_page,
+ microvm_id=microvm_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_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".
- :paramtype content_type: str
- :return: JSON object or None
- :rtype: JSON or None
+ _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, checkpoint_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve a checkpoint.
+
+ To show information about a checkpoint, send a GET request to
+ ``/v2/microvms/checkpoints/{checkpoint_id}``.
+
+ :param checkpoint_id: The unique ID of the checkpoint. Required.
+ :type checkpoint_id: str
+ :return: JSON object
+ :rtype: JSON
:raises ~azure.core.exceptions.HttpResponseError:
Example:
.. code-block:: python
+ # response body for status code(s): 200
+ response == {
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
# 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
+ 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_microvm_checkpoints_get_request(
+ checkpoint_id=checkpoint_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
@distributed_trace
- def add_forwarding_rules(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
- # pylint: disable=line-too-long
- """Add Forwarding Rules to a Load Balancer.
+ def delete(self, checkpoint_id: str, **kwargs: Any) -> Optional[JSON]:
+ """Delete a checkpoint.
- To add an additional forwarding rule to a load balancer instance, send a POST
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the body
- of the request, there should be a ``forwarding_rules`` attribute containing an
- array of rules to be added.
+ To delete a checkpoint, send a DELETE request to ``/v2/microvms/checkpoints/{checkpoint_id}``.
+ You can no longer create MicroVMs from a deleted checkpoint.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The request returns HTTP 400 while the checkpoint is still being captured. A successful
+ request returns a ``204 No Content`` status code.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
- :type body: JSON or IO[bytes]
+ :param checkpoint_id: The unique ID of the checkpoint. Required.
+ :type checkpoint_id: str
:return: JSON object or None
:rtype: JSON or None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -195868,49 +203007,10 @@ def add_forwarding_rules(
Example:
.. code-block:: python
- # JSON input template you can fill out and use as your body input.
- body = {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
- }
- ]
- }
-
- # 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
- 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.
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -195926,27 +203026,13 @@ def add_forwarding_rules(
}
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[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:
- _json = body
-
- _request = build_load_balancers_add_forwarding_rules_request(
- lb_id=lb_id,
- content_type=content_type,
- json=_json,
- content=_content,
+ _request = build_microvm_checkpoints_delete_request(
+ checkpoint_id=checkpoint_id,
headers=_headers,
params=_params,
)
@@ -195961,7 +203047,7 @@ def add_forwarding_rules(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ if response.status_code not in [204, 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
@@ -195980,6 +203066,22 @@ def add_forwarding_rules(
"int", response.headers.get("ratelimit-reset")
)
+ 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")
@@ -196002,35 +203104,32 @@ def add_forwarding_rules(
return deserialized # type: ignore
@overload
- def remove_forwarding_rules(
+ def create(
self,
- lb_id: str,
- body: JSON,
+ microvm_id: str,
+ body: Optional[JSON] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Remove Forwarding Rules from a Load Balancer.
+ """Create a checkpoint of a MicroVM.
- To remove forwarding rules from a load balancer instance, send a DELETE
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
- body of the request, there should be a ``forwarding_rules`` attribute containing
- an array of rules to be removed.
+ To create a checkpoint of a running or paused MicroVM, send a POST request to
+ ``/v2/microvms/{microvm_id}/checkpoints``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The capture runs in the background and does not change the MicroVM's state. Poll
+ ``GET /v2/microvms/checkpoints/{checkpoint_id}`` until ``status`` is ``CHECKPOINT_AVAILABLE``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Required.
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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:
@@ -196038,120 +203137,136 @@ def remove_forwarding_rules(
# JSON input template you can fill out and use as your body input.
body = {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
- }
- ]
+ "name": "str" # Optional. A name for the checkpoint. If you omit it, a name
+ such as ``checkpoint-20260929-143559`` is generated.
}
- # response body for status code(s): 404
+ # response body for status code(s): 201
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.
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@overload
- def remove_forwarding_rules(
+ def create(
self,
- lb_id: str,
- body: IO[bytes],
+ microvm_id: str,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any,
- ) -> Optional[JSON]:
+ ) -> JSON:
# pylint: disable=line-too-long
- """Remove Forwarding Rules from a Load Balancer.
+ """Create a checkpoint of a MicroVM.
- To remove forwarding rules from a load balancer instance, send a DELETE
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
- body of the request, there should be a ``forwarding_rules`` attribute containing
- an array of rules to be removed.
+ To create a checkpoint of a running or paused MicroVM, send a POST request to
+ ``/v2/microvms/{microvm_id}/checkpoints``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The capture runs in the background and does not change the MicroVM's state. Poll
+ ``GET /v2/microvms/checkpoints/{checkpoint_id}`` until ``status`` is ``CHECKPOINT_AVAILABLE``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Required.
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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): 404
+ # response body for status code(s): 201
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.
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
@distributed_trace
- def remove_forwarding_rules(
- self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
- ) -> Optional[JSON]:
+ def create(
+ self,
+ microvm_id: str,
+ body: Optional[Union[JSON, IO[bytes]]] = None,
+ **kwargs: Any,
+ ) -> JSON:
# pylint: disable=line-too-long
- """Remove Forwarding Rules from a Load Balancer.
+ """Create a checkpoint of a MicroVM.
- To remove forwarding rules from a load balancer instance, send a DELETE
- request to ``/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules``. In the
- body of the request, there should be a ``forwarding_rules`` attribute containing
- an array of rules to be removed.
+ To create a checkpoint of a running or paused MicroVM, send a POST request to
+ ``/v2/microvms/{microvm_id}/checkpoints``.
- No response body will be sent back, but the response code will indicate
- success. Specifically, the response code will be a 204, which means that the
- action was successful with no returned body data.
+ The capture runs in the background and does not change the MicroVM's state. Poll
+ ``GET /v2/microvms/checkpoints/{checkpoint_id}`` until ``status`` is ``CHECKPOINT_AVAILABLE``.
- :param lb_id: A unique identifier for a load balancer. Required.
- :type lb_id: str
- :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :param microvm_id: The unique ID of the MicroVM. Required.
+ :type microvm_id: 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:
@@ -196159,47 +203274,43 @@ def remove_forwarding_rules(
# JSON input template you can fill out and use as your body input.
body = {
- "forwarding_rules": [
- {
- "entry_port": 0, # An integer representing the port on which
- the load balancer instance will listen. Required.
- "entry_protocol": "str", # The protocol used for traffic to
- the load balancer. The possible values are: ``http``"" , ``https``"" ,
- ``http2``"" , ``http3``"" , ``tcp``"" , or ``udp``. If you set the
- ``entry_protocol`` to ``udp``"" , the ``target_protocol`` must be set to
- ``udp``. When using UDP, the load balancer requires that you set up a
- health check with a port that uses TCP, HTTP, or HTTPS to work properly.
- Required. Known values are: "http", "https", "http2", "http3", "tcp", and
- "udp".
- "target_port": 0, # An integer representing the port on the
- backend Droplets to which the load balancer will send traffic. Required.
- "target_protocol": "str", # The protocol used for traffic
- from the load balancer to the backend Droplets. The possible values are:
- ``http``"" , ``https``"" , ``http2``"" , ``tcp``"" , or ``udp``. If you
- set the ``target_protocol`` to ``udp``"" , the ``entry_protocol`` must be
- set to ``udp``. When using UDP, the load balancer requires that you set
- up a health check with a port that uses TCP, HTTP, or HTTPS to work
- properly. Required. Known values are: "http", "https", "http2", "tcp",
- and "udp".
- "certificate_id": "str", # Optional. The ID of the TLS
- certificate used for SSL termination if enabled.
- "tls_passthrough": bool # Optional. A boolean value
- indicating whether SSL encrypted traffic will be passed through to the
- backend Droplets.
- }
- ]
+ "name": "str" # Optional. A name for the checkpoint. If you omit it, a name
+ such as ``checkpoint-20260929-143559`` is generated.
}
- # response body for status code(s): 404
+ # response body for status code(s): 201
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.
+ "checkpoint": {
+ "created_at": "2020-02-20 00:00:00", # Optional. When the checkpoint
+ was created, in ISO 8601 format.
+ "disk_bytes": 0, # Optional. The stored size of the checkpoint's
+ disk, in bytes.
+ "id": "str", # Optional. The unique ID of the checkpoint.
+ "memory_bytes": 0, # Optional. The stored size of the checkpoint's
+ memory, in bytes.
+ "microvm_id": "str", # Optional. The ID of the MicroVM the
+ checkpoint was taken from.
+ "microvm_name": "str", # Optional. The name of the MicroVM the
+ checkpoint was taken from.
+ "name": "str", # Optional. The name of the checkpoint. If you do not
+ set one, a name such as ``checkpoint-20260929-143559`` is generated.
+ "region": "str", # Optional. The slug of the checkpoint's region.
+ "size": {
+ "cpu": 0, # The number of vCPUs. Required.
+ "memory": 0, # The amount of memory, in MiB. Required.
+ "disk": 0 # Optional. The size of the disk, in GB. Set by
+ the size.
+ },
+ "status": "str" # Optional. The checkpoint's status. You can create
+ MicroVMs from the checkpoint when it is ``CHECKPOINT_AVAILABLE``. Known
+ values are: "CHECKPOINT_CREATING", "CHECKPOINT_AVAILABLE",
+ "CHECKPOINT_FAILED", "CHECKPOINT_DELETING", and "CHECKPOINT_DELETED".
+ }
+ }
+ # response body for status code(s): 400, 404
+ response == {
+ "code": "str", # A service-defined error code. Required.
+ "message": "str" # A human-readable description of the error. Required.
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
@@ -196221,7 +203332,7 @@ def remove_forwarding_rules(
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
@@ -196229,10 +203340,13 @@ def remove_forwarding_rules(
if isinstance(body, (IOBase, bytes)):
_content = body
else:
- _json = body
+ if body is not None:
+ _json = body
+ else:
+ _json = None
- _request = build_load_balancers_remove_forwarding_rules_request(
- lb_id=lb_id,
+ _request = build_microvm_checkpoints_create_request(
+ microvm_id=microvm_id,
content_type=content_type,
json=_json,
content=_content,
@@ -196250,15 +203364,30 @@ def remove_forwarding_rules(
response = pipeline_response.http_response
- if response.status_code not in [204, 404]:
+ 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 == 204:
+ 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 == 400:
response_headers["ratelimit-limit"] = self._deserialize(
"int", response.headers.get("ratelimit-limit")
)
@@ -196269,6 +203398,11 @@ def remove_forwarding_rules(
"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")
@@ -196286,9 +203420,9 @@ def remove_forwarding_rules(
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
class MonitoringOperations: # pylint: disable=too-many-public-methods