diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json index a6ee6efb0619..ac64e8133366 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e7e775e2f3fe00f25fbd0e7ca0d953e22eef93ff", + "commit": "7ad7c5251b53e9d5c476060b7d777055a1703f61", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/servicefabricmanagedclusters/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/servicefabricmanagedclusters/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/servicefabricmanagedclusters/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py index 60af403e2a7d..ce30b3333ca9 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py @@ -31,14 +31,14 @@ class ServiceFabricManagedClustersManagementClientConfiguration( :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The customer subscription identifier. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-02-01-preview") + api_version: str = kwargs.pop("api_version", "2023-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_serialization.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_serialization.py index 842ae727fbbc..4bae2292227b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_serialization.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_serialization.py @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py index 7039b89375ee..4e2c2099e772 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py @@ -19,9 +19,11 @@ ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, + ManagedApplyMaintenanceWindowOperations, ManagedAzResiliencyStatusOperations, ManagedClusterVersionOperations, ManagedClustersOperations, + ManagedMaintenanceWindowStatusOperations, ManagedUnsupportedVMSizesOperations, NodeTypeSkusOperations, NodeTypesOperations, @@ -36,7 +38,7 @@ from azure.core.credentials import TokenCredential -class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes,name-too-long +class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Service Fabric Managed Clusters Management Client. :ivar application_types: ApplicationTypesOperations operations @@ -56,6 +58,12 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac :ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations :vartype managed_az_resiliency_status: azure.mgmt.servicefabricmanagedclusters.operations.ManagedAzResiliencyStatusOperations + :ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations + :vartype managed_maintenance_window_status: + azure.mgmt.servicefabricmanagedclusters.operations.ManagedMaintenanceWindowStatusOperations + :ivar managed_apply_maintenance_window: ManagedApplyMaintenanceWindowOperations operations + :vartype managed_apply_maintenance_window: + azure.mgmt.servicefabricmanagedclusters.operations.ManagedApplyMaintenanceWindowOperations :ivar managed_cluster_version: ManagedClusterVersionOperations operations :vartype managed_cluster_version: azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations @@ -81,7 +89,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -118,6 +126,12 @@ def __init__( self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_cluster_version = ManagedClusterVersionOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py index 1ac60b8d8979..eae7c95b6fbd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b4" +VERSION = "0.1.0" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py index feeb23ab368a..0710224e0bbb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py @@ -31,14 +31,14 @@ class ServiceFabricManagedClustersManagementClientConfiguration( :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The customer subscription identifier. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-02-01-preview") + api_version: str = kwargs.pop("api_version", "2023-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py index 445785dcb479..f8bd3957c835 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py @@ -19,9 +19,11 @@ ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, + ManagedApplyMaintenanceWindowOperations, ManagedAzResiliencyStatusOperations, ManagedClusterVersionOperations, ManagedClustersOperations, + ManagedMaintenanceWindowStatusOperations, ManagedUnsupportedVMSizesOperations, NodeTypeSkusOperations, NodeTypesOperations, @@ -36,7 +38,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes,name-too-long +class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Service Fabric Managed Clusters Management Client. :ivar application_types: ApplicationTypesOperations operations @@ -56,6 +58,12 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac :ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations :vartype managed_az_resiliency_status: azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedAzResiliencyStatusOperations + :ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations + :vartype managed_maintenance_window_status: + azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedMaintenanceWindowStatusOperations + :ivar managed_apply_maintenance_window: ManagedApplyMaintenanceWindowOperations operations + :vartype managed_apply_maintenance_window: + azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedApplyMaintenanceWindowOperations :ivar managed_cluster_version: ManagedClusterVersionOperations operations :vartype managed_cluster_version: azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations @@ -81,7 +89,7 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=client-ac :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-02-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -118,6 +126,12 @@ def __init__( self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_cluster_version = ManagedClusterVersionOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py index 08c9d16e841d..9510cbbfb9c2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py @@ -12,6 +12,8 @@ from ._services_operations import ServicesOperations from ._managed_clusters_operations import ManagedClustersOperations from ._managed_az_resiliency_status_operations import ManagedAzResiliencyStatusOperations +from ._managed_maintenance_window_status_operations import ManagedMaintenanceWindowStatusOperations +from ._managed_apply_maintenance_window_operations import ManagedApplyMaintenanceWindowOperations from ._managed_cluster_version_operations import ManagedClusterVersionOperations from ._managed_unsupported_vm_sizes_operations import ManagedUnsupportedVMSizesOperations from ._operation_status_operations import OperationStatusOperations @@ -31,6 +33,8 @@ "ServicesOperations", "ManagedClustersOperations", "ManagedAzResiliencyStatusOperations", + "ManagedMaintenanceWindowStatusOperations", + "ManagedApplyMaintenanceWindowOperations", "ManagedClusterVersionOperations", "ManagedUnsupportedVMSizesOperations", "OperationStatusOperations", diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py index 1e37a8ababdd..e4f831e63349 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -161,7 +162,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeVersionResource") @@ -195,14 +196,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -520,7 +527,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeVersionUpdateParameters") @@ -608,8 +615,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py index e9954e5553c3..577aca2f8ef3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -246,7 +247,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeResource") @@ -404,7 +405,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeUpdateParameters") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py index 7da06924de1f..e6102c14dad3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -35,7 +36,11 @@ build_delete_request, build_get_request, build_list_request, + build_read_upgrade_request, + build_resume_upgrade_request, + build_start_rollback_request, build_update_request, + build_update_upgrade_request, ) T = TypeVar("T") @@ -61,6 +66,745 @@ def __init__(self, *args, **kwargs) -> None: 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") + async def _read_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_read_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._read_upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _read_upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/fetchUpgradeStatus" + } + + @distributed_trace_async + async def begin_read_upgrade( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Get the status of the latest application upgrade. + + Get the status of the latest application upgrade. It will query the cluster to find the status + of the latest application upgrade. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._read_upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_read_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/fetchUpgradeStatus" + } + + async def _start_rollback_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_rollback_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_rollback_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_rollback_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/startRollback" + } + + @distributed_trace_async + async def begin_start_rollback( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to start a rollback of the current application upgrade. + + Send a request to start a rollback of the current application upgrade. This will start rolling + back the application to the previous version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_rollback_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_rollback.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/startRollback" + } + + async def _resume_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeResumeApplicationUpgradeParameters") + + request = build_resume_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resume_upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/resumeUpgrade" + } + + @overload + async def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.RuntimeResumeApplicationUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to resume the current application upgrade. + + Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to resume the current application upgrade. + + Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to resume the current application upgrade. + + Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Is either a + RuntimeResumeApplicationUpgradeParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._resume_upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_resume_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/resumeUpgrade" + } + + async def _update_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeApplicationUpgradeUpdateDescription, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeApplicationUpgradeUpdateDescription") + + request = build_update_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/updateUpgrade" + } + + @overload + async def begin_update_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.RuntimeApplicationUpgradeUpdateDescription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to update the current application upgrade. + + Send a request to update the current application upgrade. This will update the application + upgrade settings for the current upgrade. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeApplicationUpgradeUpdateDescription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to update the current application upgrade. + + Send a request to update the current application upgrade. This will update the application + upgrade settings for the current upgrade. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeApplicationUpgradeUpdateDescription, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to update the current application upgrade. + + Send a request to update the current application upgrade. This will update the application + upgrade settings for the current upgrade. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Is either a + RuntimeApplicationUpgradeUpdateDescription type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeApplicationUpgradeUpdateDescription or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/updateUpgrade" + } + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any @@ -157,7 +901,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationResource") @@ -190,14 +934,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApplicationResource", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ApplicationResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -490,7 +1240,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationUpdateParameters") @@ -576,8 +1326,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_apply_maintenance_window_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_apply_maintenance_window_operations.py new file mode 100644 index 000000000000..737a11978237 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_apply_maintenance_window_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_apply_maintenance_window_operations import build_post_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedApplyMaintenanceWindowOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_apply_maintenance_window` attribute. + """ + + models = _models + + 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 post( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> None: + """Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any + pending update will be applied. + + Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any + pending update will be applied. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_post_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.post.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applyMaintenanceWindow" + } diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py index 7788fb4e0939..1d3bd861e506 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -151,7 +152,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters" } @distributed_trace @@ -327,7 +328,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ManagedCluster") @@ -359,14 +360,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -637,7 +644,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ManagedClusterUpdateParameters") @@ -721,8 +728,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_maintenance_window_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_maintenance_window_status_operations.py new file mode 100644 index 000000000000..c23c463f4d33 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_maintenance_window_status_operations.py @@ -0,0 +1,117 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_maintenance_window_status_operations import build_get_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedMaintenanceWindowStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_maintenance_window_status` attribute. + """ + + models = _models + + 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 get( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> _models.ManagedMaintenanceWindowStatus: + """Action to get Maintenance Window Status of the Service Fabric Managed Clusters. + + Action to get Maintenance Window Status of the Service Fabric Managed Clusters. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedMaintenanceWindowStatus or the result of cls(response) + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedMaintenanceWindowStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ManagedMaintenanceWindowStatus] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedMaintenanceWindowStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getMaintenanceWindowStatus" + } diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py index 7565cf437157..ac4bb482b538 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -155,7 +156,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) list_by_managed_clusters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes" } async def _restart_initial( # pylint: disable=inconsistent-return-statements @@ -184,7 +185,7 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeActionParameters") @@ -217,8 +218,15 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart" @@ -418,7 +426,7 @@ async def _reimage_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeActionParameters") @@ -451,8 +459,15 @@ async def _reimage_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _reimage_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage" @@ -652,7 +667,7 @@ async def _delete_node_initial( # pylint: disable=inconsistent-return-statement content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeActionParameters") @@ -685,8 +700,15 @@ async def _delete_node_initial( # pylint: disable=inconsistent-return-statement error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_node_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode" @@ -955,7 +977,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeType") @@ -988,14 +1010,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("NodeType", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("NodeType", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -1287,7 +1315,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeUpdateParameters") @@ -1373,8 +1401,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py index 8142d27a2aa6..8643489ec6c0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py @@ -106,8 +106,12 @@ async def get( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) get.metadata = { "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py index 072d6aef19d0..3ceec54e9268 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -162,7 +163,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ServiceResource") @@ -196,14 +197,20 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ServiceResource", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -520,7 +527,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ServiceUpdateParameters") @@ -608,8 +615,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py index 764022bbb14f..246104dc1e35 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from ._models_py3 import AddRemoveIncrementalNamedPartitionScalingMechanism +from ._models_py3 import AdditionalNetworkInterfaceConfiguration from ._models_py3 import ApplicationHealthPolicy from ._models_py3 import ApplicationResource from ._models_py3 import ApplicationResourceList @@ -25,11 +26,18 @@ from ._models_py3 import AverageServiceLoadScalingTrigger from ._models_py3 import AzureActiveDirectory from ._models_py3 import ClientCertificate +from ._models_py3 import ClusterHealthPolicy +from ._models_py3 import ClusterMonitoringPolicy +from ._models_py3 import ClusterUpgradeDeltaHealthPolicy +from ._models_py3 import ClusterUpgradePolicy from ._models_py3 import EndpointRangeDescription from ._models_py3 import ErrorModel from ._models_py3 import ErrorModelError from ._models_py3 import FrontendConfiguration from ._models_py3 import IPTag +from ._models_py3 import IpConfiguration +from ._models_py3 import IpConfigurationPublicIPAddressConfiguration +from ._models_py3 import IpTag from ._models_py3 import LoadBalancingRule from ._models_py3 import LongRunningOperationResult from ._models_py3 import ManagedAzResiliencyStatus @@ -38,6 +46,7 @@ from ._models_py3 import ManagedClusterListResult from ._models_py3 import ManagedClusterUpdateParameters from ._models_py3 import ManagedIdentity +from ._models_py3 import ManagedMaintenanceWindowStatus from ._models_py3 import ManagedProxyResource from ._models_py3 import ManagedVMSize from ._models_py3 import ManagedVMSizesResult @@ -60,6 +69,11 @@ from ._models_py3 import Resource from ._models_py3 import ResourceAzStatus from ._models_py3 import RollingUpgradeMonitoringPolicy +from ._models_py3 import RuntimeApplicationHealthPolicy +from ._models_py3 import RuntimeApplicationUpgradeUpdateDescription +from ._models_py3 import RuntimeResumeApplicationUpgradeParameters +from ._models_py3 import RuntimeRollingUpgradeUpdateDescription +from ._models_py3 import RuntimeServiceTypeHealthPolicy from ._models_py3 import ScalingMechanism from ._models_py3 import ScalingPolicy from ._models_py3 import ScalingTrigger @@ -93,6 +107,7 @@ from ._models_py3 import VMSize from ._models_py3 import VaultCertificate from ._models_py3 import VaultSecretGroup +from ._models_py3 import VmImagePlan from ._models_py3 import VmManagedIdentity from ._models_py3 import VmssDataDisk @@ -115,9 +130,11 @@ from ._service_fabric_managed_clusters_management_client_enums import OsType from ._service_fabric_managed_clusters_management_client_enums import PartitionScheme from ._service_fabric_managed_clusters_management_client_enums import PrivateEndpointNetworkPolicies +from ._service_fabric_managed_clusters_management_client_enums import PrivateIPAddressVersion from ._service_fabric_managed_clusters_management_client_enums import PrivateLinkServiceNetworkPolicies from ._service_fabric_managed_clusters_management_client_enums import ProbeProtocol from ._service_fabric_managed_clusters_management_client_enums import Protocol +from ._service_fabric_managed_clusters_management_client_enums import PublicIPAddressVersion from ._service_fabric_managed_clusters_management_client_enums import RollingUpgradeMode from ._service_fabric_managed_clusters_management_client_enums import SecurityType from ._service_fabric_managed_clusters_management_client_enums import ServiceCorrelationScheme @@ -129,7 +146,10 @@ from ._service_fabric_managed_clusters_management_client_enums import ServiceScalingTriggerKind from ._service_fabric_managed_clusters_management_client_enums import SkuName from ._service_fabric_managed_clusters_management_client_enums import UpdateType +from ._service_fabric_managed_clusters_management_client_enums import UpgradeKind +from ._service_fabric_managed_clusters_management_client_enums import UpgradeMode from ._service_fabric_managed_clusters_management_client_enums import VmSetupAction +from ._service_fabric_managed_clusters_management_client_enums import VmssExtensionSetupOrder from ._service_fabric_managed_clusters_management_client_enums import ZonalUpdateMode from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -137,6 +157,7 @@ __all__ = [ "AddRemoveIncrementalNamedPartitionScalingMechanism", + "AdditionalNetworkInterfaceConfiguration", "ApplicationHealthPolicy", "ApplicationResource", "ApplicationResourceList", @@ -155,11 +176,18 @@ "AverageServiceLoadScalingTrigger", "AzureActiveDirectory", "ClientCertificate", + "ClusterHealthPolicy", + "ClusterMonitoringPolicy", + "ClusterUpgradeDeltaHealthPolicy", + "ClusterUpgradePolicy", "EndpointRangeDescription", "ErrorModel", "ErrorModelError", "FrontendConfiguration", "IPTag", + "IpConfiguration", + "IpConfigurationPublicIPAddressConfiguration", + "IpTag", "LoadBalancingRule", "LongRunningOperationResult", "ManagedAzResiliencyStatus", @@ -168,6 +196,7 @@ "ManagedClusterListResult", "ManagedClusterUpdateParameters", "ManagedIdentity", + "ManagedMaintenanceWindowStatus", "ManagedProxyResource", "ManagedVMSize", "ManagedVMSizesResult", @@ -190,6 +219,11 @@ "Resource", "ResourceAzStatus", "RollingUpgradeMonitoringPolicy", + "RuntimeApplicationHealthPolicy", + "RuntimeApplicationUpgradeUpdateDescription", + "RuntimeResumeApplicationUpgradeParameters", + "RuntimeRollingUpgradeUpdateDescription", + "RuntimeServiceTypeHealthPolicy", "ScalingMechanism", "ScalingPolicy", "ScalingTrigger", @@ -223,6 +257,7 @@ "VMSize", "VaultCertificate", "VaultSecretGroup", + "VmImagePlan", "VmManagedIdentity", "VmssDataDisk", "Access", @@ -244,9 +279,11 @@ "OsType", "PartitionScheme", "PrivateEndpointNetworkPolicies", + "PrivateIPAddressVersion", "PrivateLinkServiceNetworkPolicies", "ProbeProtocol", "Protocol", + "PublicIPAddressVersion", "RollingUpgradeMode", "SecurityType", "ServiceCorrelationScheme", @@ -258,7 +295,10 @@ "ServiceScalingTriggerKind", "SkuName", "UpdateType", + "UpgradeKind", + "UpgradeMode", "VmSetupAction", + "VmssExtensionSetupOrder", "ZonalUpdateMode", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py index a59c161fedf3..321902ee057b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py @@ -24,6 +24,64 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +class AdditionalNetworkInterfaceConfiguration(_serialization.Model): + """Specifies the settings for a network interface to attach to the node type. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the network interface. Required. + :vartype name: str + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :vartype enable_accelerated_networking: bool + :ivar dscp_configuration: Specifies the DSCP configuration to apply to the network interface. + :vartype dscp_configuration: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource + :ivar ip_configurations: Specifies the IP configurations of the network interface. Required. + :vartype ip_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.IpConfiguration] + """ + + _validation = { + "name": {"required": True}, + "ip_configurations": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "enable_accelerated_networking": {"key": "enableAcceleratedNetworking", "type": "bool"}, + "dscp_configuration": {"key": "dscpConfiguration", "type": "SubResource"}, + "ip_configurations": {"key": "ipConfigurations", "type": "[IpConfiguration]"}, + } + + def __init__( + self, + *, + name: str, + ip_configurations: List["_models.IpConfiguration"], + enable_accelerated_networking: Optional[bool] = None, + dscp_configuration: Optional["_models.SubResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the network interface. Required. + :paramtype name: str + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword dscp_configuration: Specifies the DSCP configuration to apply to the network + interface. + :paramtype dscp_configuration: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource + :keyword ip_configurations: Specifies the IP configurations of the network interface. Required. + :paramtype ip_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.IpConfiguration] + """ + super().__init__(**kwargs) + self.name = name + self.enable_accelerated_networking = enable_accelerated_networking + self.dscp_configuration = dscp_configuration + self.ip_configurations = ip_configurations + + class ScalingMechanism(_serialization.Model): """Describes the mechanism for performing a scaling operation. @@ -1104,6 +1162,332 @@ def __init__( self.issuer_thumbprint = issuer_thumbprint +class ClusterHealthPolicy(_serialization.Model): + """Defines a health policy used to evaluate the health of the cluster or of a cluster node. + + All required parameters must be populated in order to send to Azure. + + :ivar max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before + reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of nodes that can be unhealthy + before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy node, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy nodes over the total number + of nodes in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + + In large clusters, some nodes will always be down or out for repairs, so this percentage + should be configured to tolerate that. Required. + :vartype max_percent_unhealthy_nodes: int + :ivar max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy + applications before reporting an error. For example, to allow 10% of applications to be + unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of applications that can be + unhealthy before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy application, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy applications over the total number of + application instances in the cluster, excluding applications of application types that are + included in the ApplicationTypeHealthPolicyMap. + The computation rounds up to tolerate one failure on small numbers of applications. Default + percentage is zero. Required. + :vartype max_percent_unhealthy_applications: int + """ + + _validation = { + "max_percent_unhealthy_nodes": {"required": True, "maximum": 100, "minimum": 0}, + "max_percent_unhealthy_applications": {"required": True, "maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "max_percent_unhealthy_nodes": {"key": "maxPercentUnhealthyNodes", "type": "int"}, + "max_percent_unhealthy_applications": {"key": "maxPercentUnhealthyApplications", "type": "int"}, + } + + def __init__( + self, *, max_percent_unhealthy_nodes: int = 0, max_percent_unhealthy_applications: int = 0, **kwargs: Any + ) -> None: + """ + :keyword max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before + reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of nodes that can be unhealthy + before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy node, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy nodes over the total number + of nodes in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + + In large clusters, some nodes will always be down or out for repairs, so this percentage + should be configured to tolerate that. Required. + :paramtype max_percent_unhealthy_nodes: int + :keyword max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy + applications before reporting an error. For example, to allow 10% of applications to be + unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of applications that can be + unhealthy before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy application, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy applications over the total number of + application instances in the cluster, excluding applications of application types that are + included in the ApplicationTypeHealthPolicyMap. + The computation rounds up to tolerate one failure on small numbers of applications. Default + percentage is zero. Required. + :paramtype max_percent_unhealthy_applications: int + """ + super().__init__(**kwargs) + self.max_percent_unhealthy_nodes = max_percent_unhealthy_nodes + self.max_percent_unhealthy_applications = max_percent_unhealthy_applications + + +class ClusterMonitoringPolicy(_serialization.Model): + """Describes the monitoring policies for the cluster upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar health_check_wait_duration: The length of time to wait after completing an upgrade domain + before performing health checks. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms + format. Required. + :vartype health_check_wait_duration: str + :ivar health_check_stable_duration: The amount of time that the application or cluster must + remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in + either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype health_check_stable_duration: str + :ivar health_check_retry_timeout: The amount of time to retry health evaluation when the + application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either + hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype health_check_retry_timeout: str + :ivar upgrade_timeout: The amount of time the overall upgrade has to complete before the + upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype upgrade_timeout: str + :ivar upgrade_domain_timeout: The amount of time each upgrade domain has to complete before the + upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype upgrade_domain_timeout: str + """ + + _validation = { + "health_check_wait_duration": {"required": True}, + "health_check_stable_duration": {"required": True}, + "health_check_retry_timeout": {"required": True}, + "upgrade_timeout": {"required": True}, + "upgrade_domain_timeout": {"required": True}, + } + + _attribute_map = { + "health_check_wait_duration": {"key": "healthCheckWaitDuration", "type": "str"}, + "health_check_stable_duration": {"key": "healthCheckStableDuration", "type": "str"}, + "health_check_retry_timeout": {"key": "healthCheckRetryTimeout", "type": "str"}, + "upgrade_timeout": {"key": "upgradeTimeout", "type": "str"}, + "upgrade_domain_timeout": {"key": "upgradeDomainTimeout", "type": "str"}, + } + + def __init__( + self, + *, + health_check_wait_duration: str, + health_check_stable_duration: str, + health_check_retry_timeout: str, + upgrade_timeout: str, + upgrade_domain_timeout: str, + **kwargs: Any + ) -> None: + """ + :keyword health_check_wait_duration: The length of time to wait after completing an upgrade + domain before performing health checks. The duration can be in either hh:mm:ss or in + d.hh:mm:ss.ms format. Required. + :paramtype health_check_wait_duration: str + :keyword health_check_stable_duration: The amount of time that the application or cluster must + remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in + either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :paramtype health_check_stable_duration: str + :keyword health_check_retry_timeout: The amount of time to retry health evaluation when the + application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either + hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :paramtype health_check_retry_timeout: str + :keyword upgrade_timeout: The amount of time the overall upgrade has to complete before the + upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :paramtype upgrade_timeout: str + :keyword upgrade_domain_timeout: The amount of time each upgrade domain has to complete before + the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. + Required. + :paramtype upgrade_domain_timeout: str + """ + super().__init__(**kwargs) + self.health_check_wait_duration = health_check_wait_duration + self.health_check_stable_duration = health_check_stable_duration + self.health_check_retry_timeout = health_check_retry_timeout + self.upgrade_timeout = upgrade_timeout + self.upgrade_domain_timeout = upgrade_domain_timeout + + +class ClusterUpgradeDeltaHealthPolicy(_serialization.Model): + """Describes the delta health policies for the cluster upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar max_percent_delta_unhealthy_nodes: The maximum allowed percentage of nodes health + degradation allowed during cluster upgrades. + The delta is measured between the state of the nodes at the beginning of upgrade and the state + of the nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. Required. + :vartype max_percent_delta_unhealthy_nodes: int + :ivar max_percent_upgrade_domain_delta_unhealthy_nodes: The maximum allowed percentage of + upgrade domain nodes health degradation allowed during cluster upgrades. + The delta is measured between the state of the upgrade domain nodes at the beginning of + upgrade and the state of the upgrade domain nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion for all completed upgrade + domains to make sure the state of the upgrade domains is within tolerated limits. + :vartype max_percent_upgrade_domain_delta_unhealthy_nodes: int + :ivar max_percent_delta_unhealthy_applications: The maximum allowed percentage of applications + health degradation allowed during cluster upgrades. + The delta is measured between the state of the applications at the beginning of upgrade and + the state of the applications at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. System services are not included in this. + NOTE: This value will overwrite the value specified in + properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications. + :vartype max_percent_delta_unhealthy_applications: int + """ + + _validation = { + "max_percent_delta_unhealthy_nodes": {"required": True, "maximum": 100, "minimum": 0}, + "max_percent_upgrade_domain_delta_unhealthy_nodes": {"maximum": 100, "minimum": 0}, + "max_percent_delta_unhealthy_applications": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "max_percent_delta_unhealthy_nodes": {"key": "maxPercentDeltaUnhealthyNodes", "type": "int"}, + "max_percent_upgrade_domain_delta_unhealthy_nodes": { + "key": "maxPercentUpgradeDomainDeltaUnhealthyNodes", + "type": "int", + }, + "max_percent_delta_unhealthy_applications": {"key": "maxPercentDeltaUnhealthyApplications", "type": "int"}, + } + + def __init__( + self, + *, + max_percent_delta_unhealthy_nodes: int, + max_percent_upgrade_domain_delta_unhealthy_nodes: Optional[int] = None, + max_percent_delta_unhealthy_applications: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_percent_delta_unhealthy_nodes: The maximum allowed percentage of nodes health + degradation allowed during cluster upgrades. + The delta is measured between the state of the nodes at the beginning of upgrade and the state + of the nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. Required. + :paramtype max_percent_delta_unhealthy_nodes: int + :keyword max_percent_upgrade_domain_delta_unhealthy_nodes: The maximum allowed percentage of + upgrade domain nodes health degradation allowed during cluster upgrades. + The delta is measured between the state of the upgrade domain nodes at the beginning of + upgrade and the state of the upgrade domain nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion for all completed upgrade + domains to make sure the state of the upgrade domains is within tolerated limits. + :paramtype max_percent_upgrade_domain_delta_unhealthy_nodes: int + :keyword max_percent_delta_unhealthy_applications: The maximum allowed percentage of + applications health degradation allowed during cluster upgrades. + The delta is measured between the state of the applications at the beginning of upgrade and + the state of the applications at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. System services are not included in this. + NOTE: This value will overwrite the value specified in + properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications. + :paramtype max_percent_delta_unhealthy_applications: int + """ + super().__init__(**kwargs) + self.max_percent_delta_unhealthy_nodes = max_percent_delta_unhealthy_nodes + self.max_percent_upgrade_domain_delta_unhealthy_nodes = max_percent_upgrade_domain_delta_unhealthy_nodes + self.max_percent_delta_unhealthy_applications = max_percent_delta_unhealthy_applications + + +class ClusterUpgradePolicy(_serialization.Model): + """Describes the policy used when upgrading the cluster. + + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when + the code version has not changed (the upgrade only changes configuration or data). + :vartype force_restart: bool + :ivar health_policy: The cluster health policy defines a health policy used to evaluate the + health of the cluster during a cluster upgrade. + :vartype health_policy: ~azure.mgmt.servicefabricmanagedclusters.models.ClusterHealthPolicy + :ivar delta_health_policy: The cluster delta health policy defines a health policy used to + evaluate the health of the cluster during a cluster upgrade. + :vartype delta_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeDeltaHealthPolicy + :ivar monitoring_policy: The cluster monitoring policy describes the parameters for monitoring + an upgrade in Monitored mode. + :vartype monitoring_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterMonitoringPolicy + :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an + upgrade domain and prevent loss of availability when there are unexpected issues. + When this timeout expires, processing of the upgrade domain will proceed regardless of + availability loss issues. + The timeout is reset at the start of each upgrade domain. The timeout can be in either + hh:mm:ss or in d.hh:mm:ss.ms format. + This value must be between 00:00:00 and 49710.06:28:15 (unsigned 32 bit integer for seconds). + :vartype upgrade_replica_set_check_timeout: str + """ + + _attribute_map = { + "force_restart": {"key": "forceRestart", "type": "bool"}, + "health_policy": {"key": "healthPolicy", "type": "ClusterHealthPolicy"}, + "delta_health_policy": {"key": "deltaHealthPolicy", "type": "ClusterUpgradeDeltaHealthPolicy"}, + "monitoring_policy": {"key": "monitoringPolicy", "type": "ClusterMonitoringPolicy"}, + "upgrade_replica_set_check_timeout": {"key": "upgradeReplicaSetCheckTimeout", "type": "str"}, + } + + def __init__( + self, + *, + force_restart: Optional[bool] = None, + health_policy: Optional["_models.ClusterHealthPolicy"] = None, + delta_health_policy: Optional["_models.ClusterUpgradeDeltaHealthPolicy"] = None, + monitoring_policy: Optional["_models.ClusterMonitoringPolicy"] = None, + upgrade_replica_set_check_timeout: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword force_restart: If true, then processes are forcefully restarted during upgrade even + when the code version has not changed (the upgrade only changes configuration or data). + :paramtype force_restart: bool + :keyword health_policy: The cluster health policy defines a health policy used to evaluate the + health of the cluster during a cluster upgrade. + :paramtype health_policy: ~azure.mgmt.servicefabricmanagedclusters.models.ClusterHealthPolicy + :keyword delta_health_policy: The cluster delta health policy defines a health policy used to + evaluate the health of the cluster during a cluster upgrade. + :paramtype delta_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeDeltaHealthPolicy + :keyword monitoring_policy: The cluster monitoring policy describes the parameters for + monitoring an upgrade in Monitored mode. + :paramtype monitoring_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterMonitoringPolicy + :keyword upgrade_replica_set_check_timeout: The maximum amount of time to block processing of + an upgrade domain and prevent loss of availability when there are unexpected issues. + When this timeout expires, processing of the upgrade domain will proceed regardless of + availability loss issues. + The timeout is reset at the start of each upgrade domain. The timeout can be in either + hh:mm:ss or in d.hh:mm:ss.ms format. + This value must be between 00:00:00 and 49710.06:28:15 (unsigned 32 bit integer for seconds). + :paramtype upgrade_replica_set_check_timeout: str + """ + super().__init__(**kwargs) + self.force_restart = force_restart + self.health_policy = health_policy + self.delta_health_policy = delta_health_policy + self.monitoring_policy = monitoring_policy + self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout + + class EndpointRangeDescription(_serialization.Model): """Port range details. @@ -1247,6 +1631,161 @@ def __init__( self.application_gateway_backend_address_pool_id = application_gateway_backend_address_pool_id +class IpConfiguration(_serialization.Model): + """Specifies an IP configuration of the network interface. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the network interface. Required. + :vartype name: str + :ivar application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A node type can reference backend address pools of + multiple application gateways. Multiple node types cannot use the same application gateway. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :ivar load_balancer_backend_address_pools: Specifies an array of references to backend address + pools of load balancers. A node type can reference backend address pools of one public and one + internal load balancer. Multiple node types cannot use the same basic sku load balancer. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :ivar load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools of + the load balancers. A node type can reference inbound nat pools of one public and one internal + load balancer. Multiple node types cannot use the same basic sku load balancer. + :vartype load_balancer_inbound_nat_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :ivar subnet: Specifies the subnet of the network interface. + :vartype subnet: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource + :ivar private_ip_address_version: Specifies whether the IP configuration's private IP is IPv4 + or IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PrivateIPAddressVersion + :ivar public_ip_address_configuration: The public IP address configuration of the network + interface. + :vartype public_ip_address_configuration: + ~azure.mgmt.servicefabricmanagedclusters.models.IpConfigurationPublicIPAddressConfiguration + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "application_gateway_backend_address_pools": { + "key": "applicationGatewayBackendAddressPools", + "type": "[SubResource]", + }, + "load_balancer_backend_address_pools": {"key": "loadBalancerBackendAddressPools", "type": "[SubResource]"}, + "load_balancer_inbound_nat_pools": {"key": "loadBalancerInboundNatPools", "type": "[SubResource]"}, + "subnet": {"key": "subnet", "type": "SubResource"}, + "private_ip_address_version": {"key": "privateIPAddressVersion", "type": "str"}, + "public_ip_address_configuration": { + "key": "publicIPAddressConfiguration", + "type": "IpConfigurationPublicIPAddressConfiguration", + }, + } + + def __init__( + self, + *, + name: str, + application_gateway_backend_address_pools: Optional[List["_models.SubResource"]] = None, + load_balancer_backend_address_pools: Optional[List["_models.SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[List["_models.SubResource"]] = None, + subnet: Optional["_models.SubResource"] = None, + private_ip_address_version: Union[str, "_models.PrivateIPAddressVersion"] = "IPv4", + public_ip_address_configuration: Optional["_models.IpConfigurationPublicIPAddressConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the network interface. Required. + :paramtype name: str + :keyword application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A node type can reference backend address pools of + multiple application gateways. Multiple node types cannot use the same application gateway. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :keyword load_balancer_backend_address_pools: Specifies an array of references to backend + address pools of load balancers. A node type can reference backend address pools of one public + and one internal load balancer. Multiple node types cannot use the same basic sku load + balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :keyword load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools + of the load balancers. A node type can reference inbound nat pools of one public and one + internal load balancer. Multiple node types cannot use the same basic sku load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :keyword subnet: Specifies the subnet of the network interface. + :paramtype subnet: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource + :keyword private_ip_address_version: Specifies whether the IP configuration's private IP is + IPv4 or IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". + :paramtype private_ip_address_version: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PrivateIPAddressVersion + :keyword public_ip_address_configuration: The public IP address configuration of the network + interface. + :paramtype public_ip_address_configuration: + ~azure.mgmt.servicefabricmanagedclusters.models.IpConfigurationPublicIPAddressConfiguration + """ + super().__init__(**kwargs) + self.name = name + self.application_gateway_backend_address_pools = application_gateway_backend_address_pools + self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + self.load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools + self.subnet = subnet + self.private_ip_address_version = private_ip_address_version + self.public_ip_address_configuration = public_ip_address_configuration + + +class IpConfigurationPublicIPAddressConfiguration(_serialization.Model): + """The public IP address configuration of the network interface. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Name of the network interface. Required. + :vartype name: str + :ivar ip_tags: Specifies the list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] + :ivar public_ip_address_version: Specifies whether the IP configuration's public IP is IPv4 or + IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". + :vartype public_ip_address_version: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PublicIPAddressVersion + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "ip_tags": {"key": "ipTags", "type": "[IpTag]"}, + "public_ip_address_version": {"key": "publicIPAddressVersion", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + ip_tags: Optional[List["_models.IpTag"]] = None, + public_ip_address_version: Union[str, "_models.PublicIPAddressVersion"] = "IPv4", + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the network interface. Required. + :paramtype name: str + :keyword ip_tags: Specifies the list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] + :keyword public_ip_address_version: Specifies whether the IP configuration's public IP is IPv4 + or IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". + :paramtype public_ip_address_version: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PublicIPAddressVersion + """ + super().__init__(**kwargs) + self.name = name + self.ip_tags = ip_tags + self.public_ip_address_version = public_ip_address_version + + class IPTag(_serialization.Model): """IPTag associated with the object. @@ -1280,6 +1819,39 @@ def __init__(self, *, ip_tag_type: str, tag: str, **kwargs: Any) -> None: self.tag = tag +class IpTag(_serialization.Model): + """The IP tag associated with the public IP address. + + All required parameters must be populated in order to send to Azure. + + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. Required. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. Required. + :vartype tag: str + """ + + _validation = { + "ip_tag_type": {"required": True}, + "tag": {"required": True}, + } + + _attribute_map = { + "ip_tag_type": {"key": "ipTagType", "type": "str"}, + "tag": {"key": "tag", "type": "str"}, + } + + def __init__(self, *, ip_tag_type: str, tag: str, **kwargs: Any) -> None: + """ + :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. Required. + :paramtype ip_tag_type: str + :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. Required. + :paramtype tag: str + """ + super().__init__(**kwargs) + self.ip_tag_type = ip_tag_type + self.tag = tag + + class LoadBalancingRule(_serialization.Model): """Describes a load balancing rule. @@ -1647,6 +2219,20 @@ class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes VNet, but the subnet is specified at node type level; and for such clusters, the subnetId property is required for node types. :vartype use_custom_vnet: bool + :ivar public_ip_prefix_id: Specify the resource id of a public IPv4 prefix that the load + balancer will allocate a public IPv4 address from. This setting cannot be changed once the + cluster is created. + :vartype public_ip_prefix_id: str + :ivar public_i_pv6_prefix_id: Specify the resource id of a public IPv6 prefix that the load + balancer will allocate a public IPv6 address from. This setting cannot be changed once the + cluster is created. + :vartype public_i_pv6_prefix_id: str + :ivar ddos_protection_plan_id: Specify the resource id of a DDoS network protection plan that + will be associated with the virtual network of the cluster. + :vartype ddos_protection_plan_id: str + :ivar upgrade_description: The policy to use when upgrading the cluster. + :vartype upgrade_description: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy """ _validation = { @@ -1711,6 +2297,10 @@ class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes "service_endpoints": {"key": "properties.serviceEndpoints", "type": "[ServiceEndpoint]"}, "zonal_update_mode": {"key": "properties.zonalUpdateMode", "type": "str"}, "use_custom_vnet": {"key": "properties.useCustomVnet", "type": "bool"}, + "public_ip_prefix_id": {"key": "properties.publicIPPrefixId", "type": "str"}, + "public_i_pv6_prefix_id": {"key": "properties.publicIPv6PrefixId", "type": "str"}, + "ddos_protection_plan_id": {"key": "properties.ddosProtectionPlanId", "type": "str"}, + "upgrade_description": {"key": "properties.upgradeDescription", "type": "ClusterUpgradePolicy"}, } def __init__( # pylint: disable=too-many-locals @@ -1745,6 +2335,10 @@ def __init__( # pylint: disable=too-many-locals service_endpoints: Optional[List["_models.ServiceEndpoint"]] = None, zonal_update_mode: Optional[Union[str, "_models.ZonalUpdateMode"]] = None, use_custom_vnet: Optional[bool] = None, + public_ip_prefix_id: Optional[str] = None, + public_i_pv6_prefix_id: Optional[str] = None, + ddos_protection_plan_id: Optional[str] = None, + upgrade_description: Optional["_models.ClusterUpgradePolicy"] = None, **kwargs: Any ) -> None: """ @@ -1838,6 +2432,20 @@ def __init__( # pylint: disable=too-many-locals own VNet, but the subnet is specified at node type level; and for such clusters, the subnetId property is required for node types. :paramtype use_custom_vnet: bool + :keyword public_ip_prefix_id: Specify the resource id of a public IPv4 prefix that the load + balancer will allocate a public IPv4 address from. This setting cannot be changed once the + cluster is created. + :paramtype public_ip_prefix_id: str + :keyword public_i_pv6_prefix_id: Specify the resource id of a public IPv6 prefix that the load + balancer will allocate a public IPv6 address from. This setting cannot be changed once the + cluster is created. + :paramtype public_i_pv6_prefix_id: str + :keyword ddos_protection_plan_id: Specify the resource id of a DDoS network protection plan + that will be associated with the virtual network of the cluster. + :paramtype ddos_protection_plan_id: str + :keyword upgrade_description: The policy to use when upgrading the cluster. + :paramtype upgrade_description: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy """ super().__init__(location=location, tags=tags, **kwargs) self.sku = sku @@ -1874,6 +2482,10 @@ def __init__( # pylint: disable=too-many-locals self.service_endpoints = service_endpoints self.zonal_update_mode = zonal_update_mode self.use_custom_vnet = use_custom_vnet + self.public_ip_prefix_id = public_ip_prefix_id + self.public_i_pv6_prefix_id = public_i_pv6_prefix_id + self.ddos_protection_plan_id = ddos_protection_plan_id + self.upgrade_description = upgrade_description class ManagedClusterCodeVersionResult(_serialization.Model): @@ -2035,10 +2647,63 @@ def __init__( ~azure.mgmt.servicefabricmanagedclusters.models.UserAssignedIdentity] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ManagedMaintenanceWindowStatus(_serialization.Model): + """Describes the maintenance window status of the Service Fabric Managed Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_window_enabled: If maintenance window is enabled on this cluster. + :vartype is_window_enabled: bool + :ivar is_region_ready: Indicates if the region is ready to configure maintenance windows. + :vartype is_region_ready: bool + :ivar is_window_active: If maintenance window is active. + :vartype is_window_active: bool + :ivar can_apply_updates: If updates can be applied. + :vartype can_apply_updates: bool + :ivar last_window_status_update_at_utc: Last window update time in UTC. + :vartype last_window_status_update_at_utc: ~datetime.datetime + :ivar last_window_start_time_utc: Last window start time in UTC. + :vartype last_window_start_time_utc: ~datetime.datetime + :ivar last_window_end_time_utc: Last window end time in UTC. + :vartype last_window_end_time_utc: ~datetime.datetime + """ + + _validation = { + "is_window_enabled": {"readonly": True}, + "is_region_ready": {"readonly": True}, + "is_window_active": {"readonly": True}, + "can_apply_updates": {"readonly": True}, + "last_window_status_update_at_utc": {"readonly": True}, + "last_window_start_time_utc": {"readonly": True}, + "last_window_end_time_utc": {"readonly": True}, + } + + _attribute_map = { + "is_window_enabled": {"key": "isWindowEnabled", "type": "bool"}, + "is_region_ready": {"key": "isRegionReady", "type": "bool"}, + "is_window_active": {"key": "isWindowActive", "type": "bool"}, + "can_apply_updates": {"key": "canApplyUpdates", "type": "bool"}, + "last_window_status_update_at_utc": {"key": "lastWindowStatusUpdateAtUTC", "type": "iso-8601"}, + "last_window_start_time_utc": {"key": "lastWindowStartTimeUTC", "type": "iso-8601"}, + "last_window_end_time_utc": {"key": "lastWindowEndTimeUTC", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.is_window_enabled = None + self.is_region_ready = None + self.is_window_active = None + self.can_apply_updates = None + self.last_window_status_update_at_utc = None + self.last_window_start_time_utc = None + self.last_window_end_time_utc = None class ManagedProxyResource(_serialization.Model): @@ -2526,12 +3191,34 @@ class NodeType(ManagedProxyResource): # pylint: disable=too-many-instance-attri :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the nodeType. Can only be used with TrustedLaunch SecurityType. :vartype secure_boot_enabled: bool - :ivar enable_node_public_ip: Specifies whether each node is allocated its own public IP + :ivar enable_node_public_ip: Specifies whether each node is allocated its own public IPv4 address. This is only supported on secondary node types with custom Load Balancers. :vartype enable_node_public_ip: bool + :ivar enable_node_public_i_pv6: Specifies whether each node is allocated its own public IPv6 + address. This is only supported on secondary node types with custom Load Balancers. + :vartype enable_node_public_i_pv6: bool :ivar vm_shared_gallery_image_id: Indicates the resource id of the vm shared galleries image. This parameter is used for custom vm image. :vartype vm_shared_gallery_image_id: str + :ivar nat_gateway_id: Specifies the resource id of a NAT Gateway to attach to the subnet of + this node type. Node type must use custom load balancer. + :vartype nat_gateway_id: str + :ivar vm_image_plan: Specifies information about the marketplace image used to create the + virtual machine. This element is only used for marketplace images. Before you can use a + marketplace image from an API, you must enable the image for programmatic use. In the Azure + portal, find the marketplace image that you want to use and then click Want to deploy + programmatically, Get Started ->. Enter any required information and then click Save. + :vartype vm_image_plan: ~azure.mgmt.servicefabricmanagedclusters.models.VmImagePlan + :ivar service_artifact_reference_id: Specifies the service artifact reference id used to set + same image version for all virtual machines in the scale set when using 'latest' image version. + :vartype service_artifact_reference_id: str + :ivar dscp_configuration_id: Specifies the resource id of the DSCP configuration to apply to + the node type network interface. + :vartype dscp_configuration_id: str + :ivar additional_network_interface_configurations: Specifies the settings for any additional + secondary network interfaces to attach to the node type. + :vartype additional_network_interface_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.AdditionalNetworkInterfaceConfiguration] """ _validation = { @@ -2591,7 +3278,16 @@ class NodeType(ManagedProxyResource): # pylint: disable=too-many-instance-attri "security_type": {"key": "properties.securityType", "type": "str"}, "secure_boot_enabled": {"key": "properties.secureBootEnabled", "type": "bool"}, "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, - "vm_shared_gallery_image_id": {"key": "properties.VmSharedGalleryImageId", "type": "str"}, + "enable_node_public_i_pv6": {"key": "properties.enableNodePublicIPv6", "type": "bool"}, + "vm_shared_gallery_image_id": {"key": "properties.vmSharedGalleryImageId", "type": "str"}, + "nat_gateway_id": {"key": "properties.natGatewayId", "type": "str"}, + "vm_image_plan": {"key": "properties.vmImagePlan", "type": "VmImagePlan"}, + "service_artifact_reference_id": {"key": "properties.serviceArtifactReferenceId", "type": "str"}, + "dscp_configuration_id": {"key": "properties.dscpConfigurationId", "type": "str"}, + "additional_network_interface_configurations": { + "key": "properties.additionalNetworkInterfaceConfigurations", + "type": "[AdditionalNetworkInterfaceConfiguration]", + }, } def __init__( # pylint: disable=too-many-locals @@ -2631,14 +3327,22 @@ def __init__( # pylint: disable=too-many-locals host_group_id: Optional[str] = None, use_ephemeral_os_disk: Optional[bool] = None, spot_restore_timeout: Optional[str] = None, - eviction_policy: Union[str, "_models.EvictionPolicyType"] = "Delete", + eviction_policy: Optional[Union[str, "_models.EvictionPolicyType"]] = None, vm_image_resource_id: Optional[str] = None, subnet_id: Optional[str] = None, vm_setup_actions: Optional[List[Union[str, "_models.VmSetupAction"]]] = None, security_type: Optional[Union[str, "_models.SecurityType"]] = None, secure_boot_enabled: Optional[bool] = None, enable_node_public_ip: Optional[bool] = None, + enable_node_public_i_pv6: Optional[bool] = None, vm_shared_gallery_image_id: Optional[str] = None, + nat_gateway_id: Optional[str] = None, + vm_image_plan: Optional["_models.VmImagePlan"] = None, + service_artifact_reference_id: Optional[str] = None, + dscp_configuration_id: Optional[str] = None, + additional_network_interface_configurations: Optional[ + List["_models.AdditionalNetworkInterfaceConfiguration"] + ] = None, **kwargs: Any ) -> None: """ @@ -2774,12 +3478,34 @@ def __init__( # pylint: disable=too-many-locals :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the nodeType. Can only be used with TrustedLaunch SecurityType. :paramtype secure_boot_enabled: bool - :keyword enable_node_public_ip: Specifies whether each node is allocated its own public IP + :keyword enable_node_public_ip: Specifies whether each node is allocated its own public IPv4 address. This is only supported on secondary node types with custom Load Balancers. :paramtype enable_node_public_ip: bool + :keyword enable_node_public_i_pv6: Specifies whether each node is allocated its own public IPv6 + address. This is only supported on secondary node types with custom Load Balancers. + :paramtype enable_node_public_i_pv6: bool :keyword vm_shared_gallery_image_id: Indicates the resource id of the vm shared galleries image. This parameter is used for custom vm image. :paramtype vm_shared_gallery_image_id: str + :keyword nat_gateway_id: Specifies the resource id of a NAT Gateway to attach to the subnet of + this node type. Node type must use custom load balancer. + :paramtype nat_gateway_id: str + :keyword vm_image_plan: Specifies information about the marketplace image used to create the + virtual machine. This element is only used for marketplace images. Before you can use a + marketplace image from an API, you must enable the image for programmatic use. In the Azure + portal, find the marketplace image that you want to use and then click Want to deploy + programmatically, Get Started ->. Enter any required information and then click Save. + :paramtype vm_image_plan: ~azure.mgmt.servicefabricmanagedclusters.models.VmImagePlan + :keyword service_artifact_reference_id: Specifies the service artifact reference id used to set + same image version for all virtual machines in the scale set when using 'latest' image version. + :paramtype service_artifact_reference_id: str + :keyword dscp_configuration_id: Specifies the resource id of the DSCP configuration to apply to + the node type network interface. + :paramtype dscp_configuration_id: str + :keyword additional_network_interface_configurations: Specifies the settings for any additional + secondary network interfaces to attach to the node type. + :paramtype additional_network_interface_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.AdditionalNetworkInterfaceConfiguration] """ super().__init__(tags=tags, **kwargs) self.sku = sku @@ -2823,7 +3549,13 @@ def __init__( # pylint: disable=too-many-locals self.security_type = security_type self.secure_boot_enabled = secure_boot_enabled self.enable_node_public_ip = enable_node_public_ip + self.enable_node_public_i_pv6 = enable_node_public_i_pv6 self.vm_shared_gallery_image_id = vm_shared_gallery_image_id + self.nat_gateway_id = nat_gateway_id + self.vm_image_plan = vm_image_plan + self.service_artifact_reference_id = service_artifact_reference_id + self.dscp_configuration_id = dscp_configuration_id + self.additional_network_interface_configurations = additional_network_interface_configurations class NodeTypeActionParameters(_serialization.Model): @@ -3371,6 +4103,454 @@ def __init__( self.upgrade_domain_timeout = upgrade_domain_timeout +class RuntimeApplicationHealthPolicy(_serialization.Model): + """Defines a health policy used to evaluate the health of an application or one of its children + entities. + + :ivar consider_warning_as_error: Indicates whether warnings are treated with the same severity + as errors. + :vartype consider_warning_as_error: bool + :ivar max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy + deployed applications. Allowed values are Byte values from zero to 100. + The percentage represents the maximum tolerated percentage of deployed applications that can + be unhealthy before the application is considered in error. + This is calculated by dividing the number of unhealthy deployed applications over the number + of nodes where the application is currently deployed on in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + :vartype max_percent_unhealthy_deployed_applications: int + :ivar default_service_type_health_policy: Represents the health policy used to evaluate the + health of services belonging to a service type. + :vartype default_service_type_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeServiceTypeHealthPolicy + :ivar service_type_health_policy_map: Defines a ServiceTypeHealthPolicy per service type name. + + The entries in the map replace the default service type health policy for each specified + service type. + For example, in an application that contains both a stateless gateway service type and a + stateful engine service type, the health policies for the stateless and stateful services can + be configured differently. + With policy per service type, there's more granular control of the health of the service. + + If no policy is specified for a service type name, the DefaultServiceTypeHealthPolicy is used + for evaluation. + :vartype service_type_health_policy_map: JSON + """ + + _attribute_map = { + "consider_warning_as_error": {"key": "considerWarningAsError", "type": "bool"}, + "max_percent_unhealthy_deployed_applications": { + "key": "maxPercentUnhealthyDeployedApplications", + "type": "int", + }, + "default_service_type_health_policy": { + "key": "defaultServiceTypeHealthPolicy", + "type": "RuntimeServiceTypeHealthPolicy", + }, + "service_type_health_policy_map": {"key": "serviceTypeHealthPolicyMap", "type": "object"}, + } + + def __init__( + self, + *, + consider_warning_as_error: bool = False, + max_percent_unhealthy_deployed_applications: int = 0, + default_service_type_health_policy: Optional["_models.RuntimeServiceTypeHealthPolicy"] = None, + service_type_health_policy_map: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword consider_warning_as_error: Indicates whether warnings are treated with the same + severity as errors. + :paramtype consider_warning_as_error: bool + :keyword max_percent_unhealthy_deployed_applications: The maximum allowed percentage of + unhealthy deployed applications. Allowed values are Byte values from zero to 100. + The percentage represents the maximum tolerated percentage of deployed applications that can + be unhealthy before the application is considered in error. + This is calculated by dividing the number of unhealthy deployed applications over the number + of nodes where the application is currently deployed on in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + :paramtype max_percent_unhealthy_deployed_applications: int + :keyword default_service_type_health_policy: Represents the health policy used to evaluate the + health of services belonging to a service type. + :paramtype default_service_type_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeServiceTypeHealthPolicy + :keyword service_type_health_policy_map: Defines a ServiceTypeHealthPolicy per service type + name. + + The entries in the map replace the default service type health policy for each specified + service type. + For example, in an application that contains both a stateless gateway service type and a + stateful engine service type, the health policies for the stateless and stateful services can + be configured differently. + With policy per service type, there's more granular control of the health of the service. + + If no policy is specified for a service type name, the DefaultServiceTypeHealthPolicy is used + for evaluation. + :paramtype service_type_health_policy_map: JSON + """ + super().__init__(**kwargs) + self.consider_warning_as_error = consider_warning_as_error + self.max_percent_unhealthy_deployed_applications = max_percent_unhealthy_deployed_applications + self.default_service_type_health_policy = default_service_type_health_policy + self.service_type_health_policy_map = service_type_health_policy_map + + +class RuntimeApplicationUpgradeUpdateDescription(_serialization.Model): + """Describes the parameters for updating an ongoing application upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the application, including the 'fabric:' URI scheme. Required. + :vartype name: str + :ivar upgrade_kind: The kind of upgrade out of the following possible values. "Rolling" + :vartype upgrade_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.UpgradeKind + :ivar application_health_policy: Defines a health policy used to evaluate the health of an + application or one of its children entities. + :vartype application_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeApplicationHealthPolicy + :ivar update_description: Describes the parameters for updating a rolling upgrade of + application or cluster. + :vartype update_description: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeRollingUpgradeUpdateDescription + """ + + _validation = { + "name": {"required": True}, + "upgrade_kind": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "upgrade_kind": {"key": "upgradeKind", "type": "str"}, + "application_health_policy": {"key": "applicationHealthPolicy", "type": "RuntimeApplicationHealthPolicy"}, + "update_description": {"key": "updateDescription", "type": "RuntimeRollingUpgradeUpdateDescription"}, + } + + def __init__( + self, + *, + name: str, + upgrade_kind: Union[str, "_models.UpgradeKind"] = "Rolling", + application_health_policy: Optional["_models.RuntimeApplicationHealthPolicy"] = None, + update_description: Optional["_models.RuntimeRollingUpgradeUpdateDescription"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the application, including the 'fabric:' URI scheme. Required. + :paramtype name: str + :keyword upgrade_kind: The kind of upgrade out of the following possible values. "Rolling" + :paramtype upgrade_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.UpgradeKind + :keyword application_health_policy: Defines a health policy used to evaluate the health of an + application or one of its children entities. + :paramtype application_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeApplicationHealthPolicy + :keyword update_description: Describes the parameters for updating a rolling upgrade of + application or cluster. + :paramtype update_description: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeRollingUpgradeUpdateDescription + """ + super().__init__(**kwargs) + self.name = name + self.upgrade_kind = upgrade_kind + self.application_health_policy = application_health_policy + self.update_description = update_description + + +class RuntimeResumeApplicationUpgradeParameters(_serialization.Model): + """Parameters for Resume Upgrade action. The upgrade domain name must be specified. + + :ivar upgrade_domain_name: The upgrade domain name. Expected to be the next upgrade domain if + the application is upgrading. + :vartype upgrade_domain_name: str + """ + + _attribute_map = { + "upgrade_domain_name": {"key": "upgradeDomainName", "type": "str"}, + } + + def __init__(self, *, upgrade_domain_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword upgrade_domain_name: The upgrade domain name. Expected to be the next upgrade domain + if the application is upgrading. + :paramtype upgrade_domain_name: str + """ + super().__init__(**kwargs) + self.upgrade_domain_name = upgrade_domain_name + + +class RuntimeRollingUpgradeUpdateDescription(_serialization.Model): + """Describes the parameters for updating a rolling upgrade of application or cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar rolling_upgrade_mode: The mode used to monitor health during a rolling upgrade. The + values are UnmonitoredAuto, UnmonitoredManual, Monitored, and UnmonitoredDeferred. Known values + are: "UnmonitoredAuto", "UnmonitoredManual", and "Monitored". + :vartype rolling_upgrade_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.UpgradeMode + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when + the code version has not changed (the upgrade only changes configuration or data). + :vartype force_restart: bool + :ivar replica_set_check_timeout_in_milliseconds: The maximum amount of time to block processing + of an upgrade domain and prevent loss of availability when there are unexpected issues. When + this timeout expires, processing of the upgrade domain will proceed regardless of availability + loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between + 0 and 42949672925 inclusive. (unsigned 32-bit integer). + :vartype replica_set_check_timeout_in_milliseconds: int + :ivar failure_action: The compensating action to perform when a Monitored upgrade encounters + monitoring policy or health policy violations. + Rollback specifies that the upgrade will start rolling back automatically. + Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Known values + are: "Rollback" and "Manual". + :vartype failure_action: str or ~azure.mgmt.servicefabricmanagedclusters.models.FailureAction + :ivar health_check_wait_duration_in_milliseconds: The amount of time to wait after completing + an upgrade domain before applying health policies. It is first interpreted as a string + representing an ISO 8601 duration. If that fails, then it is interpreted as a number + representing the total number of milliseconds. + :vartype health_check_wait_duration_in_milliseconds: str + :ivar health_check_stable_duration_in_milliseconds: The amount of time that the application or + cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is first + interpreted as a string representing an ISO 8601 duration. If that fails, then it is + interpreted as a number representing the total number of milliseconds. + :vartype health_check_stable_duration_in_milliseconds: str + :ivar health_check_retry_timeout_in_milliseconds: The amount of time to retry health evaluation + when the application or cluster is unhealthy before FailureAction is executed. It is first + interpreted as a string representing an ISO 8601 duration. If that fails, then it is + interpreted as a number representing the total number of milliseconds. + :vartype health_check_retry_timeout_in_milliseconds: str + :ivar upgrade_timeout_in_milliseconds: The amount of time the overall upgrade has to complete + before FailureAction is executed. It is first interpreted as a string representing an ISO 8601 + duration. If that fails, then it is interpreted as a number representing the total number of + milliseconds. + :vartype upgrade_timeout_in_milliseconds: str + :ivar upgrade_domain_timeout_in_milliseconds: The amount of time each upgrade domain has to + complete before FailureAction is executed. It is first interpreted as a string representing an + ISO 8601 duration. If that fails, then it is interpreted as a number representing the total + number of milliseconds. + :vartype upgrade_domain_timeout_in_milliseconds: str + :ivar instance_close_delay_duration_in_seconds: Duration in seconds, to wait before a stateless + instance is closed, to allow the active requests to drain gracefully. This would be effective + when the instance is closing during the application/cluster + upgrade, only for those instances which have a non-zero delay duration configured in the + service description. + Note, the default value of InstanceCloseDelayDurationInSeconds is 4294967295, which indicates + that the behavior will entirely depend on the delay configured in the stateless service + description. + :vartype instance_close_delay_duration_in_seconds: int + """ + + _validation = { + "rolling_upgrade_mode": {"required": True}, + } + + _attribute_map = { + "rolling_upgrade_mode": {"key": "rollingUpgradeMode", "type": "str"}, + "force_restart": {"key": "forceRestart", "type": "bool"}, + "replica_set_check_timeout_in_milliseconds": {"key": "replicaSetCheckTimeoutInMilliseconds", "type": "int"}, + "failure_action": {"key": "failureAction", "type": "str"}, + "health_check_wait_duration_in_milliseconds": {"key": "healthCheckWaitDurationInMilliseconds", "type": "str"}, + "health_check_stable_duration_in_milliseconds": { + "key": "healthCheckStableDurationInMilliseconds", + "type": "str", + }, + "health_check_retry_timeout_in_milliseconds": {"key": "healthCheckRetryTimeoutInMilliseconds", "type": "str"}, + "upgrade_timeout_in_milliseconds": {"key": "upgradeTimeoutInMilliseconds", "type": "str"}, + "upgrade_domain_timeout_in_milliseconds": {"key": "upgradeDomainTimeoutInMilliseconds", "type": "str"}, + "instance_close_delay_duration_in_seconds": {"key": "instanceCloseDelayDurationInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + rolling_upgrade_mode: Union[str, "_models.UpgradeMode"] = "Monitored", + force_restart: bool = False, + replica_set_check_timeout_in_milliseconds: int = 42949672925, + failure_action: Optional[Union[str, "_models.FailureAction"]] = None, + health_check_wait_duration_in_milliseconds: Optional[str] = None, + health_check_stable_duration_in_milliseconds: Optional[str] = None, + health_check_retry_timeout_in_milliseconds: Optional[str] = None, + upgrade_timeout_in_milliseconds: Optional[str] = None, + upgrade_domain_timeout_in_milliseconds: Optional[str] = None, + instance_close_delay_duration_in_seconds: int = 4294967295, + **kwargs: Any + ) -> None: + """ + :keyword rolling_upgrade_mode: The mode used to monitor health during a rolling upgrade. The + values are UnmonitoredAuto, UnmonitoredManual, Monitored, and UnmonitoredDeferred. Known values + are: "UnmonitoredAuto", "UnmonitoredManual", and "Monitored". + :paramtype rolling_upgrade_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.UpgradeMode + :keyword force_restart: If true, then processes are forcefully restarted during upgrade even + when the code version has not changed (the upgrade only changes configuration or data). + :paramtype force_restart: bool + :keyword replica_set_check_timeout_in_milliseconds: The maximum amount of time to block + processing of an upgrade domain and prevent loss of availability when there are unexpected + issues. When this timeout expires, processing of the upgrade domain will proceed regardless of + availability loss issues. The timeout is reset at the start of each upgrade domain. Valid + values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer). + :paramtype replica_set_check_timeout_in_milliseconds: int + :keyword failure_action: The compensating action to perform when a Monitored upgrade encounters + monitoring policy or health policy violations. + Rollback specifies that the upgrade will start rolling back automatically. + Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Known values + are: "Rollback" and "Manual". + :paramtype failure_action: str or ~azure.mgmt.servicefabricmanagedclusters.models.FailureAction + :keyword health_check_wait_duration_in_milliseconds: The amount of time to wait after + completing an upgrade domain before applying health policies. It is first interpreted as a + string representing an ISO 8601 duration. If that fails, then it is interpreted as a number + representing the total number of milliseconds. + :paramtype health_check_wait_duration_in_milliseconds: str + :keyword health_check_stable_duration_in_milliseconds: The amount of time that the application + or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is + first interpreted as a string representing an ISO 8601 duration. If that fails, then it is + interpreted as a number representing the total number of milliseconds. + :paramtype health_check_stable_duration_in_milliseconds: str + :keyword health_check_retry_timeout_in_milliseconds: The amount of time to retry health + evaluation when the application or cluster is unhealthy before FailureAction is executed. It is + first interpreted as a string representing an ISO 8601 duration. If that fails, then it is + interpreted as a number representing the total number of milliseconds. + :paramtype health_check_retry_timeout_in_milliseconds: str + :keyword upgrade_timeout_in_milliseconds: The amount of time the overall upgrade has to + complete before FailureAction is executed. It is first interpreted as a string representing an + ISO 8601 duration. If that fails, then it is interpreted as a number representing the total + number of milliseconds. + :paramtype upgrade_timeout_in_milliseconds: str + :keyword upgrade_domain_timeout_in_milliseconds: The amount of time each upgrade domain has to + complete before FailureAction is executed. It is first interpreted as a string representing an + ISO 8601 duration. If that fails, then it is interpreted as a number representing the total + number of milliseconds. + :paramtype upgrade_domain_timeout_in_milliseconds: str + :keyword instance_close_delay_duration_in_seconds: Duration in seconds, to wait before a + stateless instance is closed, to allow the active requests to drain gracefully. This would be + effective when the instance is closing during the application/cluster + upgrade, only for those instances which have a non-zero delay duration configured in the + service description. + Note, the default value of InstanceCloseDelayDurationInSeconds is 4294967295, which indicates + that the behavior will entirely depend on the delay configured in the stateless service + description. + :paramtype instance_close_delay_duration_in_seconds: int + """ + super().__init__(**kwargs) + self.rolling_upgrade_mode = rolling_upgrade_mode + self.force_restart = force_restart + self.replica_set_check_timeout_in_milliseconds = replica_set_check_timeout_in_milliseconds + self.failure_action = failure_action + self.health_check_wait_duration_in_milliseconds = health_check_wait_duration_in_milliseconds + self.health_check_stable_duration_in_milliseconds = health_check_stable_duration_in_milliseconds + self.health_check_retry_timeout_in_milliseconds = health_check_retry_timeout_in_milliseconds + self.upgrade_timeout_in_milliseconds = upgrade_timeout_in_milliseconds + self.upgrade_domain_timeout_in_milliseconds = upgrade_domain_timeout_in_milliseconds + self.instance_close_delay_duration_in_seconds = instance_close_delay_duration_in_seconds + + +class RuntimeServiceTypeHealthPolicy(_serialization.Model): + """Represents the health policy used to evaluate the health of services belonging to a service + type. + + :ivar max_percent_unhealthy_partitions_per_service: The maximum allowed percentage of unhealthy + partitions per service. Allowed values are Byte values from zero to 100 + + The percentage represents the maximum tolerated percentage of partitions that can be unhealthy + before the service is considered in error. + If the percentage is respected but there is at least one unhealthy partition, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy partitions over the total + number of partitions in the service. + The computation rounds up to tolerate one failure on small numbers of partitions. Default + percentage is zero. + :vartype max_percent_unhealthy_partitions_per_service: int + :ivar max_percent_unhealthy_replicas_per_partition: The maximum allowed percentage of unhealthy + replicas per partition. Allowed values are Byte values from zero to 100. + + The percentage represents the maximum tolerated percentage of replicas that can be unhealthy + before the partition is considered in error. + If the percentage is respected but there is at least one unhealthy replica, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy replicas over the total + number of replicas in the partition. + The computation rounds up to tolerate one failure on small numbers of replicas. Default + percentage is zero. + :vartype max_percent_unhealthy_replicas_per_partition: int + :ivar max_percent_unhealthy_services: The maximum maximum allowed percentage of unhealthy + services. Allowed values are Byte values from zero to 100. + + The percentage represents the maximum tolerated percentage of services that can be unhealthy + before the application is considered in error. + If the percentage is respected but there is at least one unhealthy service, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy services of the specific service type + over the total number of services of the specific service type. + The computation rounds up to tolerate one failure on small numbers of services. Default + percentage is zero. + :vartype max_percent_unhealthy_services: int + """ + + _attribute_map = { + "max_percent_unhealthy_partitions_per_service": { + "key": "maxPercentUnhealthyPartitionsPerService", + "type": "int", + }, + "max_percent_unhealthy_replicas_per_partition": { + "key": "maxPercentUnhealthyReplicasPerPartition", + "type": "int", + }, + "max_percent_unhealthy_services": {"key": "maxPercentUnhealthyServices", "type": "int"}, + } + + def __init__( + self, + *, + max_percent_unhealthy_partitions_per_service: int = 0, + max_percent_unhealthy_replicas_per_partition: int = 0, + max_percent_unhealthy_services: int = 0, + **kwargs: Any + ) -> None: + """ + :keyword max_percent_unhealthy_partitions_per_service: The maximum allowed percentage of + unhealthy partitions per service. Allowed values are Byte values from zero to 100 + + The percentage represents the maximum tolerated percentage of partitions that can be unhealthy + before the service is considered in error. + If the percentage is respected but there is at least one unhealthy partition, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy partitions over the total + number of partitions in the service. + The computation rounds up to tolerate one failure on small numbers of partitions. Default + percentage is zero. + :paramtype max_percent_unhealthy_partitions_per_service: int + :keyword max_percent_unhealthy_replicas_per_partition: The maximum allowed percentage of + unhealthy replicas per partition. Allowed values are Byte values from zero to 100. + + The percentage represents the maximum tolerated percentage of replicas that can be unhealthy + before the partition is considered in error. + If the percentage is respected but there is at least one unhealthy replica, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy replicas over the total + number of replicas in the partition. + The computation rounds up to tolerate one failure on small numbers of replicas. Default + percentage is zero. + :paramtype max_percent_unhealthy_replicas_per_partition: int + :keyword max_percent_unhealthy_services: The maximum maximum allowed percentage of unhealthy + services. Allowed values are Byte values from zero to 100. + + The percentage represents the maximum tolerated percentage of services that can be unhealthy + before the application is considered in error. + If the percentage is respected but there is at least one unhealthy service, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy services of the specific service type + over the total number of services of the specific service type. + The computation rounds up to tolerate one failure on small numbers of services. Default + percentage is zero. + :paramtype max_percent_unhealthy_services: int + """ + super().__init__(**kwargs) + self.max_percent_unhealthy_partitions_per_service = max_percent_unhealthy_partitions_per_service + self.max_percent_unhealthy_replicas_per_partition = max_percent_unhealthy_replicas_per_partition + self.max_percent_unhealthy_services = max_percent_unhealthy_services + + class ScalingPolicy(_serialization.Model): """Specifies a metric to load balance a service during runtime. @@ -5087,6 +6267,58 @@ def __init__( self.vault_certificates = vault_certificates +class VmImagePlan(_serialization.Model): + """Specifies information about the marketplace image used to create the virtual machine. This + element is only used for marketplace images. Before you can use a marketplace image from an + API, you must enable the image for programmatic use. In the Azure portal, find the marketplace + image that you want to use and then click Want to deploy programmatically, Get Started ->. + Enter any required information and then click Save. + + :ivar name: The plan ID. + :vartype name: str + :ivar product: Specifies the product of the image from the marketplace. This is the same value + as Offer under the imageReference element. + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str + :ivar publisher: The publisher ID. + :vartype publisher: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + publisher: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + """ + super().__init__(**kwargs) + self.name = name + self.product = product + self.promotion_code = promotion_code + self.publisher = publisher + + class VmManagedIdentity(_serialization.Model): """Identities for the virtual machine scale set under the node type. @@ -5233,6 +6465,9 @@ class VMSSExtension(_serialization.Model): # pylint: disable=too-many-instance- :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. :vartype enable_automatic_upgrade: bool + :ivar setup_order: Indicates the setup order for the extension. + :vartype setup_order: list[str or + ~azure.mgmt.servicefabricmanagedclusters.models.VmssExtensionSetupOrder] """ _validation = { @@ -5255,6 +6490,7 @@ class VMSSExtension(_serialization.Model): # pylint: disable=too-many-instance- "provision_after_extensions": {"key": "properties.provisionAfterExtensions", "type": "[str]"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, + "setup_order": {"key": "properties.setupOrder", "type": "[str]"}, } def __init__( @@ -5270,6 +6506,7 @@ def __init__( force_update_tag: Optional[str] = None, provision_after_extensions: Optional[List[str]] = None, enable_automatic_upgrade: Optional[bool] = None, + setup_order: Optional[List[Union[str, "_models.VmssExtensionSetupOrder"]]] = None, **kwargs: Any ) -> None: """ @@ -5300,6 +6537,9 @@ def __init__( :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. :paramtype enable_automatic_upgrade: bool + :keyword setup_order: Indicates the setup order for the extension. + :paramtype setup_order: list[str or + ~azure.mgmt.servicefabricmanagedclusters.models.VmssExtensionSetupOrder] """ super().__init__(**kwargs) self.name = name @@ -5313,3 +6553,4 @@ def __init__( self.provision_after_extensions = provision_after_extensions self.provisioning_state = None self.enable_automatic_upgrade = enable_automatic_upgrade + self.setup_order = setup_order diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py index 6965bb5ae38f..3ac7dc6f2a04 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py @@ -97,17 +97,15 @@ class EvictionPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class FailureAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The compensating action to perform when a Monitored upgrade encounters monitoring policy or - health policy violations. Invalid indicates the failure action is invalid. Rollback specifies - that the upgrade will start rolling back automatically. Manual indicates that the upgrade will - switch to UnmonitoredManual upgrade mode. + health policy violations. + Rollback specifies that the upgrade will start rolling back automatically. + Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode. """ ROLLBACK = "Rollback" - """Indicates that a rollback of the upgrade will be performed by Service Fabric if the upgrade - #: fails.""" + """The upgrade will start rolling back automatically. The value is 0""" MANUAL = "Manual" - """Indicates that a manual repair will need to be performed by the administrator if the upgrade - #: fails. Service Fabric will not proceed to the next upgrade domain automatically.""" + """The upgrade will switch to UnmonitoredManual upgrade mode. The value is 1""" class IPAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -230,6 +228,13 @@ class PrivateEndpointNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMet DISABLED = "disabled" +class PrivateIPAddressVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies whether the IP configuration's private IP is IPv4 or IPv6. Default is IPv4.""" + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + + class PrivateLinkServiceNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enable or Disable apply network policies on private link service in the subnet.""" @@ -252,6 +257,13 @@ class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): UDP = "udp" +class PublicIPAddressVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies whether the IP configuration's public IP is IPv4 or IPv6. Default is IPv4.""" + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + + class RollingUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The mode used to monitor health during a rolling upgrade. The values are Monitored, and UnmonitoredAuto. @@ -388,6 +400,28 @@ class UpdateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: continue.""" +class UpgradeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of upgrade out of the following possible values.""" + + ROLLING = "Rolling" + """The upgrade progresses one upgrade domain at a time. The value is 0""" + + +class UpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode used to monitor health during a rolling upgrade. The values are UnmonitoredAuto, + UnmonitoredManual, Monitored, and UnmonitoredDeferred. + """ + + UNMONITORED_AUTO = "UnmonitoredAuto" + """The upgrade will proceed automatically without performing any health monitoring. The value is 0""" + UNMONITORED_MANUAL = "UnmonitoredManual" + """The upgrade will stop after completing each upgrade domain, giving the opportunity to manually + #: monitor health before proceeding. The value is 1""" + MONITORED = "Monitored" + """The upgrade will stop after completing each upgrade domain and automatically monitor health + #: before proceeding. The value is 2""" + + class VmSetupAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """action to be performed on the vms before bootstrapping the service fabric runtime.""" @@ -397,6 +431,13 @@ class VmSetupAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enables windows HyperV feature.""" +class VmssExtensionSetupOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Vm extension setup order.""" + + BEFORE_SF_RUNTIME = "BeforeSFRuntime" + """Indicates that the vm extension should run before the service fabric runtime starts.""" + + class ZonalUpdateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the update mode for Cross Az clusters.""" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py index 08c9d16e841d..9510cbbfb9c2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py @@ -12,6 +12,8 @@ from ._services_operations import ServicesOperations from ._managed_clusters_operations import ManagedClustersOperations from ._managed_az_resiliency_status_operations import ManagedAzResiliencyStatusOperations +from ._managed_maintenance_window_status_operations import ManagedMaintenanceWindowStatusOperations +from ._managed_apply_maintenance_window_operations import ManagedApplyMaintenanceWindowOperations from ._managed_cluster_version_operations import ManagedClusterVersionOperations from ._managed_unsupported_vm_sizes_operations import ManagedUnsupportedVMSizesOperations from ._operation_status_operations import OperationStatusOperations @@ -31,6 +33,8 @@ "ServicesOperations", "ManagedClustersOperations", "ManagedAzResiliencyStatusOperations", + "ManagedMaintenanceWindowStatusOperations", + "ManagedApplyMaintenanceWindowOperations", "ManagedClusterVersionOperations", "ManagedUnsupportedVMSizesOperations", "OperationStatusOperations", diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py index 4b07329eff5c..74c2a64d8e92 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +66,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +88,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -104,7 +105,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +129,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,7 +146,7 @@ def build_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +186,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +203,7 @@ def build_list_by_application_types_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +218,7 @@ def build_list_by_application_types_request( "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -347,7 +348,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeVersionResource") @@ -381,14 +382,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ApplicationTypeVersionResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -706,7 +713,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeVersionUpdateParameters") @@ -794,8 +801,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py index 4d3ee87c2679..a9ec3a68f2ac 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +60,7 @@ def build_get_request( "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +77,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92,7 +93,7 @@ def build_create_or_update_request( "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +112,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,7 +128,7 @@ def build_update_request( "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -161,7 +162,7 @@ def build_delete_request( "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +177,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +191,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -405,7 +406,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeResource") @@ -563,7 +564,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationTypeUpdateParameters") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py index ebe7996ff1d7..e84715e766a0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,13 +39,147 @@ _SERIALIZER.client_side_validation = False +def build_read_upgrade_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/fetchUpgradeStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_rollback_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/startRollback", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resume_upgrade_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/resumeUpgrade", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # 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, params=_params, headers=_headers, **kwargs) + + +def build_update_upgrade_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/updateUpgrade", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # 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, params=_params, headers=_headers, **kwargs) + + def build_get_request( resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +194,7 @@ def build_get_request( "applicationName": _SERIALIZER.url("application_name", application_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +211,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92,7 +227,7 @@ def build_create_or_update_request( "applicationName": _SERIALIZER.url("application_name", application_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +246,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,98 +262,837 @@ def build_update_request( "applicationName": _SERIALIZER.url("application_name", application_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`applications` attribute. + """ + + models = _models + + 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") + + def _read_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_read_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._read_upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _read_upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/fetchUpgradeStatus" + } + + @distributed_trace + def begin_read_upgrade( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Get the status of the latest application upgrade. + + Get the status of the latest application upgrade. It will query the cluster to find the status + of the latest application upgrade. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._read_upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_read_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/fetchUpgradeStatus" + } + + def _start_rollback_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_rollback_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_rollback_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_rollback_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/startRollback" + } + + @distributed_trace + def begin_start_rollback( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Send a request to start a rollback of the current application upgrade. + + Send a request to start a rollback of the current application upgrade. This will start rolling + back the application to the previous version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_rollback_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start_rollback.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/startRollback" + } + + def _resume_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeResumeApplicationUpgradeParameters") + + request = build_resume_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._resume_upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/resumeUpgrade" + } + + @overload + def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.RuntimeResumeApplicationUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to resume the current application upgrade. + + Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to resume the current application upgrade. + + Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to resume the current application upgrade. + + Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Is either a + RuntimeResumeApplicationUpgradeParameters type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._resume_upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_resume_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/resumeUpgrade" + } - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + def _update_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeApplicationUpgradeUpdateDescription, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - # 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") + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RuntimeApplicationUpgradeUpdateDescription") -def build_delete_request( - resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + request = build_update_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) - accept = _headers.pop("Accept", "application/json") + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_name, "str"), - } + response = pipeline_response.http_response - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if cls: + return cls(pipeline_response, None, response_headers) - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + _update_upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/updateUpgrade" + } + @overload + def begin_update_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.RuntimeApplicationUpgradeUpdateDescription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to update the current application upgrade. -def build_list_request(resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + Send a request to update the current application upgrade. This will update the application + upgrade settings for the current upgrade. - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) - accept = _headers.pop("Accept", "application/json") + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeApplicationUpgradeUpdateDescription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - } + @overload + def begin_update_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to update the current application upgrade. - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + Send a request to update the current application upgrade. This will update the application + upgrade settings for the current upgrade. - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + @distributed_trace + def begin_update_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeApplicationUpgradeUpdateDescription, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to update the current application upgrade. - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + Send a request to update the current application upgrade. This will update the application + upgrade settings for the current upgrade. + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Is either a + RuntimeApplicationUpgradeUpdateDescription type or a IO type. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeApplicationUpgradeUpdateDescription or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -class ApplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_upgrade_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`applications` attribute. - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - models = _models + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # 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") + begin_update_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/updateUpgrade" + } @distributed_trace def get( @@ -316,7 +1190,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationResource") @@ -349,14 +1223,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ApplicationResource", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ApplicationResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -649,7 +1529,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ApplicationUpdateParameters") @@ -735,8 +1615,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py new file mode 100644 index 000000000000..75a2e1539c41 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py @@ -0,0 +1,147 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request(resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applyMaintenanceWindow", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedApplyMaintenanceWindowOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_apply_maintenance_window` attribute. + """ + + models = _models + + 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 post( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> None: + """Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any + pending update will be applied. + + Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any + pending update will be applied. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_post_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.post.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applyMaintenanceWindow" + } diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py index c18c26a7dec8..8c4840d47fdd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py index f15c1bf0b2f4..a7e55111d783 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_get_request(location: str, cluster_version: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_request(location: str, cluster_version: str, subscription_id: str, "clusterVersion": _SERIALIZER.url("cluster_version", cluster_version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_get_by_environment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_get_by_environment_request( "clusterVersion": _SERIALIZER.url("cluster_version", cluster_version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +103,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +116,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +136,7 @@ def build_list_by_environment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_list_by_environment_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py index 8ff2bc55af66..85e91f3819d2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,20 +43,20 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +71,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +82,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,7 +97,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +111,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,7 +128,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +143,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,7 +162,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,7 +177,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +196,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,7 +210,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -326,7 +327,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters" } @distributed_trace @@ -502,7 +503,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ManagedCluster") @@ -534,14 +535,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -812,7 +819,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ManagedClusterUpdateParameters") @@ -896,8 +903,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py new file mode 100644 index 000000000000..e8afdfd1b81d --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py @@ -0,0 +1,147 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getMaintenanceWindowStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedMaintenanceWindowStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_maintenance_window_status` attribute. + """ + + models = _models + + 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 get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ManagedMaintenanceWindowStatus: + """Action to get Maintenance Window Status of the Service Fabric Managed Clusters. + + Action to get Maintenance Window Status of the Service Fabric Managed Clusters. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedMaintenanceWindowStatus or the result of cls(response) + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedMaintenanceWindowStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ManagedMaintenanceWindowStatus] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedMaintenanceWindowStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getMaintenanceWindowStatus" + } diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py index 4f129c84ec81..35e969cdd412 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -68,7 +68,7 @@ def build_get_request(location: str, vm_size: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_request(location: str, vm_size: str, subscription_id: str, **kwarg "vmSize": _SERIALIZER.url("vm_size", vm_size, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py index feb37a451676..e55cfc9af439 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_list_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py index 326886b9900e..2ddbc2a19bc2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,13 +45,13 @@ def build_list_by_managed_clusters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -58,7 +59,7 @@ def build_list_by_managed_clusters_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,7 +76,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -91,7 +92,7 @@ def build_restart_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +111,7 @@ def build_reimage_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -126,7 +127,7 @@ def build_reimage_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +146,7 @@ def build_delete_node_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -161,7 +162,7 @@ def build_delete_node_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,7 +181,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +196,7 @@ def build_get_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -212,7 +213,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -228,7 +229,7 @@ def build_create_or_update_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -247,7 +248,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -263,7 +264,7 @@ def build_update_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -282,7 +283,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +298,7 @@ def build_delete_request( "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -417,7 +418,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) list_by_managed_clusters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes" } def _restart_initial( # pylint: disable=inconsistent-return-statements @@ -446,7 +447,7 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeActionParameters") @@ -479,8 +480,15 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart" @@ -680,7 +688,7 @@ def _reimage_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeActionParameters") @@ -713,8 +721,15 @@ def _reimage_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _reimage_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage" @@ -914,7 +929,7 @@ def _delete_node_initial( # pylint: disable=inconsistent-return-statements content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeActionParameters") @@ -947,8 +962,15 @@ def _delete_node_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_node_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode" @@ -1215,7 +1237,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeType") @@ -1248,14 +1270,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("NodeType", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("NodeType", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -1541,7 +1569,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "NodeTypeUpdateParameters") @@ -1627,8 +1655,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py index 00b00ad69a8d..c6c9e780934a 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,8 +138,12 @@ def get( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) get.metadata = { "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py index 291d495365d1..3d352375735d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py index f6c8cb58420e..4b4519ef4e8d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py @@ -40,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py index 82347ee9d48f..f070d061c712 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +66,7 @@ def build_get_request( "serviceName": _SERIALIZER.url("service_name", service_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +88,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -104,7 +105,7 @@ def build_create_or_update_request( "serviceName": _SERIALIZER.url("service_name", service_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +129,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,7 +146,7 @@ def build_update_request( "serviceName": _SERIALIZER.url("service_name", service_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +186,7 @@ def build_delete_request( "serviceName": _SERIALIZER.url("service_name", service_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +203,7 @@ def build_list_by_applications_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +218,7 @@ def build_list_by_applications_request( "applicationName": _SERIALIZER.url("application_name", application_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -348,7 +349,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ServiceResource") @@ -382,14 +383,20 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("ServiceResource", pipeline_response) if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = self._deserialize("ServiceResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -706,7 +713,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ServiceUpdateParameters") @@ -794,8 +801,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py new file mode 100644 index 000000000000..f9f4aec662fd --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python application_action_get_upgrade_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.applications.begin_read_upgrade( + resource_group_name="resRg", + cluster_name="myCluster", + application_name="myApp", + ).result() + + +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationActionGetUpgrade_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py new file mode 100644 index 000000000000..e286117ed31e --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python application_action_resume_upgrade_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.applications.begin_resume_upgrade( + resource_group_name="resRg", + cluster_name="myCluster", + application_name="myApp", + parameters={"upgradeDomainName": "UD1"}, + ).result() + + +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationActionResumeUpgrade_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py new file mode 100644 index 000000000000..62a1d53fcb52 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python application_action_start_rollback_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.applications.begin_start_rollback( + resource_group_name="resRg", + cluster_name="myCluster", + application_name="myApp", + ).result() + + +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationActionStartRollback_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_update_upgrade_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_update_upgrade_example.py new file mode 100644 index 000000000000..ccea03d3929d --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_update_upgrade_example.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python application_action_update_upgrade_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.applications.begin_update_upgrade( + resource_group_name="resRg", + cluster_name="myCluster", + application_name="myApp", + parameters={ + "applicationHealthPolicy": { + "considerWarningAsError": True, + "defaultServiceTypeHealthPolicy": { + "maxPercentUnhealthyPartitionsPerService": 10, + "maxPercentUnhealthyReplicasPerPartition": 11, + "maxPercentUnhealthyServices": 12, + }, + "maxPercentUnhealthyDeployedApplications": 10, + "serviceTypeHealthPolicyMap": { + "VotingWeb": { + "maxPercentUnhealthyPartitionsPerService": 13, + "maxPercentUnhealthyReplicasPerPartition": 14, + "maxPercentUnhealthyServices": 15, + } + }, + }, + "name": "fabric:/Voting", + "updateDescription": { + "failureAction": "Manual", + "forceRestart": True, + "healthCheckRetryTimeoutInMilliseconds": "PT0H15M0S", + "healthCheckStableDurationInMilliseconds": "PT1H0M0S", + "healthCheckWaitDurationInMilliseconds": "PT0H0M10S", + "rollingUpgradeMode": "Monitored", + "upgradeDomainTimeoutInMilliseconds": "PT2H0M0S", + "upgradeTimeoutInMilliseconds": "PT2H0M0S", + }, + "upgradeKind": "Rolling", + }, + ).result() + + +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationActionUpdateUpgrade_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py index f906a12038fb..2ba707b0c71c 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.applications.begin_delete( + client.applications.begin_delete( resource_group_name="resRg", cluster_name="myCluster", application_name="myApp", ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py index 9795de89a336..9483153980f5 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py index f2eb7f14e9c5..9115c49aad42 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py index c1e50c9fbe98..15abd2f3e240 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationPatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py index f68e81529a52..78183759b461 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py @@ -47,7 +47,7 @@ def main(): }, "maxPercentUnhealthyDeployedApplications": 0, "serviceTypeHealthPolicyMap": { - "myService": { + "service1": { "maxPercentUnhealthyPartitionsPerService": 30, "maxPercentUnhealthyReplicasPerPartition": 30, "maxPercentUnhealthyServices": 30, @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationPutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationPutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py index c932f769503b..6d9fa5c725a4 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationPutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationPutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py index d270e2831649..8692a47001f1 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.application_types.begin_delete( + client.application_types.begin_delete( resource_group_name="resRg", cluster_name="myCluster", application_type_name="myAppType", ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeNameDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNameDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py index f53228778066..d1c95625d91f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeNameGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNameGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py index 1d0b17fbc656..506082e04653 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeNameListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNameListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py index 84c81ece2894..26ddff61b224 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeNamePatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNamePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py index db4358c8e5c8..f317bbaf922e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeNamePutOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeNamePutOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py index be8eeb9e84a7..08bba12bed05 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py @@ -29,15 +29,14 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.application_type_versions.begin_delete( + client.application_type_versions.begin_delete( resource_group_name="resRg", cluster_name="myCluster", application_type_name="myAppType", version="1.0", ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeVersionDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py index 17dff4a5980e..fbe6c9d47699 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeVersionGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py index dcab53f7c013..d514455618a4 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeVersionListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py index 4bc73c689311..e5bb2bfe2cdf 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeVersionPatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py index 38ad032a6160..840f2c8c367f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ApplicationTypeVersionPutOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ApplicationTypeVersionPutOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py index 71f0d6c6aa1e..c1fbae122771 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py @@ -29,15 +29,14 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.node_types.begin_delete_node( + client.node_types.begin_delete_node( resource_group_name="resRg", cluster_name="myCluster", node_type_name="BE", parameters={"nodes": ["BE_0", "BE_3"]}, ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/DeleteNodes_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/DeleteNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py index 4414fce67ecd..cc9e60e44dc0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.operation_results.get( + client.operation_results.get( location="eastus", operation_id="00000000-0000-0000-0000-000000001234", ) - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/Long_running_operation_result.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Long_running_operation_result.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py index 543ce20f1f4c..d63be16fbe00 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/Long_running_operation_status_failed.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Long_running_operation_status_failed.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py index 7525fee82142..409af10a80bc 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/Long_running_operation_status_succeeded.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Long_running_operation_status_succeeded.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py new file mode 100644 index 000000000000..c8702ac62610 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python managed_apply_maintenance_window_post_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.managed_apply_maintenance_window.post( + resource_group_name="resourceGroup1", + cluster_name="mycluster1", + ) + + +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedApplyMaintenanceWindowPost_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py index 32983ed6871d..fb1f79e4ec8b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/managedAzResiliencyStatusGet_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/managedAzResiliencyStatusGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py index 531244883277..31bd3a61731d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.managed_clusters.begin_delete( + client.managed_clusters.begin_delete( resource_group_name="resRg", cluster_name="myCluster", ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py index 07c5a2dfb687..28cfdc3bc687 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py index cc6bfbe187e0..56f04b97bd82 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterListByResourceGroupOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterListByResourceGroupOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py index 33bf4fdebdad..4b51875fa9ba 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterListBySubscriptionOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterListBySubscriptionOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py index cea0f054e86e..795dfcbc1133 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterPatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py index 17c5e56c4e52..d8fae1db94e9 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py @@ -52,6 +52,7 @@ def main(): "clientConnectionPort": 19000, "clusterCodeVersion": "7.1.168.9494", "clusterUpgradeMode": "Manual", + "ddosProtectionPlanId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/ddosProtectionPlans/myDDoSProtectionPlan", "dnsName": "myCluster", "enableAutoOSUpgrade": True, "enableIpv6": True, @@ -109,7 +110,25 @@ def main(): "sourcePortRange": "*", }, ], + "publicIPPrefixId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.Network/publicIPPrefixes/myPublicIPPrefix", + "publicIPv6PrefixId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.Network/publicIPPrefixes/myPublicIPv6Prefix", "serviceEndpoints": [{"locations": ["eastus2", "usnorth"], "service": "Microsoft.Storage"}], + "upgradeDescription": { + "deltaHealthPolicy": { + "maxPercentDeltaUnhealthyApplications": 40, + "maxPercentDeltaUnhealthyNodes": 20, + "maxPercentUpgradeDomainDeltaUnhealthyNodes": 40, + }, + "forceRestart": False, + "healthPolicy": {"maxPercentUnhealthyApplications": 30, "maxPercentUnhealthyNodes": 10}, + "monitoringPolicy": { + "healthCheckRetryTimeout": "00:55:00", + "healthCheckStableDuration": "00:45:00", + "healthCheckWaitDuration": "00:05:00", + "upgradeDomainTimeout": "03:00:00", + "upgradeTimeout": "12:00:00", + }, + }, "useCustomVnet": True, "zonalResiliency": True, "zonalUpdateMode": "Fast", @@ -121,6 +140,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterPutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterPutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py index b6e7381274ac..87fde8d9b573 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterPutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterPutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py index ca5f76bf5a07..bed3b8a07bd8 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterVersionGetByEnvironment_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionGetByEnvironment_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py index e4dc66fc1d9f..5c17a9271bcf 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterVersionGet_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py index 0c97fad09296..fa8427c930ad 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterVersionListByEnvironment.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionListByEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py index c3b41a7b5a8a..29fa3a9ca679 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ManagedClusterVersionList_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedClusterVersionList_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py new file mode 100644 index 000000000000..8a735139954b --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python managed_maintenance_window_status_get_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.managed_maintenance_window_status.get( + resource_group_name="resourceGroup1", + cluster_name="mycluster1", + ) + print(response) + + +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ManagedMaintenanceWindowStatusGet_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py index 71f7efa93116..b7533f0f2584 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/managedUnsupportedVMSizesGet_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/managedUnsupportedVMSizesGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py index cd1283270bc7..067c7430a690 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/managedUnsupportedVMSizesList_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/managedUnsupportedVMSizesList_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py index 602ab9bea72f..914623c2e5ff 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.node_types.begin_delete( + client.node_types.begin_delete( resource_group_name="resRg", cluster_name="myCluster", node_type_name="BE", ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypeDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py index aab4d3913e5b..2051129e3803 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypeGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py index 0c70592e1c09..a1a85809f0b6 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypeListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py index 8c4b7a465f44..a3d532f01413 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePatchOperationAutoScale_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePatchOperationAutoScale_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py index 09882d161e2c..9200c7c84728 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py index 24492b47cdaa..bc7d6e378523 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py @@ -85,6 +85,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePutOperationAutoScale_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationAutoScale_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py index 21f3b4ccc5a4..9caeb2bb579b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePutOperationCustomImage_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationCustomImage_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py index 093e65791785..9335f6e84372 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py @@ -35,10 +35,10 @@ def main(): node_type_name="BE", parameters={ "properties": { - "VmSharedGalleryImageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-custom-image/providers/Microsoft.Compute/sharedGalleries/35349201-a0b3-405e-8a23-9f1450984307-SFSHAREDGALLERY/images/TestNoProdContainerDImage/versions/latest", "dataDiskSizeGB": 200, "isPrimary": False, "vmInstanceCount": 10, + "vmSharedGalleryImageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-custom-image/providers/Microsoft.Compute/sharedGalleries/35349201-a0b3-405e-8a23-9f1450984307-SFSHAREDGALLERY/images/TestNoProdContainerDImage/versions/latest", "vmSize": "Standard_D3", } }, @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePutOperationCustomSharedGalleriesImage_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationCustomSharedGalleriesImage_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py index b6029452f42a..4d6dd63fbe3d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePutOperationDedicatedHost_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationDedicatedHost_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py index 733d74be96ec..59bd0c88e529 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py @@ -39,13 +39,53 @@ def main(): {"diskLetter": "F", "diskSizeGB": 256, "diskType": "StandardSSD_LRS", "lun": 1}, {"diskLetter": "G", "diskSizeGB": 150, "diskType": "Premium_LRS", "lun": 2}, ], + "additionalNetworkInterfaceConfigurations": [ + { + "dscpConfiguration": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/dscpConfigurations/myDscpConfig" + }, + "enableAcceleratedNetworking": True, + "ipConfigurations": [ + { + "applicationGatewayBackendAddressPools": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/applicationGateways/appgw-test/backendAddressPools/appgwBepoolTest" + } + ], + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/loadBalancers/test-LB/backendAddressPools/LoadBalancerBEAddressPool" + } + ], + "loadBalancerInboundNatPools": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/loadBalancers/test-LB/inboundNatPools/LoadBalancerNATPool" + } + ], + "name": "ipconfig-1", + "privateIPAddressVersion": "IPv4", + "publicIPAddressConfiguration": { + "ipTags": [{"ipTagType": "RoutingPreference", "tag": "Internet"}], + "name": "publicip-1", + "publicIPAddressVersion": "IPv4", + }, + "subnet": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1" + }, + } + ], + "name": "nic-1", + } + ], "capacities": {"ClientConnections": "65536"}, "dataDiskLetter": "S", "dataDiskSizeGB": 200, "dataDiskType": "Premium_LRS", + "dscpConfigurationId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/dscpConfigurations/myDscpConfig", "enableAcceleratedNetworking": True, "enableEncryptionAtHost": True, "enableNodePublicIP": True, + "enableNodePublicIPv6": True, "enableOverProvisioning": False, "evictionPolicy": "Deallocate", "frontendConfigurations": [ @@ -59,9 +99,11 @@ def main(): "isSpotVM": True, "isStateless": True, "multiplePlacementGroups": True, + "natGatewayId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/natGateways/myNatGateway", "placementProperties": {"HasSSD": "true", "NodeColor": "green", "SomeProperty": "5"}, "secureBootEnabled": True, "securityType": "TrustedLaunch", + "serviceArtifactReferenceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/myVmArtifactProfile", "spotRestoreTimeout": "PT30M", "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1", "useDefaultPublicLoadBalancer": True, @@ -75,6 +117,7 @@ def main(): "forceUpdateTag": "v.1.0", "publisher": "Microsoft.Azure.Geneva", "settings": {}, + "setupOrder": ["BeforeSFRuntime"], "type": "GenevaMonitoring", "typeHandlerVersion": "2.0", }, @@ -112,6 +155,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py index 68b3627bf0c9..dfc956e23fb0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py index 51c655679186..d7abeec032cc 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py @@ -64,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypePutOperationStateless_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationStateless_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py new file mode 100644 index 000000000000..b91c29eae4d2 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python node_type_put_operation_vm_image_plan_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.node_types.begin_create_or_update( + resource_group_name="resRg", + cluster_name="myCluster", + node_type_name="BE", + parameters={ + "properties": { + "dataDiskSizeGB": 200, + "isPrimary": False, + "vmImageOffer": "windows_2022_test", + "vmImagePlan": { + "name": "win_2022_test_20_10_gen2", + "product": "windows_2022_test", + "publisher": "testpublisher", + }, + "vmImagePublisher": "testpublisher", + "vmImageSku": "win_2022_test_20_10_gen2", + "vmImageVersion": "latest", + "vmInstanceCount": 10, + "vmSize": "Standard_D3", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypePutOperationVmImagePlan_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py index bfad16293138..81a1acfa3c35 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/NodeTypeSkusListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/NodeTypeSkusListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py index 5639fa6dbe6f..91d10ffe368e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/Operations_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/Operations_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py index 2d7e95ed3c89..5d3fbc8e90b3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py @@ -29,15 +29,14 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.node_types.begin_reimage( + client.node_types.begin_reimage( resource_group_name="resRg", cluster_name="myCluster", node_type_name="BE", parameters={"nodes": ["BE_0", "BE_3"]}, ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ReimageNodes_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ReimageNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py index 95bbca543f15..56d3125d6426 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py @@ -29,15 +29,14 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.node_types.begin_reimage( + client.node_types.begin_reimage( resource_group_name="resRg", cluster_name="myCluster", node_type_name="BE", parameters={"updateType": "ByUpgradeDomain"}, ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ReimageNodes_UD_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ReimageNodes_UD_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py index fb8d6fca01a5..4294c06c878e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py @@ -29,15 +29,14 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.node_types.begin_restart( + client.node_types.begin_restart( resource_group_name="resRg", cluster_name="myCluster", node_type_name="BE", parameters={"nodes": ["BE_0", "BE_3"]}, ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/RestartNodes_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/RestartNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py index ae82c41c46f0..98ed42e3756f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py @@ -29,15 +29,14 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.services.begin_delete( + client.services.begin_delete( resource_group_name="resRg", cluster_name="myCluster", application_name="myApp", service_name="myService", ).result() - print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ServiceDeleteOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServiceDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py index 8c09a27b39bf..9c7d1e18f3d6 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ServiceGetOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServiceGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py index 15a04e098c96..283bfc443950 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ServiceListOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServiceListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py index 83a73c6ae665..d5b47a6c998b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ServicePatchOperation_example.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServicePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py index d59d14d97bcd..816edcde0e52 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ServicePutOperation_example_max.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServicePutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py index efd5a6d5bc62..e2d534404918 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-02-01-preview/examples/ServicePutOperation_example_min.json +# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2023-11-01-preview/examples/ServicePutOperation_example_min.json if __name__ == "__main__": main()