diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index 03e9dbc..2f91f3c 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -19beba4 +c31efb9 diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index e4393ca..c501a5b 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -238,6 +238,7 @@ build_load_balancers_add_droplets_request, build_load_balancers_add_forwarding_rules_request, build_load_balancers_create_request, + build_load_balancers_delete_cache_request, build_load_balancers_delete_request, build_load_balancers_get_request, build_load_balancers_list_request, @@ -133769,6 +133770,18 @@ async def create( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -133784,6 +133797,31 @@ async def create( 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. @@ -133859,6 +133897,11 @@ async def create( }, "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. + ], "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 @@ -133946,6 +133989,18 @@ async def create( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -133961,6 +134016,31 @@ async def create( 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. @@ -134036,6 +134116,11 @@ async def create( }, "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. + ], "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 @@ -134121,6 +134206,18 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -134136,6 +134233,31 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: 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. @@ -134211,6 +134333,11 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: }, "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. + ], "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 @@ -134368,6 +134495,18 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO 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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -134385,6 +134524,31 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO '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 @@ -134464,6 +134628,11 @@ async def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSO }, "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. + ], "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 @@ -134597,6 +134766,18 @@ async def get(self, lb_id: str, **kwargs: Any) -> JSON: "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -134612,6 +134793,31 @@ async def get(self, lb_id: str, **kwargs: Any) -> JSON: 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. @@ -134687,6 +134893,11 @@ async def get(self, lb_id: str, **kwargs: Any) -> JSON: }, "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. + ], "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 @@ -134865,6 +135076,18 @@ async def update( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -134880,6 +135103,31 @@ async def update( 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. @@ -134955,6 +135203,11 @@ async def update( }, "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. + ], "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 @@ -135053,6 +135306,18 @@ async def update( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -135068,6 +135333,31 @@ async def update( 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. @@ -135143,6 +135433,11 @@ async def update( }, "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. + ], "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 @@ -135236,6 +135531,18 @@ async def update( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -135251,6 +135558,31 @@ async def update( 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. @@ -135326,6 +135658,11 @@ async def update( }, "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. + ], "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 @@ -135546,6 +135883,112 @@ 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]: + # pylint: disable=line-too-long + """Delete a Global Load Balancer CDN Cache. + + To delete a Global load balancer CDN cache, send a DELETE request to + ``/v2/load_balancers/$LOAD_BALANCER_ID/cache``. + + 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): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. 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_load_balancers_delete_cache_request( + lb_id=lb_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 + @overload async def add_droplets( self, diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index 55d1e72..7e306ff 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -5308,6 +5308,27 @@ def build_load_balancers_delete_request(lb_id: str, **kwargs: Any) -> HttpReques return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) +def build_load_balancers_delete_cache_request( # pylint: disable=name-too-long + lb_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/load_balancers/{lb_id}/cache" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_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_load_balancers_add_droplets_request( # pylint: disable=name-too-long lb_id: str, **kwargs: Any ) -> HttpRequest: @@ -142254,6 +142275,18 @@ def create( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -142269,6 +142302,31 @@ def create( 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. @@ -142344,6 +142402,11 @@ def create( }, "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. + ], "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 @@ -142431,6 +142494,18 @@ def create( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -142446,6 +142521,31 @@ def create( 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. @@ -142521,6 +142621,11 @@ def create( }, "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. + ], "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 @@ -142606,6 +142711,18 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -142621,6 +142738,31 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: 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. @@ -142696,6 +142838,11 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: }, "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. + ], "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 @@ -142853,6 +143000,18 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON: 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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -142870,6 +143029,31 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON: '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 @@ -142949,6 +143133,11 @@ def list(self, *, per_page: int = 20, page: int = 1, **kwargs: Any) -> JSON: }, "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. + ], "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 @@ -143082,6 +143271,18 @@ def get(self, lb_id: str, **kwargs: Any) -> JSON: "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -143097,6 +143298,31 @@ def get(self, lb_id: str, **kwargs: Any) -> JSON: 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. @@ -143172,6 +143398,11 @@ def get(self, lb_id: str, **kwargs: Any) -> JSON: }, "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. + ], "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 @@ -143350,6 +143581,18 @@ def update( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -143365,6 +143608,31 @@ def update( 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. @@ -143440,6 +143708,11 @@ def update( }, "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. + ], "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 @@ -143538,6 +143811,18 @@ def update( "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -143553,6 +143838,31 @@ def update( 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. @@ -143628,6 +143938,11 @@ def update( }, "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. + ], "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 @@ -143719,6 +144034,18 @@ def update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSO "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. + } + ], "enable_backend_keepalive": False, # Optional. Default value is False. A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. @@ -143734,6 +144061,31 @@ def update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSO 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. @@ -143809,6 +144161,11 @@ def update(self, lb_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSO }, "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. + ], "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 @@ -144029,6 +144386,112 @@ 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]: + # pylint: disable=line-too-long + """Delete a Global Load Balancer CDN Cache. + + To delete a Global load balancer CDN cache, send a DELETE request to + ``/v2/load_balancers/$LOAD_BALANCER_ID/cache``. + + 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): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. 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_load_balancers_delete_cache_request( + lb_id=lb_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 + @overload def add_droplets( self,